Fix a typo.
[Project_proches_de_moi-server.git] / bin / console
CommitLineData
dec6d031
JB
1#!/usr/bin/env php
2<?php
3
4use App\Kernel;
5use Symfony\Bundle\FrameworkBundle\Console\Application;
6use Symfony\Component\Console\Input\ArgvInput;
7use Symfony\Component\Debug\Debug;
8use Symfony\Component\Dotenv\Dotenv;
9
10set_time_limit(0);
11
12require __DIR__.'/../vendor/autoload.php';
13
14if (!class_exists(Application::class)) {
15 throw new \RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
16}
17
18if (!isset($_SERVER['APP_ENV'])) {
19 if (!class_exists(Dotenv::class)) {
20 throw new \RuntimeException('APP_ENV environment variable is not defined. You need to define environment variables for configuration or add "symfony/dotenv" as a Composer dependency to load variables from a .env file.');
21 }
22 (new Dotenv())->load(__DIR__.'/../.env');
23}
24
25$input = new ArgvInput();
26$env = $input->getParameterOption(['--env', '-e'], $_SERVER['APP_ENV'] ?? 'dev', true);
27$debug = (bool) ($_SERVER['APP_DEBUG'] ?? ('prod' !== $env)) && !$input->hasParameterOption('--no-debug', true);
28
29if ($debug) {
30 umask(0000);
31
32 if (class_exists(Debug::class)) {
33 Debug::enable();
34 }
35}
36
37$kernel = new Kernel($env, $debug);
38$application = new Application($kernel);
39$application->run($input);