@param array $branchConfig

@return array
338969
public function resolveBranchConfig(array $branchConfig)
    {
        $resolver = new OptionsResolver();
        $resolver
            ->setDefaults(array(
                'path' => null,
                'commands' => array(),
                'options' => array(),
            ))
            ->setAllowedTypes('commands', 'array')
            ->setAllowedTypes('options', 'array')
            ->setAllowedTypes('path', array('string', 'null'))
        ;

        try {
            return $resolver->resolve($branchConfig);
        } catch (InvalidArgumentException $exception) {
            $this->logger->critical('Couldn\'t resolve branch config: '.$exception->getTraceAsString());
            throw $exception;
        }
    }
1234267
protected function getConnections(array $config)
    {
        if (!isset($config['connections'])) {
            throw new \RuntimeException('Configuration must contain a "connections" key');
        }

        if (!is_array($config['connections']) || !$config['connections']) {
            throw new \RuntimeException('Configuration "connections" key must reference a non-empty array');
        }

        $connections = array_filter(
            $config['connections'],
            function ($connection) {
                return $connection instanceof ConnectionInterface;
            }
        );
        if (count($connections) != count($config['connections'])) {
            throw new \RuntimeException(
                'All configuration "connections" array values must implement \Phergie\Irc\ConnectionInterface'
            );
        }

        return $connections;
    }
566085
public function getOptions(array $config)
    {
        $options = Arr::get($config, 'options', []);

        return array_diff_key($this->options, $options) + $options;
    }
559890
public function transform(string $config = ''): array
    {
        $parsed = [];
        if (!empty($config)) {
            $config = \parse_ini_string($config, true, INI_SCANNER_RAW);
            if (\is_array($config)) {
                $parsed = $this->processNode($config);
            }
        }
        return $parsed;
    }
770974
public function getParameters(array $config)
    {
        $params = [
            'opifer_eav.attribute_class' => $config['attribute_class'],
            'opifer_eav.media_class'     => $config['media_class'],
            'opifer_eav.nestable_class'  => $config['nestable_class'],
            'opifer_eav.option_class'    => $config['option_class'],
            'opifer_eav.schema_class'  => $config['schema_class'],
            'opifer_eav.valueset_class'  => $config['valueset_class'],
        ];

        foreach ($config['entities'] as $label => $entity) {
            $params['opifer_eav.entities'][$label] = $entity;
        }

        return $params;
    }
850354
protected function getUrls(array $config)
    {
        if (!isset($config['urls'])
            || !is_array($config['urls'])
            || array_filter($config['urls'], 'is_string') != $config['urls']) {
            throw new \DomainException(
                'urls must be a list of strings containing feed URLs',
                self::ERR_URLS_INVALID
            );
        }
        return $config['urls'];
    }
1120287
protected function getModule($moduleConfig)
    {
        if (!file_exists($moduleConfig)) {
            return [];
        }

        $moduleConfigContent = file_get_contents($moduleConfig);

        return Yaml::parse($moduleConfigContent);
    }
323115
public function getBranch(string $branch): array
    {
        return $this->getApi()->request($this->getApi()
                                             ->sprintf('/repos/:owner/:repo/branches/:branch', $this->getOwner(),
                                                 $this->getRepo(), $branch));
    }
1199174
protected function _getConfigSet() : array
    {

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

        return $this->sortConfigSet(
            $this->getConfigSet(),
            $this->get(self::HIERARCHY_PLACEHOLDER_INDEX)
        );

    }
369560
protected static function buildPHP(array $branches)
	{
		$return = ['', ''];
		foreach ($branches as $branch)
		{
			$return[0] .= $branch['statement'] . '{' . $branch['head'];
			$return[1] .= $branch['statement'] . '{';

			if ($branch['branches'])
			{
				list($head, $tail) = self::buildPHP($branch['branches']);

				$return[0] .= $head;
				$return[1] .= $tail;
			}

			$return[0] .= '}';
			$return[1] .= $branch['tail'] . '}';
		}

		return $return;
	}
357098
protected function getValuesPerCodeBranch()
	{
		$values = [];
		foreach ($this->branchesCode as $value => $branchCode)
		{
			$values[$branchCode][] = $value;
		}

		return $values;
	}
116247
final public function get(array $appConfig): array
    {
        $defaults = $this->getSettings();

        $defaults[static::KEY_ROUTES_FOLDER]          = $appConfig[A::KEY_ROUTES_FOLDER];
        $defaults[static::KEY_WEB_CONTROLLERS_FOLDER] = $appConfig[A::KEY_WEB_CONTROLLERS_FOLDER];

        $apiFolder            = $defaults[static::KEY_API_FOLDER] ?? null;
        $valRulesFolder       = $defaults[static::KEY_JSON_VALIDATION_RULES_FOLDER] ?? null;
        $jsonCtrlFolder       = $defaults[static::KEY_JSON_CONTROLLERS_FOLDER] ?? null;
        $schemasFolder        = $defaults[static::KEY_SCHEMAS_FOLDER] ?? null;
        $schemasFileMask      = $defaults[static::KEY_SCHEMAS_FILE_MASK] ?? null;
        $jsonDataValFolder    = $defaults[static::KEY_JSON_VALIDATORS_FOLDER] ?? null;
        $jsonDataValFileMask  = $defaults[static::KEY_JSON_VALIDATORS_FILE_MASK] ?? null;
        $formsValFolder       = $defaults[static::KEY_FORM_VALIDATORS_FOLDER] ?? null;
        $formsValFileMask     = $defaults[static::KEY_FORM_VALIDATORS_FILE_MASK] ?? null;
        $jsonQueryValFolder   = $defaults[static::KEY_QUERY_VALIDATORS_FOLDER] ?? null;
        $jsonQueryValFileMask = $defaults[static::KEY_QUERY_VALIDATORS_FILE_MASK] ?? null;

        assert(
            $apiFolder !== null && empty(glob($apiFolder)) === false,
            "Invalid API folder `$apiFolder`."
        );
        assert(
            $valRulesFolder !== null && empty(glob($valRulesFolder)) === false,
            "Invalid validation rules folder `$valRulesFolder`."
        );
        assert(
            $jsonCtrlFolder !== null && empty(glob($jsonCtrlFolder)) === false,
            "Invalid JSON API controllers' folder `$jsonCtrlFolder`."
        );
        assert(
            $schemasFolder !== null && empty(glob($schemasFolder)) === false,
            "Invalid Schemas folder `$schemasFolder`."
        );
        assert(empty($schemasFileMask) === false, "Invalid Schemas file mask `$schemasFileMask`.");
        assert(
            $jsonDataValFolder !== null && empty(glob($jsonDataValFolder)) === false,
            "Invalid JSON Validators folder `$jsonDataValFolder`."
        );
        assert(empty($jsonDataValFileMask) === false, "Invalid JSON Validators file mask `$jsonDataValFileMask`.");
        assert(
            $formsValFolder !== null && empty(glob($formsValFolder)) === false,
            "Invalid Forms Validators folder `$formsValFolder`."
        );
        assert(empty($formsValFileMask) === false, "Invalid Forms Validators file mask `$formsValFileMask`.");
        assert(
            $jsonQueryValFolder !== null && empty(glob($jsonQueryValFolder)) === false,
            "Invalid Query Validators folder `$jsonQueryValFolder`."
        );
        assert(empty($jsonQueryValFileMask) === false, "Invalid Query Validators file mask `$jsonQueryValFileMask`.");

        $schemasPath         = $schemasFolder . DIRECTORY_SEPARATOR . $schemasFileMask;
        $jsonDataValPath     = $jsonDataValFolder . DIRECTORY_SEPARATOR . $jsonDataValFileMask;
        $formsValidatorsPath = $formsValFolder . DIRECTORY_SEPARATOR . $formsValFileMask;
        $jsonQueryValPath    = $jsonQueryValFolder . DIRECTORY_SEPARATOR . $jsonQueryValFileMask;

        $requireUniqueTypes = $defaults[static::KEY_SCHEMAS_REQUIRE_UNIQUE_TYPES] ?? true;

        $doNotLogExceptions = $defaults[static::KEY_DO_NOT_LOG_EXCEPTIONS_LIST] ?? [];
        unset($defaults[static::KEY_DO_NOT_LOG_EXCEPTIONS_LIST]);

        [$modelToSchemaMap, $typeToSchemaMap] = $this->createSchemaMapping($schemasPath, $requireUniqueTypes);

        return $defaults + [
                static::KEY_DO_NOT_LOG_EXCEPTIONS_LIST__AS_KEYS => array_flip($doNotLogExceptions),

                static::KEY_MODEL_TO_SCHEMA_MAP => $modelToSchemaMap,
                static::KEY_TYPE_TO_SCHEMA_MAP  => $typeToSchemaMap,

                static::KEY_JSON_VALIDATION_RULE_SETS_DATA =>
                    $this->serializeJsonValidationRules($jsonDataValPath, $jsonQueryValPath),

                static::KEY_ATTRIBUTE_VALIDATION_RULE_SETS_DATA =>
                    $this->serializeFormValidationRules($formsValidatorsPath),
            ];
    }
139414
protected function getPlugins(array $config)
    {
        if (!isset($config['plugins']) || !is_array($config['plugins'])) {
            throw new \RuntimeException(
                'Configuration must contain "plugins" key referencing an array',
                self::ERR_PLUGINS_NONARRAY
            );
        }

        $filtered = array_filter(
            $config['plugins'],
            function($plugin) {
                return !$plugin instanceof PluginInterface;
            }
        );
        if ($filtered) {
            throw new \RuntimeException(
                'Configuration "plugins" key must contain only objects'
                    . ' implementing \Phergie\Irc\Bot\React\PluginInterface',
                self::ERR_PLUGINS_NONPLUGINS
            );
        }

        return $config['plugins'];
    }
47616
public function parseConfiguration($config)
    {
        if (is_string($config)) {
            $config = ['url' => $config];
        }

        $url = $config['url'] ?? null;

        $config = Arr::except($config, 'url');

        if (! $url) {
            return $config;
        }

        $parsedUrl = $this->parseUrl($url);

        return array_merge(
            $config,
            $this->getPrimaryOptions($parsedUrl),
            $this->getQueryOptions($parsedUrl)
        );
    }
1140096
private function databaseFilter(array $config)
    {
        return [
            'driver'   => isset($config['driver'])   ? $config['driver']   : '',
            'name'     => isset($config['dbname'])   ? $config['dbname']   : '',
            'user'     => isset($config['user'])     ? $config['user']     : '',
            'password' => isset($config['password']) ? $config['password'] : '',
        ];
    }
337760
protected function parseProcessors(array $config): array
    {
        $processors = [];

        if (isset($config['processors']) && is_array($config['processors'])) {
            foreach ($config['processors'] as $processor) {
                $processors[] = $processor;
            }
        }

        return $processors;
    }
1198997
public function getByBranch($branchId, array $additionalFields = array())
    {
        return $this->getSingle(
            'region/get',
            'Region',
            array('branch_id' => (int)$branchId, 'fields' => self::getArray($additionalFields))
        );
    }