Executes loading of bundle's routes into application's front controller.

@param Config        $config
@param callable|null $recipe
190505
private function loadRoutes(Config $config, callable $recipe = null)
    {
        if (false === $this->runRecipe($config, $recipe)) {
            $route = $config->getRouteConfig();
            if (true === is_array($route) && 0 < count($route)) {
                $this->application->getController()->registerRoutes(
                    $this->generateBundleServiceId($this->getBundleIdByBaseDir($config->getBaseDir())),
                    $route
                );
            }
        }
    }
968404
public static function run(array &$config) {
		self::$config = $config;
		self::startTemplateEngine ( $config );
		if (isset ( $config ['sessionName'] ))
			USession::start ( $config ['sessionName'] );
		self::forward ( $_GET ['c'] );
	}
1099664
protected function run(Config $config): ResultInterface
    {
        $includes = $config->compileIncludes();

        return $this->validator->validate(...$includes);
    }
1258555
public function load(array $configs, ContainerBuilder $container): void
    {
        $configuration = new Configuration();
        $config = $this->processConfiguration($configuration, $configs);

        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
        $loader->load('services.yml');

        // If the search bundle is active register search services.
        $bundles = $container->getParameter('kernel.bundles');
        if (isset($bundles['BkstgSearchBundle'])) {
            $loader->load('services.search.yml');
        }
        $this->configureFilesystemAdapter($container, $config);
        $this->configureCdnAdapter($container, $config);
    }
1271767
public function load(array $config)
    {
        foreach ($config as $id => $classname) {
            $serviceId = $this->generateBundleServiceId($id);

            if (false === $this->container->hasDefinition($serviceId)) {
                $baseDir = $this->buildBundleBaseDirectoryFromClassname($classname);
                $this->bundlesBaseDir[$serviceId] = $baseDir;
                $this->container->setDefinition(
                    $serviceId,
                    $this->buildBundleDefinition($classname, $id, $baseDir)
                );

                $this->bundleInfos[$id] = [
                    'main_class' => $classname,
                    'base_dir'   => $baseDir,
                ];
            }
        }

        if (0 < count($this->bundlesBaseDir)) {
            $this->loadFullBundles();
        }
    }
1299557
public function loadConfiguration(array &$moduleConfig, array &$globalConfig) {
		if (!isset($moduleConfig[self::CONFIG_ENGINES])) {
			$moduleConfig[self::CONFIG_ENGINES] = [];
		}
	}
985201
protected function handleRoutes(Router $router, $config = [])
    {
        if ($this->app->routesAreCached() === false) {
            $router->group(array_merge([
                'namespace' => $this->namespace,
            ], $config), function (Router $router) {
                require __DIR__.'/../routes/web.php';
            });
        }
    }
1242114
protected function init($config) {
        parent::init($config);
        if (!$this->dataUrl) {
            $this->dataUrl = WebApp::get()->request()->getCurrentURL(); // if dataUrl is not set then current URL will be used;
        }
        if ($this->handleRequest) {
            $this->_handle();
            die();
        }

        return true;
    }
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;
    }
927118
public static function start(&$config)
    {
        $config = array_merge(array(
        
            // default action name
            'default_action' => 'index',
        
            // directories where to find controllers
            'dirs' => array('app/actions', 'app/controllers'),

            // default controller namespaces
            'namespace' => ''
            
        ), $config);
        
        self::$config = &$config;
        Atomik::set('app.executor', 'Atomik\Controller\Plugin::execute');
        Atomik::add('atomik.dirs.includes', array_filter(Atomik::path((array) self::$config['dirs'])));
    }
956781
public function reload(\Erebot\Interfaces\Config\Server $config)
    {
        $this->loadModules(
            $config,
            \Erebot\Module\Base::RELOAD_ALL
        );
        $this->config = $config;
    }
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;
    }
16141
protected function _setup($config) {
        if (!empty($config['url'])) {
            $this->_url = $config['url'];
        }
        if (!empty($config['params'])) {
            $this->_params = $config['params'];
        }
    }
545434
public function handle(Config $config)
    {
        $sampleOption = $this->option('sample');

        $type = 'empty';
        if( $sampleOption )
        {
            $type = 'sample';
        }

        $from = __DIR__ . '/../../resources/'.$type.'_schema.xml';
        $to = $config->get('propel.propel.paths.schemaDir') . '/' . $config->get('propel.propel.generator.schema.basename') . '.xml';

        if( ! copy($from, $to) )
        {
            throw new \Exception('Failed to copy a file "' . $from . '" to "' . $to . '"');
        }

        $content = file_get_contents($to);

        $name = $config->get('propel.propel.generator.defaultConnection');
        $content = str_replace('**NAME**', $name, $content);

        $nameSpace = $this->laravel->getNamespace() . str_replace(app_path().DIRECTORY_SEPARATOR, '', $config->get('propel.propel.paths.phpDir'));
        $content = str_replace('**NAMESPACE**', $nameSpace, $content);

        file_put_contents($to, $content);

        $this->comment(PHP_EOL . 'Create ' . $to . PHP_EOL);
    }
886080
public function run(...$argv) : void
    {
        $recipe = $this->recipe;
        if (isset($this->config->aliases, $this->config->aliases->$recipe)) {
            $alias = $this->config->aliases->$recipe;
            $recipe = $alias[0];
            $argv = array_merge(array_splice($alias, 1), $argv);
        }
        $file = "{$this->path}/recipes/$recipe/Recipe.php";
        if (strpos($recipe, '@')) {
            list($vendor, $recipe) = explode('@', $recipe);
            $file = "{$this->path}/vendor/$vendor/recipes/$recipe/Recipe.php";
            if (!file_exists($file)) {
                $file = "{$this->path}/recipes/$recipe/Recipe.php";
            }
        }
        if (file_exists($file)) {
            $recipefn = require $file;
            $reflection = new ReflectionFunction($recipefn);
            $wanteds = $reflection->getParameters();
            if ($reflection->getNumberOfRequiredParameters() > count($argv)) {
                $usage = call_user_func($tmp = function () use (&$tmp, &$wanteds) : string {
                    $param = array_shift($wanteds);
                    $out = ' ';
                    if ($param->isOptional()) {
                        $out .= '[';
                    }
                    if ($param->isVariadic()) {
                        $out .= '...';
                    }
                    $out .= strtoupper($param->getName());
                    if ($wanteds) {
                        $out .= $tmp();
                    }
                    if ($param->isOptional()) {
                        $out .= ']';
                    }
                    return $out;
                }, $wanteds);
                fwrite(STDERR, "\nUsage: `$ vendor/bin/codger $recipe$usage`\n\n");
                if ($docComment = $reflection->getDocComment()) {
                    $docComment = preg_replace("@(^/\*\*\n|\n\s?\*/$)@", '', $docComment);
                    $docComment = preg_replace("@^\s?\*\s?@m", '', $docComment);
                    fwrite(STDERR, "$docComment\n\n");
                }
            } else {
                if ($wanteds && end($wanteds)->isVariadic() && end($wanteds)->name == 'options') {
                    $copy = $argv;
                    $this->setOptions(array_splice($copy, count($wanteds) - 1));
                }
                $recipefn->call($this, ...$argv)->process();
            }
        } else {
            fwrite(STDERR, "Recipe `$recipe` could not be found in `{$this->path}/recipes`, skipping...\n");
        }
    }
1037862
public function processRoute(ConfigObject $routeConfig)
    {
        // base route
        $callback = $this->isString($routeConfig->Callback) ? $routeConfig->Callback : $routeConfig->Callback->toArray();
        $route = new Route($routeConfig->Path, $callback);

        // route options
        if (($options = $routeConfig->get('Options', false)) !== false) {
            $route->setOptions($options->toArray());
        }

        // host
        if (($host = $routeConfig->get('Host', false)) !== false) {
            $route->setHost($host);
        }

        // schemes
        if (($schemes = $routeConfig->get('Schemes', false)) !== false) {
            $route->setSchemes($schemes);
        }

        // methods
        if (($methods = $routeConfig->get('Methods', false)) !== false) {
            $route->setMethods($methods->toArray());
        }

        // tags
        if (($tags = $routeConfig->get('Tags', false)) !== false) {
            $route->setTags($tags->toArray());
        }

        return $route;
    }
638293
public function updateRouteConfig(array &$config)
    {
        if ($this->loadCachedConfig($config)) {
            return;
        }

        $routeList = $this->getRouteConfig($this->controllerList());

        if (!sizeof($routeList)) {
            return;
        }

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

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