Setup the application's "global" routables.

Routables can only be defined globally (app-level) for now.

@return void
164200
private function setupRoutables()
    {
        $app = $this;
        // For now, need to rely on a catch-all...
        $this->get(
            '{catchall:.*}',
            function (
                RequestInterface $request,
                ResponseInterface $response,
                array $args
            ) use ($app) {
                $config = $app->config();
                $routables = $config['routables'];
                if ($routables === null || count($routables) === 0) {
                    return $this['notFoundHandler']($request, $response);
                }
                $routeFactory = $this['route/factory'];
                foreach ($routables as $routableType => $routableOptions) {
                    $route = $routeFactory->create($routableType, [
                        'path' => $args['catchall'],
                        'config' => $routableOptions
                    ]);
                    if ($route->pathResolvable($this)) {
                        $this['logger']->debug(
                            sprintf('Loaded routable "%s" for path %s', $routableType, $args['catchall'])
                        );
                        return $route($this, $request, $response);
                    }
                }

                // If this point is reached, no routable has provided a callback. 404.
                return $this['notFoundHandler']($request, $response);
            }
        );
    }
978903
protected function _setup()
    {
            ini_set('session.name', $this->_name);
            ini_set('session.gc_maxlifetime', $this->_lifetime);
            session_set_cookie_params(
        $this->_expiry,
        $this->_path,
        $this->_host,
        $this->_secure,
        $this->_httponly
            );
    }
1331715
public function boot()
    {
        /** @var AspectContainer $aspectContainer */
        $aspectContainer = $this->app->make(AspectContainer::class);

        // Let's collect all aspects and just register them in the container
        $aspects = $this->app->tagged('goaop.aspect');
        foreach ($aspects as $aspect) {
            $aspectContainer->registerAspect($aspect);
        }
    }
322232
protected function setUp(): void
    {
        parent::setUp();

        $this->prevSniffedFile = $this->file->getFilename();

        if (!array_key_exists($var = $this->token['content'], $this->sniffedVars)) {
            // "Sniff" the var name only once ...
            $this->sniffedVars[$var] = Common::isCamelCaps(substr($var, 1));
        }
    }
860324
public static function setupGlobalVariables(): void
	{
		$_SERVER = array_intersect_key($_SERVER, array_flip([
			'PHP_SELF',
			'SCRIPT_NAME',
			'SERVER_ADDR',
			'SERVER_SOFTWARE',
			'HTTP_HOST',
			'DOCUMENT_ROOT',
			'OS',
			'argc',
			'argv',
		]));
		$_SERVER['REQUEST_TIME'] = 1234567890;
		$_ENV = $_GET = $_POST = [];
	}
814699
protected function configure() : void
    {
        $this->setName($this->name)
             ->setDescription('Run git ' . $this->name . ' hook.')
             ->setHelp('This command executes the ' . $this->name . ' hook.');
    }
650442
public function init()
    {
        $this->header('Content-Type: text/html'); // default header.

        $this->proc = new \PHPDaemon\Core\ShellCommand();
        $this->proc->readPacketSize = $this->appInstance->readPacketSize;
        $this->proc->onReadData([$this, 'onReadData']);
        $this->proc->onWrite([$this, 'onWrite']);
        $this->proc->binPath = $this->appInstance->binPath;
        $this->proc->chroot = $this->appInstance->chroot;

        if (isset($this->attrs->server['BINPATH'])) {
            if (isset($this->appInstance->binAliases[$this->attrs->server['BINPATH']])) {
                $this->proc->binPath = $this->appInstance->binAliases[$this->attrs->server['BINPATH']];
            } elseif ($this->appInstance->config->allowoverridebinpath->value) {
                $this->proc->binPath = $this->attrs->server['BINPATH'];
            }
        }

        if (isset($this->attrs->server['CHROOT']) && $this->appInstance->config->allowoverridechroot->value) {
            $this->proc->chroot = $this->attrs->server['CHROOT'];
        }

        if (isset($this->attrs->server['SETUSER']) && $this->appInstance->config->allowoverrideuser->value) {
            $this->proc->setUser = $this->attrs->server['SETUSER'];
        }

        if (isset($this->attrs->server['SETGROUP']) && $this->appInstance->config->allowoverridegroup->value) {
            $this->proc->setGroup = $this->attrs->server['SETGROUP'];
        }

        if (isset($this->attrs->server['CWD']) && $this->appInstance->config->allowoverridecwd->value) {
            $this->proc->cwd = $this->attrs->server['CWD'];
        } elseif ($this->appInstance->config->cwd->value !== null) {
            $this->proc->cwd = $this->appInstance->config->cwd->value;
        } else {
            $this->proc->cwd = dirname($this->attrs->server['SCRIPT_FILENAME']);
        }

        $this->proc->setArgs([$this->attrs->server['SCRIPT_FILENAME']]);
        $this->proc->setEnv($this->attrs->server);
        $this->proc->execute();
    }
877609
public function boot()
    {
        $root = __DIR__.'/../../';
        // Load views
        $this->loadViewsFrom($root . 'resources/views', 'gbrock');

        // Publish views
        $this->publishes([
            $root . 'resources/views' => base_path('resources/views/vendor/gbrock'),
        ]);

        // Publish configuration
        $this->publishes([
            $root . 'config/tables.php' => config_path('gbrock-tables.php'),
        ]);

        // Merge user config, passing in our defaults
        $this->mergeConfigFrom(
            $root . 'config/tables.php', 'gbrock-tables'
        );

        // Publish assets
//        $this->publishes([
//            $root . 'build/assets' => public_path('vendor/gbrock/tables'),
//        ], 'public');
    }
14350
private function setupAutoloader()
    {
        $this->io->title('Updating autoloaders');
        $result = $this->app['extend.action']['autoload']->execute();
        $this->outputResult($result);
    }
936876
public function boot()
    {
        $env = $this->app->environment();
        $repo = $this->app->make(Repository::class);
        $cache = $this->app->make(Cache::class);
        $loaded = $cache->load($env);

        $this->app->terminating(function () use ($repo, $cache) {
            if ($repo->stale()) {
                $cache->clear();
            }
        });

        try {
            if ($loaded === false) {
                $loaded = $repo->all();
                $cache->store($env, $loaded);
            }

            $settings = array_merge($this->app->config->get('setting'), $loaded);

            $this->app->config->set('setting', $settings);
        } catch (Exception $e) {
            //
        }

        // Set the app url.
        if ($appDomain = $this->app->config->get('setting.app_domain')) {
            $this->app->config->set('app.url', $appDomain);
        }

        // Set the locale.
        if ($appLocale = $this->app->config->get('setting.app_locale')) {
            $this->app->config->set('app.locale', $appLocale);
            $this->app->translator->setLocale($appLocale);
            Date::setLocale($appLocale);
        }

        // Set the timezone.
        if ($appTimezone = $this->app->config->get('setting.app_timezone')) {
            $this->app->config->set('cachet.timezone', $appTimezone);
        }

        // Set allowed domains for CORS.
        $allowedOrigins = $this->app->config->get('cors.defaults.allowedOrigins');

        if ($allowedDomains = $this->app->config->get('setting.allowed_domains')) {
            $domains = explode(',', $allowedDomains);
            foreach ($domains as $domain) {
                $allowedOrigins[] = $domain;
            }
        } else {
            $allowedOrigins[] = $this->app->config->get('app.url');
        }

        $this->app->config->set('cors.paths.api/v1/*.allowedOrigins', $allowedOrigins);

        // Set the mail from address.
        if (!$this->app->config->get('mail.from.address')) {
            $url = parse_url($appDomain);

            if (isset($url['host'])) {
                $this->app->config->set('mail.from.address', "notify@{$url['host']}");
            }
        }

        // Set the mail from name.
        if (!$this->app->config->get('mail.from.name')) {
            $this->app->config->set(
                'mail.from.name',
                $this->app->config->get('setting.app_name', $this->app->config->get('app.name'))
            );
        }
    }
191562
private function setup()
    {
        self::$version = '3.1.7';
        self::$src = dirname(__FILE__);
        self::$dir = dirname(dirname(__FILE__));
        self::$url = $this->getCuztomUrl(self::$src);

        // Do
        do_action('cuztom_setup');
    }
431653
public function compileBootableClasses(): void
    {
        // list app root's
        foreach ($this->appRoots as $app) {
            $app .= '/Apps/Controller/' . env_name;
            $files = File::listFiles($app, ['.php'], true);
            foreach ($files as $file) {
                // define full class name with namespace
                $class = 'Apps\Controller\\' . env_name . '\\' . Str::cleanExtension($file);
                // check if class exists (must be loaded over autoloader), boot method exist and this is controller instanceof
                if (class_exists($class) && method_exists($class, 'boot') && is_a($class, 'Ffcms\Core\Arch\Controller', true)) {
                    $this->objects[] = $class;
                }
            }
        }

        // list widget root's
        foreach ($this->widgetRoots as $widget) {
            $widget .= '/Widgets/' . env_name;
            // widgets are packed in directory, classname should be the same with root directory name
            $dirs = Directory::scan($widget, GLOB_ONLYDIR, true);
            if (!Any::isArray($dirs)) {
                continue;
            }

            foreach ($dirs as $instance) {
                $class = 'Widgets\\' . env_name . '\\' . $instance . '\\' . $instance;
                if (class_exists($class) && method_exists($class, 'boot') && is_a($class, 'Ffcms\Core\Arch\Widget', true)) {
                    $this->objects[] = $class;
                }
            }
        }
    }
981102
public function bootstrap()
    {
        # set application timezone
        date_default_timezone_set($this->app->config->getApp('timezone'));

        # set application error log path
        ini_set("error_log", $this->app->logFilePath());

        # set application session name
        ini_set('session.name', 'planet_session');

        # set application session storage path
        session_save_path(realpath($this->app->sessionDirectoryPath()));
    }
1065385
private function setUp()
    {
        // Load the fonts for the drag hint (see #4838)
        $GLOBALS['TL_CONFIG']['loadGoogleFonts'] = true;

        $this->rootDir = \dirname(System::getContainer()->getParameter('kernel.root_dir'));

        if (!$this->dataContainer || !$this->orderField) {
            return;
        }

        $value = $this->dataContainer->getModel()->getProperty($this->orderField);

        // support serialized values.
        if (!\is_array($value)) {
            $value = StringUtil::deserialize($value, true);
        }

        $this->orderId         = $this->orderField . \str_replace($this->strField, '', $this->strId);
        $this->orderFieldValue = (!empty($value) && \is_array($value)) ? \array_filter($value) : [];
    }
286828
protected function setupPackage()
    {
        $configuration = realpath(__DIR__.'/../config/credentials.php');
        $migrations = realpath(__DIR__.'/../migrations');

        $this->publishes([
            $configuration => config_path('credentials.php'),
            $migrations    => base_path('database/migrations'),
        ]);

        $this->mergeConfigFrom($configuration, 'credentials');

        $this->loadViewsFrom(realpath(__DIR__.'/../views'), 'credentials');
    }
19099
protected function configure()
	{
		// Get application file name
		if (!$this->name)
		{
			$file = $_SERVER['argv'][0];
			$file = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $file);
			$file = explode(DIRECTORY_SEPARATOR, $file);
			$file = array_pop($file);
		}
		else
		{
			$file = $this->name;
		}

		$this->setName($file)
			->setDescription('The default application command')
			->addOption(array('h', 'help'),    0, 'Display this help message.',          Option::IS_GLOBAL)
			->addOption(array('q', 'quiet'),   0, 'Do not output any message.',          Option::IS_GLOBAL)
			->addOption(array('v', 'verbose'), 0, 'Increase the verbosity of messages.', Option::IS_GLOBAL)
			->addOption('no-ansi', 0, 'Suppress ANSI colors on unsupported terminals.',   Option::IS_GLOBAL)
			->setHelp(
			// @TODO: Complete the help.
<<<HELP
Welcome to Joomla! Console.
HELP
			);

		// Add a style <option> & <cmd>
		$this->output
			->getProcessor()
			->addStyle('option', new ColorStyle('cyan',    '', array('bold')))
			->addStyle('cmd',    new Colorstyle('magenta', '', array('bold')));
	}
506336
public function runApplication()
    {
        $application = $this->createNew(SymfonyApplication::class, $this->getName());
        foreach ($this->commands as $commandClass) {
            $command = $this->createNew($commandClass);
            $application->add($command);
            if ($command instanceof Command && $command->isDefaultCommand()) {            
                $application->setDefaultCommand($command->getName());
            }
        }        
        $application->run();
    }