Применение одного правила по данным из конфига
@param $config
@return bool
971390
protected function _assignRole($config)
    {
        if (!is_array($config)) {
            return false;
        }
        if (!$name = ArrayHelper::getValue($config, 'name')) {
            return false;
        }
        if (!$child = ArrayHelper::getValue($config, 'child')) {
            return false;
        }
        if (!$role = \Yii::$app->authManager->getRole($name)) {
            return false;
        }
        if ($childRoles = ArrayHelper::getValue($child, 'roles')) {
            if ($childRoles) {
                foreach ($childRoles as $name) {
                    if ($roleChild = \Yii::$app->authManager->getRole($name)) {
                        try {
                            \Yii::$app->authManager->addChild($role, $roleChild);
                            $this->stdout("\t\tassign child role: " . $name . ' - success' . "\n", Console::FG_GREEN);
                        } catch (\Exception $e) {
                            //$this->stdout(' - already exist'. "\n");
                        }
                    }
                }
            }
        }
        if ($childPermissions = ArrayHelper::getValue($child, 'permissions')) {
            if ($childPermissions) {
                foreach ($childPermissions as $name) {
                    if ($permissionChild = \Yii::$app->authManager->getPermission($name)) {
                        try {
                            \Yii::$app->authManager->addChild($role, $permissionChild);
                            $this->stdout("\t\tassign child permission: " . $name . " - success" . "\n",
                                Console::FG_GREEN);
                        } catch (\Exception $e) {
                            //$this->stdout(' - already exist'. "\n");
                        }
                    }
                }
            }
        }
        return $role;
    }
926518
protected function _applyRole($config)
    {
        if (!is_array($config)) {
            return false;
        }
        if (!$name = ArrayHelper::getValue($config, 'name')) {
            return false;
        }
        $description = ArrayHelper::getValue($config, 'description');
        if ($role = \Yii::$app->authManager->getRole($name)) {
            return $role;
        }
        //Менеджер который может управлять только своими данными
        $role = \Yii::$app->authManager->createRole($name);
        $role->description = is_array($description) ? \Yii::t($description[0], $description[1]): $description;
        if (\Yii::$app->authManager->add($role)) {
            return $role;
        }
        return false;
    }
1157288
private function checkConfigKeys($config)
    {
        $config = array_change_key_case($config, CASE_LOWER);
        $config = $this->trimArray($config);

        foreach ($config as $key => $value) {
            if (array_key_exists($key, $this->config)) {
                $this->config[$key] = $value;
            } else {
                throw new \Exception('Key ' . $key . ' is either not part of the configuration or has incorrect Key name.
                check the config array key names to match your key names of your config array', 1);
            }
        }
    }
867120
protected function _applyRule($config)
    {
        if (!is_array($config)) {
            return false;
        }
        if (!$calssName = ArrayHelper::getValue($config, 'class')) {
            return false;
        }
        if (!class_exists($calssName)) {
            return false;
        }
        $rule = new $calssName;
        if (!$rule instanceof Rule) {
            return false;
        }

        if ($ruleExist = \Yii::$app->authManager->getRule($rule->name)) {
            return $ruleExist;
        }

        if (\Yii::$app->authManager->add($rule)) {
            return $rule;
        }

        return false;
    }
166839
static public function config($config = array())
    {
        !empty($config) && self::$config = array_merge(self::$config, $config);
        if (!empty(self::$config['cachepath'])) {
            Cache::$cachepath = self::$config['cachepath'];
        }
        if (empty(self::$config['component_verify_ticket'])) {
            self::$config['component_verify_ticket'] = Cache::get('component_verify_ticket');
        }
        if (empty(self::$config['token']) && !empty(self::$config['component_token'])) {
            self::$config['token'] = self::$config['component_token'];
        }
        if (empty(self::$config['appsecret']) && !empty(self::$config['component_appsecret'])) {
            self::$config['appsecret'] = self::$config['component_appsecret'];
        }
        if (empty(self::$config['encodingaeskey']) && !empty(self::$config['component_encodingaeskey'])) {
            self::$config['encodingaeskey'] = self::$config['component_encodingaeskey'];
        }
        return self::$config;
    }
856606
public function load(Config $config)
    {
        if (null === $config) {
            $config = new Config();
        }

        $this->loadExtensions($config);

        return $this
            ->applyCommands($config)
            ->applyHooks($config)
        ;
    }
187027
public function init(array $config = [])
    {
        if (!extension_loaded('redis')) {
            return false;
        }

        if (!empty($config['host'])) {
            $config['server'] = $config['host'];
        }

        parent::init($config);

        return $this->_connect();
    }
1202924
public function addFieldsFromConfig(array $config)
    {
        $i = 1;
        foreach ($config as $name => $field) {
            if (is_numeric($name) && !isset($field[$name]['type'])) {
                $fields = [];
                foreach ($field as $n => $f) {
                    $fields[$n] = Fields::create($n, $f);
                }
                if ($i > 1) {
                    $this->fieldsets[$this->current]->createGroup();
                }
                $this->fieldsets[$this->current]->addFields($fields);
                $i++;
            } else {
                $this->addField(Fields::create($name, $field));
            }
        }
        return $this;
    }
794634
public static function setConfig($config = [])
    {
        if (!is_array($config)) {
            return false;
        }
        self::$config = array_merge(self::$config, $config);
        return true;
    }
628638
public function set_config(array $config)
    {
        if (isset($config['convert_integers'])) {
            $this->config['convert_integers'] = (bool)$config['convert_integers'];
        }

        if (isset($config['typecast_objects'])) {
            $this->config['typecast_objects'] = (bool)$config['typecast_objects'];
        }

        return $this;
    }
89662
protected function isParsedConfigValid(array $config)
    {
        $inConfig = count(array_intersect_key(array_flip($this->required), $config));

        return $inConfig === count($this->required);
    }
1154576
public function check(array $config): bool
    {
        $this->notRunningPrograms = new Collection(Arr::get($config, 'programs', []));
        if ($this->notRunningPrograms->isEmpty()) {
            return true;
        }

        if (!$this->systemFunctions->isFunctionAvailable('shell_exec')) {
            $this->message = trans('self-diagnosis::checks.supervisor_programs_are_running.message.shell_exec_not_available');
            return false;
        }

        if ($this->systemFunctions->isWindowsOperatingSystem()) {
            $this->message = trans('self-diagnosis::checks.supervisor_programs_are_running.message.cannot_run_on_windows');
            return false;
        }

        $programs = $this->systemFunctions->callShellExec('supervisorctl status');
        if ($programs === null || $programs === '') {
            $this->message = trans('self-diagnosis::checks.supervisor_programs_are_running.message.supervisor_command_not_available');
            return false;
        }

        $restartedWithin = Arr::get($config, 'restarted_within', 0);
        $programs = explode("\n" , $programs);
        foreach ($programs as $program) {
            /*
             * Capture groups of regex:
             * (program name) (process id) (uptime hours) (minutes) (seconds)
             */
            $isMatch = preg_match(self::REGEX_SUPERVISORCTL_STATUS, trim($program), $matches);
            if ($isMatch) {
                if ($restartedWithin > 0) {
                    $totalSeconds = $matches[3] * 3600 + $matches[4] * 60 + $matches[5];
                    if ($totalSeconds > $restartedWithin) {
                        continue;
                    }
                }

                $this->notRunningPrograms = $this->notRunningPrograms->reject(function ($item) use ($matches) {
                    return $item === $matches[1];
                });
            }
        }

        return $this->notRunningPrograms->isEmpty();
    }
963119
public static function config($config = null)
	{
		if(is_array($config)) {

            # Setting Configurations
			static::$config = $config + static::$config;
			$pathWithoutTrailingSlash = rtrim(static::$config['directory'], '/');
			static::$config['directory'] = $pathWithoutTrailingSlash.'/';

		} elseif(is_string($config)) {

            # Getting Single Config item
			return isset(static::$config[$config]) ? static::$config[$config] : null;

		} elseif(!$config) {

            # Getting All configurations
			return static::$config;
		} else {
			throw new CacheException('Invalid parameter provided for Cache::config()');
		}
	}
1101803
protected function instantiateConfig($config = null)
    {
        if (is_null($this->config) || ! is_null($config)) {
            $this->config = ! is_null($config)
                ? $config
                : new Config($this->helper);
        }

        return $this->config;
    }
30522
public function connect(array $config)
    {
        $port = (isset($config['port'])) ? (int) $config['port'] : 21; //端口号
        $this->linkid = ftp_connect($config['service'], $port);
        if (!$this->linkid) {
            return false;
        }
        @ftp_set_option($this->linkid, FTP_TIMEOUT_SEC, $this->timeout);
        if (@!ftp_login($this->linkid, $config['username'], $config['password'])) {
            return false;
        }

        return true;
    }
194801
protected function createSingleConnection($config)
    {
        $pdo = false;
        $connection = $this->createConnection($config['driver'], $pdo, $config['database'], $config['prefix'], $config);
        $connection->connect($config['host'], $config['username'], $config['password'], $config['database']);
        return $connection;
    }
544028
public function connect($config = array())
    {
        // TODO: Implement connect() method.
        if (isset($config['database']['cache'])) {
            $configCache = $config['database']['cache'];
            $this->conn = new \Memcache();
            if ($this->conn->connect($configCache['host'], $configCache['port'], $configCache['timeout'])) {
                $this->connected = true;
                return true;
            }
        }
        return false;
    }