Properly handle if the API is disabled
parent
d0475b22c1
commit
6af93506f1
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace BusinessLogic\Settings;
|
||||||
|
|
||||||
|
|
||||||
|
use DataAccess\Settings\ModsForHeskSettingsGateway;
|
||||||
|
|
||||||
|
class ApiChecker {
|
||||||
|
/* @var $modsForHeskSettingsGateway ModsForHeskSettingsGateway */
|
||||||
|
private $modsForHeskSettingsGateway;
|
||||||
|
|
||||||
|
function __construct($modsForHeskSettingsGateway) {
|
||||||
|
$this->modsForHeskSettingsGateway = $modsForHeskSettingsGateway;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isApiEnabled($heskSettings) {
|
||||||
|
$modsForHeskSettings = $this->modsForHeskSettingsGateway->getAllSettings($heskSettings);
|
||||||
|
|
||||||
|
return intval($modsForHeskSettings['public_api']) === 1;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue