Jarves\Controller\Admin\BackendController::getSettingsAction PHP Метод

getSettingsAction() публичный Метод

public getSettingsAction ( FOS\RestBundle\Request\ParamFetcher $paramFetcher ) : array
$paramFetcher FOS\RestBundle\Request\ParamFetcher
Результат array
    public function getSettingsAction(ParamFetcher $paramFetcher)
    {
        $keys = $paramFetcher->get('keys');
        $loadKeys = $keys;
        if (!$loadKeys) {
            $loadKeys = false;
        }
        $res = array();
        if ($loadKeys == false || in_array('modules', $loadKeys)) {
            foreach ($this->jarves->getConfigs() as $config) {
                $res['bundles'][] = $config->getBundleName();
            }
        }
        if ($loadKeys == false || in_array('configs', $loadKeys)) {
            $res['configs'] = $this->jarves->getConfigs()->toArray();
        }
        if ($loadKeys == false || in_array('themes', $loadKeys)) {
            foreach ($this->jarves->getConfigs() as $key => $config) {
                if ($config->getThemes()) {
                    foreach ($config->getThemes() as $themeTitle => $theme) {
                        /** @var $theme \Jarves\Configuration\Theme */
                        $res['themes'][$theme->getId()] = $theme->toArray();
                    }
                }
            }
        }
        if ($loadKeys == false || in_array('upload_max_filesize', $loadKeys)) {
            $v = ini_get('upload_max_filesize');
            $v2 = ini_get('post_max_size');
            $b = $this->toBytes($v < $v2 ? $v : $v2);
            $res['upload_max_filesize'] = $b;
        }
        if ($loadKeys == false || in_array('groups', $loadKeys)) {
            $res['groups'] = GroupQuery::create()->find()->toArray(null, null, TableMap::TYPE_CAMELNAME);
        }
        if ($loadKeys == false || in_array('user', $loadKeys)) {
            $user = $this->pageStack->getUser();
            if ($settings = $user->getSettings()) {
                if ($settings instanceof Properties) {
                    $res['user'] = $settings->toArray();
                }
            }
            if (!isset($res['user'])) {
                $res['user'] = array();
            }
        }
        if ($loadKeys == false || in_array('system', $loadKeys)) {
            $system = clone $this->jarves->getSystemConfig();
            $system->setDatabase(null);
            $system->setPasswordHashKey('');
            $res['system'] = $system->toArray();
        }
        if ($loadKeys == false || in_array('domains', $loadKeys)) {
            $res['domains'] = $this->container->get('jarves.objects')->getList('JarvesBundle:Domain', null, array('permissionCheck' => true));
        }
        if ($loadKeys == false || in_array('langs', $loadKeys)) {
            $codes = Tools::listToArray($this->jarves->getSystemConfig()->getLanguages());
            $query = LanguageQuery::create()->filterByCode($codes);
            $tlangs = $query->find()->toArray(null, null, TableMap::TYPE_CAMELNAME);
            $langs = [];
            foreach ($tlangs as $lang) {
                $langs[$lang['code']] = $lang;
            }
            #$langs = dbToKeyIndex($tlangs, 'code');
            $res['langs'] = $langs;
        }
        return $res;
    }