@param array $configList

@return array
@throws ServerErrorHttpException
@throws \yii\base\InvalidConfigException
341000
public static function runAll(array $configList) {
		if(empty($configList)) {
			return [];
		}
		$result = [];
		$configList = ArrayHelper::toArray($configList);
		foreach($configList as $config) {
			$config = Helper::isEnabledComponent($config);
			if($config) {
				$result[] = self::run($config);
			}
		}
		return $result;
	}
14077
public function setOnDiskConfiguration(?string $configFile = null): ConfigurationBuilder
    {
        $this->configFile = $configFile;

        if ($this->configFile) {
            if (file_exists($path = getcwd() . '/' . $this->configFile)) {
                $this->configFile = $path;
            }

            if (!file_exists($this->configFile)) {
                throw new \InvalidArgumentException('The specified config file is not a valid file.');
            }

            $info = pathinfo($this->configFile);

            $fileExt = strtolower($info['extension']);

            switch ($fileExt) {
                case 'xml':
                    $diskConfig = $this->loadXmlFile($this->configFile);
                    break;

                case 'yml':
                case 'yaml':
                    $diskConfig = Yaml::parse(file_get_contents($this->configFile));
                    break;

                default:
                    throw new \InvalidArgumentException(
                        sprintf(
                            'The specified config file should end in .xml or .yml/.yaml. Unrecognized extension [%s]',
                            $fileExt
                        )
                    );
            }

            $this->configParams = array_merge($this->configParams, $diskConfig);
        }

        return $this;
    }
618834
protected function requestData() : array
    {
        switch ($this->method) {
            case 'post':
                return Yii::$app->request->post();
            case 'get':
                return Yii::$app->request->getQueryParams();
            default:
                throw new InvalidConfigException('Request method is not defined');
        }
    }
1359200
public static function mergeConfig(): array
    {
        $args = \func_get_args();
        $res = array_shift($args) ?: [];
        foreach ($args as $items) {
            if (!\is_array($items)) {
                continue;
            }
            foreach ($items as $k => $v) {
                if ($v instanceof \yii\helpers\UnsetArrayValue || $v instanceof \Yiisoft\Arrays\UnsetArrayValue) {
                    unset($res[$k]);
                } elseif ($v instanceof \yii\helpers\ReplaceArrayValue || $v instanceof \Yiisoft\Arrays\ReplaceArrayValue) {
                    $res[$k] = $v->value;
                } elseif (\is_int($k)) {
                    /// XXX skip repeated values
                    if (\in_array($v, $res, true))  {
                        continue;
                    }
                    if (isset($res[$k])) {
                        $res[] = $v;
                    } else {
                        $res[$k] = $v;
                    }
                } elseif (\is_array($v) && isset($res[$k]) && \is_array($res[$k])) {
                    $res[$k] = self::mergeConfig($res[$k], $v);
                } else {
                    $res[$k] = $v;
                }
            }
        }

        return $res;
    }
190276
public function makeConfigFromArray($configArray = [])
    {
        $object = new stdClass;

        if (!is_array($configArray)) {
            return $object;
        }

        foreach ($configArray as $name => $value) {
            $_name = camel_case($name);
            $object->{$name} = $object->{$_name} = $value;
        }

        return $object;
    }
377185
protected function processConfiguration(array $configs) {
        $config = [];

        foreach ($configs as $group) {
            $config = array_extend_distinct($config, $group);
        }

        return $config;
    }
1031918
public function init()
    {
        if (empty($this->dataProvider)) {
            throw new ServerErrorHttpException('Invalid User Provider.');
        }
        if (is_string($this->actionColumn) && strtolower($this->actionColumn) == self::ACTION_COLUMN_DEFAULT) {
            $this->actionColumn = [
                'class' => ActionColumn::class,
                'header' => Yii::t('user', 'Action'),
                'useIcon' => false,
                'urlCreator' => function ($action, $model, $key, $index, ActionColumn $column) {
                    /* @var $model User */
                    if ($action == 'view') {
                        return Url::to(['view', 'id' => $model->id]);
                    } elseif ($action == 'update') {
                        return Url::to(['update', 'id' => $model->id]);
                    } elseif ($action == 'delete') {
                        return Url::to(['deregister', 'id' => $model->id]);
                    }
                    return '#';
                },
                'visibleButtons' => [
                    'view' => Yii::$app->user->can('viewUser'),
                    'update' => Yii::$app->user->can('updateUser'),
                    'delete' => Yii::$app->user->can('deleteUser'),
                ],
            ];
        }
        parent::init();
    }
499444
public function prepareMenuConfig($config): array
    {
        if (is_string($config)) {
            Configure::load($config);
            $config = Configure::read($this->_defaultConfig['configKey']);
        }

        foreach ($config as $mainItem => &$mainData) {
            if (isset($mainData['url']) && !$this->Auth->urlAllowed($mainData['url'])) {
                unset($config[$mainItem]);
                continue;
            }

            if (!empty($mainData['children']) && !$this->_hasAllowedChildren($mainData['children'])) {
                unset($config[$mainItem]);
                continue;
            }

            if (isset($mainData['shouldRender']) && !$mainData['shouldRender']()) {
                unset($config[$mainItem]);
                continue;
            }

            $this->_isItemActive($mainData);

            $visibleChildCount = 0;
            if (!empty($mainData['children'])) {
                $activeChildCount = 0;
                $visibleChildCount = count($mainData['children']);
                foreach ($mainData['children'] as $subItem => &$subData) {
                    if (isset($subData['shouldRender']) && !$subData['shouldRender']()) {
                        unset($mainData['children'][$subItem]);
                        $visibleChildCount--;
                        continue;
                    }

                    $allowed = (!isset($subData['url']) || (isset($subData['url']) && $this->Auth->urlAllowed($subData['url'])));

                    if ($allowed) {
                        if ($this->_isItemActive($subData)) {
                            $activeChildCount++;
                        }
                    } else {
                        $visibleChildCount--;
                    }
                }
                unset($subData);

                if ($activeChildCount > 1) {
                    foreach ($mainData['children'] as $subItem => &$subData) {
                        $subData['active'] = false;
                    }
                    unset($subData);
                }
            }

            // if the main item has no displayable children, remove it.
            if ($visibleChildCount === 0 && isset($config['children']) && count($config['children']) > 0) {
                unset($config[$mainItem]);
            }
        }
        unset($mainData, $subData);

        //set active status
        if (empty($this->_controllerActive)) {
            $this->_controllerActive = $this->_currentUrl['controller'];
        }
        foreach ($config as &$mainData) {
            $mainData['active'] = '';
            if (!empty($this->_actionActive) && !empty($mainData['url'])) {
                if ($mainData['url']['controller'] == $this->_controllerActive && $mainData['url']['action'] == $this->_actionActive) {
                    $mainData['active'] = true;
                }
            } elseif (!empty($mainData['url']) && $mainData['url']['controller'] == $this->_controllerActive) {
                $mainData['active'] = true;
            }
            if (!empty($mainData['children'])) {
                foreach ($mainData['children'] as &$subData) {
                    $subData['active'] = '';
                    if (!empty($this->_actionActive) && !empty($subData['url'])) {
                        if ($subData['url']['controller'] == $this->_controllerActive && $subData['url']['action'] == $this->_actionActive) {
                            $subData['active'] = true;
                            $mainData['active'] = true;
                        }
                    } elseif (!empty($subData['url']) && $subData['url']['controller'] == $this->_controllerActive) {
                        $mainData['active'] = true;
                    }
                }
            }
        }

        return $config;
    }
129434
protected function getConfig(array $config): array
    {
        $keys = [
            'auth_key',
            'secret',
            'app_id',
            'options',
            'host',
            'port',
            'timeout',
        ];

        foreach ($keys as $key) {
            if (!array_key_exists($key, $config)) {
                throw new InvalidArgumentException("Missing configuration key [$key].");
            }
        }

        foreach ($config['options'] as $option => $value) {
            if (is_null($value)) {
                unset($config['options'][$option]);
            }
        }

        return array_only($config, $keys);
    }
624476
public function getServer()
    {
        if(!$this->has('server')) {
            $storages = [];

            if($this->useJwtToken)
            {
                if(!array_key_exists('access_token', $this->storageMap) || !array_key_exists('public_key', $this->storageMap)) {
                        throw new \yii\base\InvalidConfigException('access_token and public_key must be set or set useJwtToken to false');
                }
                //define dependencies when JWT is used instead of normal token
                \Yii::$container->clear('public_key'); //remove old definition
                \Yii::$container->set('public_key', $this->storageMap['public_key']);
                \Yii::$container->set('OAuth2\Storage\PublicKeyInterface', $this->storageMap['public_key']);

                \Yii::$container->clear('access_token'); //remove old definition
                \Yii::$container->set('access_token', $this->storageMap['access_token']);
            }

            foreach(array_keys($this->storageMap) as $name) {
                $storages[$name] = \Yii::$container->get($name);
            }

            $grantTypes = [];
            foreach($this->grantTypes as $name => $options) {
                if(!isset($storages[$name]) || empty($options['class'])) {
                    throw new \yii\base\InvalidConfigException('Invalid grant types configuration.');
                }

                $class = $options['class'];
                unset($options['class']);

                $reflection = new \ReflectionClass($class);
                $config = array_merge([0 => $storages[$name]], [$options]);

                $instance = $reflection->newInstanceArgs($config);
                $grantTypes[$name] = $instance;
            }


            $server = \Yii::$container->get(Server::className(), [
                $this,
                $storages,
                array_merge([
                    'use_jwt_access_tokens' => $this->useJwtToken,//ADDED
                    'token_param_name' => $this->tokenParamName,
                    'access_lifetime' => $this->tokenAccessLifetime,
                    'require_exact_redirect_uri' => false
                    /** add more ... */
                ], $this->options),
                $grantTypes
            ]);

            $this->set('server', $server);
        }
        return $this->get('server');
    }
623948
public function safeLoadService($configId)
    {
        /**
         * Inline autoloader that will construct a new class based on ConfigurableService
         * @param string $class_name
         */
        $missingClasses = array();
        
        $fallbackAutoload = function($class_name) use (&$missingClasses) {
            $missingClasses[] = $class_name;
            $split = strrpos($class_name, '\\');
            if ($split == false) {
                $result = eval('class '.$class_name.' extends oat\\oatbox\\service\\ConfigurableService {}');
            } else {
                $namespace = substr($class_name, 0, $split);
                $class = substr($class_name, $split+1);
                eval('namespace '.$namespace.'; '.'class '.$class.' extends \\oat\\oatbox\\service\\ConfigurableService {}');
            }
        };
        $serviceManager = $this->getServiceManager();
        spl_autoload_register($fallbackAutoload);
        $service = $serviceManager->get($configId);
        spl_autoload_unregister($fallbackAutoload);
        
        return $service;
    }
1300143
protected function getFilters()
    {
        $filters = [];
        foreach ($this->filters as $alias => $opt) {
            if (!is_array($opt)) {
                $opt = ['filter' => $opt];
            }
            if (!isset($opt['filter'])) {
                throw new InvalidConfigException('Option "filter" required for filter alias "' . $alias . '".');
            }
            if (!isset($this->classmap[$opt['filter']])) {
                throw new InvalidConfigException('Unknown filter "' . $opt['filter'] . '".');
            }
            if (isset($opt['options'])) {
                if (!is_array($opt['options'])) {
                    throw new InvalidConfigException('Expects option "options" to be array, ' .
                        gettype($opt['options']) . ' given in filter "' . $opt['filter'] . '".');
                }
                $filters[$alias] = $this->createFilter($opt['filter'], $opt['options']);
            }
            else {
                $filters[$alias] = $this->createFilter($opt['filter']);
            }
        }
        return $filters;
    }
898347
private function prepareCsrfInstance(array $configs = [])
    {
        $configs = Config::get('security.csrf');

        $field = $configs['field_name'];
        $this->singleton(
            'security.csrf',
            function () use ($field) {
                return (new CsrfToken())->setFormFieldName($field);
            }
        );

    }
185274
private function validateUploadImage(UploadedFile $uploadedImage, array $config)
    {
        $errors = array();

        foreach ($this->validator->validateValue($uploadedImage, $this->getConstraint($config)) as $error) {
            $errors[] = $error->getMessage();
        }

        return $errors;
    }
666948
protected function collect()
    {
        $result = [];

        foreach ($this->_module->collection as $c) {
            if (class_exists($c)) {
                /** @var \rbacc\components\ConfigBase $config */
                $config = Yii::createObject($c);
                $result[] = $config->getData();
            } elseif (file_exists(Yii::getAlias($c))) {
                $result[] = require Yii::getAlias($c);
            } else {
                throw new InvalidConfigException('Class ' . $c . ' does not exist!');
            }
        }

        return $result;
    }
405181
protected function _getConfigSet()
    {

        if (empty($_SERVER) && empty($GLOBALS['argv'])) {
            return [];
        }

        // default config for all of them
        $_config_set = array();
        $host_id     = $this->get('host_id');

        /**
         * if there's a specific port remove the port
         *
         * @todo keep in mind that maybe someone needs a port specific behaviour for his app
         */
        if (($pos = strpos((string)$host_id, ':')) !== false) {
            $this->mainNode->addChild(new Node($this->mainNode, 'host_id', ( string )substr($host_id, 0, $pos)));
        }


        // split up the server host_id to an array
        $id_part_list = (array)explode(self::CONFIG_DELIMITER, $host_id);
        if (count($id_part_list) < 3) {
            array_unshift($id_part_list, self::HIERACHY_PLACEHOLDER);
        }

        // add an extra iteration so there is a specific config for a subdomain
        // and a generic one for all subdomains in this toplevel domain
        $count = (int)count($id_part_list) + 1;
        $i     = 0;


        // we don't need to rebuild this standard strings all the time
        $config_del = self::HIERACHY_PLACEHOLDER . ( string )self::CONFIG_DELIMITER;
        $extension  = self::CONFIG_DELIMITER . self::FILE_EXTENSION;

        // the first config is the current host id + .cfg
        $self = (string)$this->config_path . '/' . (string)implode(self::CONFIG_DELIMITER, $id_part_list) . (string)$extension;

        do {
            // shift the first position of the array
            array_shift($id_part_list);

            // if the file exists add it to the "to be parsed list"
            if (file_exists($self) && !in_array($self, $_config_set)) {
                $_config_set [] = (string)$self;
            }

            $file_name = (string)(count($id_part_list) > 0 ? implode(self::CONFIG_DELIMITER, $id_part_list) . (string)$extension : self::FILE_EXTENSION);
            $self      = (string)$this->config_path . '/' . (string)$config_del . $file_name;
            ++$i;
        } while ($i < $count);

        /**
         * Config sort algorithm
         *
         * lambda function for sorting
         *
         * @param $a string
         * @param $b string
         *
         * @return int
         */
        uasort($_config_set, function ($a, $b) {
            // include to the normal namespace

            if (substr_count($a, self::CONFIG_DELIMITER) == substr_count($a, self::CONFIG_DELIMITER)) {
                if (strpos($a, self::HIERACHY_PLACEHOLDER) == true && strpos($b, self::HIERACHY_PLACEHOLDER) == false) {
                    return -1;
                } elseif (strpos($a, self::HIERACHY_PLACEHOLDER) == false && strpos($b, self::HIERACHY_PLACEHOLDER) == true) {
                    return 1;
                }

                return 0;
            }

            return (substr_count($a, self::CONFIG_DELIMITER) > substr_count($b, self::CONFIG_DELIMITER) ? -1 : 1);
        });

        return $_config_set;
    }
943156
private function parseConfiguredServers(array $servers): Collection
    {
        $result = new Collection();

        foreach ($servers as $server) {
            if (is_array($server)) {
                if (!empty(array_except($server, ['host', 'port', 'timeout']))) {
                    throw new InvalidConfigurationException('Servers in array notation may only contain a host, port and timeout parameter.');
                }
                if (!array_has($server, 'host')) {
                    throw new InvalidConfigurationException('For servers in array notation, the host parameter is required.');
                }

                $host = Arr::get($server, 'host');
                $port = Arr::get($server, 'port');
                $timeout = Arr::get($server, 'timeout', self::DEFAULT_TIMEOUT);

                $result->push(new Server($host, $port, $timeout));
            } else if (is_string($server)) {
                $result->push(new Server($server, null, self::DEFAULT_TIMEOUT));
            } else {
                throw new InvalidConfigurationException('The server configuration may only contain arrays or strings.');
            }
        }

        return $result;
    }