/** * Send through our custom router * * @param $request * * @return Response */ protected function sendRequestThroughRouter($request) { $this->app->instance('request', $request); return (new Pipeline($this->app))->send($request)->through($this->middleware)->then(function ($request) { return $this->router->dispatch($this->alexaRequest); }); }
/** * Create a fresh mock instance for the given class. * * @param string $name * @return \Mockery\Expectation */ protected static function createFreshMockInstance($name) { static::$resolvedInstance[$name] = $mock = static::createMockByName($name); if (isset(static::$app)) { static::$app->instance($name, $mock); } return $mock; }
/** * Create a fresh mock instance for the given class. * * @param string $name * @return \Mockery\Expectation */ protected static function createFreshMockInstance($name) { static::$resolvedInstance[$name] = $mock = static::createMockByName($name); $mock->shouldAllowMockingProtectedMethods(); if (isset(static::$app)) { static::$app->instance($name, $mock); } return $mock; }
/** * Bootstrap the given application. * * @param \Illuminate\Contracts\Foundation\Application $app * * @return void */ public function bootstrap(Application $app) { $items = []; $app->instance('config', $config = new Repository($items)); $this->loadConfigurationFiles($app, $config); mb_internal_encoding('UTF-8'); }
/** * Bootstrap the given application. * * @param \Illuminate\Contracts\Foundation\Application $app * @return void */ public function bootstrap(Application $app) { /** @var \Illuminate\Foundation\Application $app*/ $env = $app->environment(); $filesystem = $this->files = new Filesystem(); $loader = new FileLoader($filesystem, $app['path.config']); $config = new Repository($loader, $filesystem, $env); $loader->setRepository($config); $app->instance('config', $config); $configuredLoader = $app['config']->get('laradic_config.loader'); if (isset($configuredLoader) && $configuredLoader !== 'file') { if ($configuredLoader === 'db') { $loader = new DatabaseLoader($filesystem, $app['path.config']); $config->setLoader($loader); $app->booted(function () use($app, $loader, $config) { $loader->setDatabase($app['db']->connection()); $loader->setDatabaseTable($app['config']->get('laradic_config.loaders.db.table')); }); $loader->setRepository($config); } } if (file_exists($cached = $app->getCachedConfigPath()) && !$app->runningInConsole()) { $items = (require $cached); $loadedFromCache = true; } if (!isset($loadedFromCache)) { # $this->loadConfigurationFiles($app, $config); } date_default_timezone_set($config['app.timezone']); mb_internal_encoding('UTF-8'); }
/** * Get the route dispatcher callback. * * @return \Closure */ protected function dispatchToRouter() { return function ($request) { $this->app->instance('request', $request); return $this->router->dispatch($request); }; }
/** * Register the logger instance in the container. * * @param \Illuminate\Foundation\Application|Application $app * @return \Illuminate\Log\Writer */ protected function registerLogger(Application $app) { $logger = new Logger($app->environment()); //< do not move this! it might produce "Class declarations may not be nested" error $log = new Writer($logger, $app['events']); $app->instance('log', $log); return $log; }
/** * Bootstrap the given application. * * @param \Illuminate\Contracts\Foundation\Application|\Notadd\Foundation\Application $application * * @return void */ public function bootstrap(Application $application) { $loader = new FileLoader(new Filesystem(), $application['path'] . DIRECTORY_SEPARATOR . 'configurations'); $application->instance('config', $configuration = new Repository($loader, $application->environment())); if (!isset($loadedFromCache)) { $this->loadConfigurationFiles($application, $configuration); } mb_internal_encoding('UTF-8'); }
/** * Bootstrap the given application. * * @param \Illuminate\Contracts\Foundation\Application $app * @return void */ public function bootstrap(Application $app) { $fileLoader = new FileLoader(new Filesystem(), base_path() . '/config'); $app->instance('config', $config = new Repository($fileLoader, $app['env'])); date_default_timezone_set($config['app.timezone']); mb_internal_encoding('UTF-8'); // Fix for XDebug aborting threads > 100 nested ini_set('xdebug.max_nesting_level', 300); }
protected function storeConfiguration() { $dbConfig = $this->dbConfig; $config = ['debug' => false, 'database' => ['driver' => $dbConfig['driver'], 'host' => $dbConfig['host'], 'database' => $dbConfig['database'], 'username' => $dbConfig['username'], 'password' => $dbConfig['password'], 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'prefix' => $dbConfig['prefix'], 'strict' => false], 'url' => $this->baseUrl, 'paths' => ['api' => 'api', 'admin' => 'admin']]; $this->info('Testing config'); $this->application->instance('flarum.config', $config); /* @var $db \Illuminate\Database\ConnectionInterface */ $db = $this->application->make('flarum.db'); $version = $db->getPdo()->getAttribute(PDO::ATTR_SERVER_VERSION); if (version_compare($version, '5.5.0', '<')) { throw new Exception('MySQL version too low. You need at least MySQL 5.5.'); } $this->info('Writing config'); file_put_contents($this->getConfigFile(), '<?php return ' . var_export($config, true) . ';'); }
/** * @param \Illuminate\Contracts\Foundation\Application|\Notadd\Foundation\Application $application * * @return void */ public function bootstrap(Application $application) { $items = []; if (file_exists($cached = $application->getCachedConfigPath())) { $items = (require $cached); $loadedFromCache = true; } $application->instance('config', $config = new Repository($items)); if (!isset($loadedFromCache)) { $this->loadConfigurationFiles($application, $config); } $application->detectEnvironment(function () use($config) { return $config->get('app.env', 'production'); }); mb_internal_encoding('UTF-8'); }
/** * Constructor */ public function __construct(\Illuminate\Contracts\Foundation\Application $app) { $this->app = $app; $app->instance('application', $this); if (function_exists('ini_set') && extension_loaded('xdebug')) { ini_set('xdebug.show_exception_trace', false); ini_set('xdebug.scream', false); } // Config TimeZone if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) { date_default_timezone_set(@date_default_timezone_get()); } ErrorHandler::register(); $this->bootstrap(); parent::__construct($this->title, $this->version); }
/** * Bootstrap the given application. * * @param \Illuminate\Contracts\Foundation\Application $app * @return void */ public function bootstrap(Application $app) { $logger = new Writer(new Monolog($app->environment()), $app['events']); // Daily files are better for production stuff $logger->useDailyFiles(storage_path('/logs/laravel.log')); $app->instance('log', $logger); // Next we will bind the a Closure to resolve the PSR logger implementation // as this will grant us the ability to be interoperable with many other // libraries which are able to utilize the PSR standardized interface. $app->bind('Psr\\Log\\LoggerInterface', function ($app) { return $app['log']->getMonolog(); }); $app->bind('Illuminate\\Contracts\\Logging\\Log', function ($app) { return $app['log']; }); }
/** * Bootstrap the given application. * * @param \Illuminate\Contracts\Foundation\Application $app * @return void */ public function bootstrap(Application $app) { $items = []; // First we will see if we have a cache configuration file. If we do, we'll load // the configuration items from that file so that it is very quick. Otherwise // we will need to spin through every configuration file and load them all. if (file_exists($cached = storage_path('framework/config.php'))) { $items = (require $cached); $loadedFromCache = true; } $app->instance('config', $config = new Repository($items)); // Next we will spin through all of the configuration files in the configuration // directory and load each one into the repository. This will make all of the // options available to the developer for use in various parts of this app. if (!isset($loadedFromCache)) { $this->loadConfigurationFiles($config); } date_default_timezone_set($config['app.timezone']); }
/** * Bootstrap the given application. * * @param \Illuminate\Contracts\Foundation\Application $app * @return void */ public function bootstrap(Application $app) { $items = []; // First we will see if we have a cache configuration file. If we do, we'll load // the configuration items from that file so that it is very quick. Otherwise // we will need to spin through every configuration file and load them all. /*if (file_exists($cached = $app->getCachedConfigPath())) { $items = require $cached; $loadedFromCache = true; }*/ $app->instance('config', $config = new IlluminatoRepository($items)); // Next we will spin through all of the configuration files in the configuration // directory and load each one into the repository. This will make all of the // options available to the developer for use in various parts of this app. if (!isset($loadedFromCache)) { $this->loadConfigurationFiles($app->configPath(), $config); } date_default_timezone_set($config['app.timezone']); mb_internal_encoding('UTF-8'); }
/** * registerLogger method * * @param \Illuminate\Contracts\Foundation\Application $app * @return \Docit\Core\Log\Writer */ protected function registerLogger(Application $app) { $app->instance('docit.log', $log = new Writer(new Monolog($app->environment()), $app['events'])); $log->useFiles($app['config']['docit.log.path']); return $log; }
/** * Register the logger instance in the container. * * @param \Illuminate\Contracts\Foundation\Application $app * @return \Illuminate\Log\Writer */ protected function registerLogger(Application $app) { $app->instance('log', $log = new Writer(new Monolog($app->environment()), $app['events'])); return $log; }
/** * Bootstrap the given application. * * @param \Illuminate\Contracts\Foundation\Application $app * @return void */ public function bootstrap(Application $app) { $url = $app->make('config')->get('app.url', 'http://localhost'); $app->instance('request', Request::create($url, 'GET', [], [], [], $_SERVER)); }
/** * @param Application $app */ protected function extractWordPressClasses(Application $app) { foreach ($this->extract as $extractedClass) { $app->instance($extractedClass, $GLOBALS[$extractedClass]); } }
/** * Bootstrap the given application. * * @param \Illuminate\Contracts\Foundation\Application $app * * @return void */ public function bootstrap(Application $app) { $config = new Repository(); $app->instance('config', $config); $this->loadConfigurationFiles($app, $config); }
/** * Register an instance of an object in the container. * * @param string $abstract * @param object $instance * @return object */ protected function instance($abstract, $instance) { $this->app->instance($abstract, $instance); return $instance; }
/** * Bootstrap the given application. * * @param \Illuminate\Contracts\Foundation\Application $app * @return void */ public function bootstrap(Application $app) { $app->instance('config', $config = new Repository(new FileLoader(new Filesystem(), $app['path.config']), $app->environment())); date_default_timezone_set($config['app.timezone']); }
/** * handle. * * @method handle * * @param \Illuminate\Http\Request $request * @param \Closure $next * * @return \Symfony\Component\HttpFoundation\Response */ public function handle($request, $next) { $this->app->instance('config', $this->config); date_default_timezone_set($this->config->get('app.timezone')); return $next($request); }
/** * Define the application's command schedule. * * @return void */ protected function defineConsoleSchedule() { $this->app->instance('Illuminate\\Console\\Scheduling\\Schedule', $schedule = new Schedule()); $this->schedule($schedule); }
/** * Define the application's command schedule. * * @return void */ protected function defineConsoleSchedule() { $this->app->instance(\Illuminate\Console\Scheduling\Schedule::class, $schedule = new Schedule()); $this->schedule($schedule); }