Enable/disable maintenance mode

@param bool $enable
@return bool
966581
protected static function enable($enable)
    {
        $data = include INPHINIT_PATH . 'application/Config/config.php';

        if ($data['maintenance'] === $enable) {
            return true;
        }

        $data['maintenance'] = $enable;

        $wd = preg_replace('#,(\s+|)\)#', '$1)', var_export($data, true));

        $path = Storage::temp('<?php' . EOL . 'return ' . $wd . ';' . EOL);

        $response = copy($path, INPHINIT_PATH . 'application/Config/config.php');

        unlink($path);

        return $response;
    }
1084845
public function toggle($enable = null)
    {
        /** @var \yii\db\ActiveRecord $model */
        $model = $this->owner;
        if (($c = $this->enabledAttribute) !== null) {
            $model->$c = $enable === null ? !$model->$c : $enable;
            return $model->save(false, [$c]);
        } elseif (($c = $this->disabledAttribute) !== null) {
            $model->$c = $enable === null ? !$model->$c : !$enable;
            return $model->save(false, [$c]);
        }
        return null;
    }
137492
public function isEnabled()
    {
        if ($this->enabled === null) {
            $environments  = config('songshenzong-log.env', ['dev', 'local', 'production']);
            $this->enabled = in_array(env('APP_ENV'), $environments, true);
        }

        return $this->enabled;
    }
677708
public function handle(MaintenanceModeEnabled $maintenanceMode)
    {
        $logMessage = "Maintenance Mode Enabled";
        if(!is_null($maintenanceMode->message) && $maintenanceMode->message !== "")
        {
            $logMessage .= " with a custom message: \"" . $maintenanceMode->message . "\"";
        }
        Log::alert($logMessage);
    }
193515
public function setInitializeOption(bool $enabled)
    {
        $this->initialized = $enabled ? (bool)$this->initialized : null;
    }
695937
public function enable()
    {
        spl_autoload_register([$this, 'autoload'], true, true);
        spl_autoload_register([$this, 'autoloadOptional'], true, false);
        return $this;
    }
595707
public function setSandboxMode($enable)
    {
        if ($enable instanceof SandBoxMode) {
            $sandbox_mode = $enable;
            $this->sandbox_mode = $sandbox_mode;
            return;
        }
        $this->sandbox_mode = new SandBoxMode($enable);
        return;
    }
163381
public static function isEnabled()
    {
        if (is_null(self::$isEnabled)) {
            self::$isEnabled = (bool) Config::getInstance()->Development['enabled'];
        }

        return self::$isEnabled;
    }
1180561
public function set_debug($enable)
    {
        if ($enable === true || $enable === false) {
            $this->debug = $enable;

            return true;
        }

        trigger_error('Error: the parameter for set_debug() must be boolean');

        return false;
    }
1239299
public function escape($enabled = true)
    {
        if (!is_bool($enabled)) {
            return false;
        }
        $this->setConfig('escape', $enabled);
        Configure::write('Altair.escape', $this->getConfig('escape'));
        return true;
    }
503464
public function disableCreatingCheck(bool $disable = true)
    {
        $this->builder()->getFooter()->disableCreatingCheck($disable);

        return $this;
    }
1091890
private function enabledFilter(bool $include_disabled): Closure
    {
        return static function (ModuleInterface $module) use ($include_disabled): bool {
            return $include_disabled || $module->isEnabled();
        };
    }
1232061
public function isEnable($enable = null)
    {
        if ($enable !== null) {
            $this->enable = (bool) $enable;
        }

        return $this->enable;
    }
352003
public function enabled($state = null)
    {
        if ($state !== null) {
            $this->enabled = (bool)$state;
        }

        return $this->enabled;
    }
386867
public function autoFields($enable = null)
    {
        deprecationWarning(
            'EagerLoader::autoFields() is deprecated. ' .
            'Use enableAutoFields()/isAutoFieldsEnabled() instead.'
        );
        if ($enable !== null) {
            $this->enableAutoFields($enable);
        }

        return $this->isAutoFieldsEnabled();
    }
90325
public static function ActiveEnabled($ForceEnable = FALSE) {
      $AllowCaching = FALSE;
      
      if (defined('CACHE_ENABLED_OVERRIDE'))
         $AllowCaching |= CACHE_ENABLED_OVERRIDE;
         
      $AllowCaching |= C('Cache.Enabled', FALSE);
      $AllowCaching |= $ForceEnable;
      
      return (bool)$AllowCaching;
   }
26118
public function disableFilter(bool $disable = true)
    {
        $this->tools->disableFilterButton($disable);

        return $this->option('show_filter', !$disable);
    }