Adds UrlManager rules.
@param Application $app the application currently running
@since 0.2
184309
protected function addUrlManagerRules($app)
    {
        $app->urlManager->addRules([new GroupUrlRule([
                'prefix' => $this->id,
                'rules' => require __DIR__ . '/url-rules.php',
            ])], true);
    }
232722
public function registerCommands(Application $application)
    {
        foreach ($this->getCommands() as $command) {
            $application->add($command);
        }
    }
873198
public function register(Application $app)
    {
        $this->setup($app);
        $app
            ->offsetGet('console')
            ->getHelperSet()
            ->set(new ConnectionHelper($app->offsetGet('connection')), 'connection')
        ;
    }
95834
public function bootstrap(Application $app)
    {
        $this->app = $app;

        error_reporting(-1);

        set_error_handler([$this, 'handleError']);

        set_exception_handler([$this, 'handleException']);

        register_shutdown_function([$this, 'handleShutdown']);

        if (! $app->environment('testing')) {
            ini_set('display_errors', 'Off');
        }
    }
312065
public function register(Container $app)
    {
        $routerContainer = new RouterContainer();
        $app[Map::class] = $routerContainer->getMap();
        $app[RuleIterator::class] = $routerContainer->getRuleIterator();
    }
937988
public function bootstrap(Application $app)
    {
        foreach ($app['config']->get('supports', []) as $feature => $value)
        {
            if ($value === 'automatic-feed-links')
            {
                add_theme_support($value);
            }
            else
            {
                add_theme_support($feature, $value);
            }
        }
    }
1160739
private function registerWriters(Application $app)
    {
        $writerCollection = $this->getWriterCollection($app);

        $writerCollection['FileIo'] = new Writer\FileIo();
        $writerCollection['checkstyle'] = new Writer\Checkstyle();
        $writerCollection['sourcecode'] = new Writer\Sourcecode();
        $writerCollection['statistics'] = new Writer\Statistics();
        $writerCollection['xml'] = new Writer\Xml($app['transformer.routing.standard']);
        $writerCollection['xsl'] = new Writer\Xsl($app['monolog']);

        $writerCollection['checkstyle']->setTranslator($this->getTranslator($app));
        $writerCollection['xml']->setTranslator($this->getTranslator($app));
    }
1247932
protected function setEnvironment(Application $app)
    {
        // Define acceptable environments
        $environments = array(
            'production',
            'staging',
            'qa',
            'testing',
            'development',
            'beta',
        );

        if (! isset($_SERVER['APP_ENV'])) {
            throw new \Exception('Missing \'APP_ENV\' environment variable');
        }

        if (! in_array($_SERVER['APP_ENV'], $environments)) {
            throw new \Exception('Invalid \'APP_ENV\' environment variable: \'' + $_SERVER['APP_ENV'] +'\'');
        }

        $app['environment'] = $_SERVER['APP_ENV'];
    }
386269
protected function setupMigrations(Application $app)
    {
        $source = realpath(__DIR__.'/../database/migrations/');

        if ($app instanceof LaravelApplication && $app->runningInConsole()) {
            $this->publishes([$source => database_path('migrations')], 'migrations');
        }
    }
990443
protected function callAfterCallbacks(Application $app)
    {
        foreach ($this->_afterCallbacks as $callback) {
            call_user_func($callback, $app);
        }
    }
233554
private function addDefaultArgumentsAndOptions(Application $app) {
    $app->getDefinition()
      ->addOption(
        new InputOption('--define', '-D', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Define a configuration item value.', [])
      );
    $app->getDefinition()
      ->addOption(
        new InputOption('--environment', NULL, InputOption::VALUE_REQUIRED, 'Set the environment to load config from blt/[env].yml file.', [])
      );
    $app->getDefinition()
      ->addOption(
        new InputOption('--site', NULL, InputOption::VALUE_REQUIRED, 'The multisite to execute this command against.', [])
      );
  }
1053525
protected function registerBindings(Application $app)
    {
        $app->bind('telegram.bot', function ($app) {
            $manager = $app['telegram'];

            return $manager->bot();
        });

        $app->alias('telegram.bot', Api::class);
    }
716684
public function boot(Application $app)
    {
        $config = $app['config'];
        if (isset($config['orm.subscribers'])) {
            $app->extend('db.event_manager', function($eventMgr) use($app, $config) {
                /** @var EventManager $eventMgr */
                foreach ($config['orm.subscribers'] as $class) {
                    if (isset($app[$class])) {
                        $eventMgr->addEventSubscriber($app[$class]);
                    } else {
                        $eventMgr->addEventSubscriber(new $class());
                    }
                }
                return $eventMgr;
            });
        }
    }
521233
public function doUpdate( App $app ) {
		// Init App View Component
		if ( ! $app->views_dir ) {
			throw new InvalidArgumentException(
			    __("Parameter 'views_dir' must have been defined in '/wpf/config.json' file.", 'wpf') );
		}
		// By default
		$dir = WP::path( $app->views_dir );
		if ( ! is_dir( $dir ) ) {
			throw new FileNotFoundException(
			    __("Parameter 'views_dir' in '/wpf/config.json' file must be correct path to folder.", 'wpf') );
		}
		$app->setRenderer( new View( $dir ) );
	}
1289824
public function doUpdate( App $app ) {
		$update = function () use ( $app ) {
			if ( ! $app->image_sizes ) {
				return FALSE;
			}
			foreach ( $app->image_sizes as $name => $args ) {
				if ( ! is_array( $args ) ) {
					throw new ConfigException(
					    __("All elements of 'image_sizes' property in '*.config.json' must be arrays.", 'wpf') );
				} elseif ( $name == 'default') {
					set_post_thumbnail_size( ...$args );
					continue;
				}
				add_image_size( $name, ...$args );
			}
		};
		add_action('after_setup_theme', $update );
	}
1105719
public function setApplication($app)
    {
        Argument::i()->test(1, 'string');

        $this->application = $app;
        return $this->setData($this->message);
    }
1223952
public function register(Application $app)
    {
        $app['events.order_subscriber'] = $app->share(function (Application $app) {
            $notifierRegistry = new ValidationNotifierRegistry();

            $notifierRegistry->registerNotifier(Order::NOTIFY_MAIL, new MailNotifier($app));
            $notifierRegistry->registerNotifier(Order::NOTIFY_WEBHOOK, new WebhookNotifier(
                new LazyLocator($app, 'manipulator.webhook-event')
            ));

            return new OrderSubscriber($app, $notifierRegistry);
        });
    }