@param array $routeConfig

@return array
@throws \Exception
424998
protected function buildSwaggerPaths(
        array $routeConfig
    ): array {
        $swaggerPaths = [];

        foreach ($routeConfig as $key => $routeData) {
            $path = Options::getString(
                $routeData,
                'path'
            );

            if (empty($path)) {
                throw new \Exception(
                    'Path is required in route config'
                );
            }
            $configName = BuildRouteName::invoke(
                $key,
                $routeData
            );
            $swaggerPathData = $this->buildSwaggerPathData(
                $configName,
                $path,
                $routeData
            );

            if (array_key_exists($path, $swaggerPaths)) {
                $swaggerPaths[$path] = array_merge($swaggerPaths[$path], $swaggerPathData);
                continue;
            }

            $swaggerPaths[$path] = $swaggerPathData;
        }

        return $swaggerPaths;
    }
429596
protected function checkParams(RouteMatch $match, $routeConfig)
    {
        if (!isset($routeConfig['params'])) {
            return true;
        }

        $params = (array) $routeConfig['params'];
        foreach ($params as $name => $value) {

            $param = $match->getParam($name, null);
            if (null === $param) {
                continue;
            }

            if (!$this->checkParam($param, $value)) {
                return false;
            }
        }

        return true;
    }
1036626
protected function &findConfigSection($routeName, ArrayObject $config)
    {
        $routeParts = explode('/', $routeName);

        reset($routeParts);

        $part = current($routeParts);

        $settings = &$config[$part];

        if (!next($routeParts)) {
            return $settings;
        }

        do {
            $part = current($routeParts);

            $settings = &$settings['child_routes'][$part];
        } while (next($routeParts));

        return $settings;
    }
905548
private function parseRouteConfiguration($route)
    {
        if (!is_array($route)) {
            throw new Exception("Strata configuration file contains an invalid route.");
        }

        return $this->isDynamic($route) ?
            $this->parseDynamicRoute($route) :
            $this->parseMatchedRoute($route);
    }
20377
protected function parentRoutesFor(ResourceConfiguration $config)
    {
        if ($config->getParent()) {
            $parentConfig = $this->configuration->resourceConfigurationFor($config->getParent());

            return $this->parentRoutesFor($parentConfig) . "/{$config->getParent()}/:{$config->getParent()}_id";
        }
    }
395944
public static function invoke(
        array $fieldsConfig
    ): array {
        $fieldsConfigByName = [];
        foreach ($fieldsConfig as $fieldConfig) {
            $name = Property::getRequired(
                $fieldConfig,
                FieldConfig::NAME
            );
            $fieldsConfigByName[$name] = $fieldConfig;
        }

        return $fieldsConfigByName;
    }
217835
public static function parseConfig(array $config)
    {
        $collection = new RouteCollection();
        foreach ($config['routes'] as $name => $route) {
            $collection->attachRoute(new Route($route[0], array(
                '_controller' => str_replace('.', '::', $route[1]),
                'methods' => $route[2],
                'name' => $name
            )));
        }

        $router = new Router($collection);
        if (isset($config['base_path'])) {
            $router->setBasePath($config['base_path']);
        }

        return $router;
    }
380675
public function createConnector(array $config)
    {
        if (!isset($config['driver'])) {
            throw new Exception('A driver must be specified.');
        }

        switch ($config['driver']) {
            case 'mysql':
                return new MySqlConnector;
            case 'pgsql':
                return new PostgresConnector;
            case 'sqlite':
                return new SQLiteConnector;
            case 'sqlsrv':
                return new SqlServerConnector;
            case 'filesystem':
                return new FileSystemConnector;
        }
        throw new Exception("Unsupported driver [{$config['driver']}]");
    }
140804
public function generate($key = '', $config = [], array $query = [])
    {
        $routes = $this->router->getRoutes();
        $queryString = '';
        if (!$key) {
            return $this->protocol . $this->base;
        }
        $routes = $routes->getByOptionKeyValue('id', $key);
        if (!$route = $routes->getFirst()) {
            throw new \Exception("route '$key' cannot be generated");
        }
        $path = ltrim($route->path, '/');
        foreach ($config as $key => $value) {
            $path = str_replace(':' . $key, $value, $path);
        }
        if ($query) {
            $queryString = '?' . http_build_query($query);
        }
        return $this->protocol . $this->base . $path . $queryString;
    }
270798
public function getRoute($url, $config) {
        $url2 = substr($url, strlen(Config::config()['user']['framework']['folder']), strlen($url));
        $routeRight = null;

        foreach ($this->routes as $route) {
            if (($varsValues = $route->match($url2)) != false && ($route->method() == '*' || in_array(Request::instance()->data->method, explode(',', $route->method())) || $route->method() == Request::instance()->data->method)) {
                $routeRight = $route;
                // if she has vars
                if ($route->hasVars()) {
                    $varsNames = $route->varsNames();
                    $listVars = [];

                    //key : name of the var, value = value
                    foreach ($varsValues as $key => $match) {
                        // the first key contains all the captured string (preg_match)
                        if ($key > 0) {
                            if (array_key_exists($key - 1, $varsNames)) {
                                $listVars[$varsNames[$key - 1]] = $match;
                            }
                        }
                    }

                    $route->setVars($listVars);
                }

                /**
                 * sometimes, it's possible to have several times the same URL, for example, one when we are logged and one when we are not logged.
                 * each url has a different ID, so, when we have an url which her "logged" attribute is not correct,
                 * we have to check if there is an other url whith the right "logged" attribute
                 */
                $logged = explode('.', $config->config['firewall']['' . $route->src() . '']['logged']['name']);
                $role = explode('.', $config->config['firewall']['' . $route->src() . '']['roles']['name']);
                $logged = $this->_setFirewallConfigArray($_SESSION, $logged);
                $role = $this->_setFirewallConfigArray($_SESSION, $role);

                switch ($route->logged()) {
                    case 'true' :
                        if ($logged == true && (in_array($role, array_map('trim', explode(',', $route->access()))) || $route->access() == '*')) {
                            return $route;
                        }
                        break;

                    case 'false' :
                        if ($logged == false) {
                            return $route;
                        }
                        break;

                    case '*' :
                        return $route;
                        break;
                }
            }
        }

        if ($routeRight != null && $routeRight->match($url2) != false) {
            return $routeRight;
        }

        return null;
    }
287186
protected function getPlugins(array $config)
    {
        if (!isset($config['plugins'])) {
            throw new \RuntimeException('Configuration must contain a "plugins" key');
        }

        if (!is_array($config['plugins'])) {
            throw new \RuntimeException('Configuration "plugins" key must reference an array');
        }

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

        $this->registerPluginSubscribers($plugins);

        $processors = $this->getPluginProcessors($config);
        $this->processPlugins($plugins, $processors);

        return $plugins;
    }
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()');
		}
	}
1168634
private static function loadTodosFromConfig($config) {
        foreach ($config['campos'] as $clave => $relacion) {
            if ($relacion['tipo'] == "relationship" || $relacion['tipo'] == "relationships" || $relacion['tipo'] == "relationshipssel") {
                if (is_array($config['campos'][$clave]['todos'])) {
                    if (\Sirgrimorum\CrudGenerator\CrudGenerator::countdim($config['campos'][$clave]['todos']) > 1) {
                        try {
                            $modeloM = ucfirst($relacion["modelo"]);
                            $auxTodos = $modeloM::hydrate($config['campos'][$clave]['todos']);
                            $config['campos'][$clave]['todos'] = $auxTodos;
                        } catch (Exception $exc) {
                            
                        }
                    }
                }
                if (!is_array($config['campos'][$clave]['todos'])) {
                    if ($relacion['tipo'] == "relationship") {
                        //$lista = array("-" => "-");
                    }
                    if ($config['campos'][$clave]['todos'] == "") {
                        $modeloM = ucfirst($relacion["modelo"]);
                        $modelosM = $modeloM::all();
                    } else {
                        $modelosM = $config['campos'][$clave]['todos'];
                    }
                    if (isset($relacion['separador'])) {
                        $separador = $relacion['separador'];
                    } else {
                        $separador = "-";
                    }
                    if (isset($config['campos'][$clave]['groupby'])) {
                        $groupBy = $config['campos'][$clave]['groupby'];
                        $modelosM->sortBy(function($elemento) use($groupBy) {
                            return \Sirgrimorum\CrudGenerator\CrudGenerator::getNombreDeLista($elemento, $groupBy, $separador);
                        });
                    }
                    $lista = [];
                    $auxlista = [];
                    $groupId = null;
                    foreach ($modelosM as $elemento) {
                        if (isset($config['campos'][$clave]['groupby'])) {
                            $nombreGroup = \Sirgrimorum\CrudGenerator\CrudGenerator::getNombreDeLista($elemento, $config['campos'][$clave]['groupby'], $separador);
                            if ($groupId === null || $groupId <> $nombreGroup) {
                                if ($groupId !== null) {
                                    $lista[$groupId] = $auxlista;
                                    $auxlista = [];
                                }
                            }
                            $auxlista[$elemento->getKey()] = \Sirgrimorum\CrudGenerator\CrudGenerator::getNombreDeLista($elemento, $relacion['campo'], $separador);
                            $groupId = $nombreGroup;
                        } else {
                            $lista[$elemento->getKey()] = \Sirgrimorum\CrudGenerator\CrudGenerator::getNombreDeLista($elemento, $relacion['campo'], $separador);
                        }
                    }
                    if (count($auxlista) > 0) {
                        $lista[$groupId] = $auxlista;
                    }
                    $config['campos'][$clave]['todos'] = $lista;
                }
            }
        }
        return $config;
    }
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);
            }
        }
    }
262167
public static function init($config, $collectionConfig = array())
    {
        $first = null;

        static::$collectionConfig = $collectionConfig;

        if (empty($config)) {
            return;
        }

        foreach ($config as $key => $value) {
            $value['name'] = $key;

            if (!isset($value['driver'])) {
                throw new Exception(
                    '[Norm] Cannot instantiate connection "'.$key.
                    '", Driver "'.@$value['driver'].'" not found!'
                );
            }

            $Driver = $value['driver'];

            static::$connections[$key] = new $Driver($value);

            if (!static::$connections[$key] instanceof Connection) {
                throw new Exception('Norm connection ['.$key.'] should be instance of Connection');
            }

            if (!$first) {
                $first = $key;
            }
        }

        if (!static::$defaultConnection) {
            static::$defaultConnection = $first;
        }
    }
1035135
protected function getDsn(array $config)
    {
        return $this->hasDsnString($config) ? $this->getDsnString($config) : $this->getHostDsn($config);
    }
318070
public function loadCachedConfig(array &$config)
    {
        $cacheFilePath = $this->config->getCacheFile();

        if (!file_exists($cacheFilePath)) {
            return false;
        }

        $cachedConfig = include $cacheFilePath;

        if (!is_array($cachedConfig)) {
            return false;
        }

        if (!isset($config['routes'])) {
            $config['routes'] = array();
        }

        $this->merger->merge($cachedConfig, $config['routes']);

        return true;
    }