1 | <?php |
||
2 | |||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
3 | use Symfony\Component\Dotenv\Dotenv; |
||
0 ignored issues
–
show
The type
Symfony\Component\Dotenv\Dotenv was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
4 | |||
5 | require dirname(__DIR__).'/vendor/autoload.php'; |
||
6 | |||
7 | // Load cached env vars if the .env.local.php file exists |
||
8 | // Run "composer dump-env prod" to create it (requires symfony/flex >=1.2) |
||
9 | if (is_array($env = @include dirname(__DIR__).'/.env.local.php') && ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env['APP_ENV']) === $env['APP_ENV']) { |
||
10 | foreach ($env as $k => $v) { |
||
11 | $_ENV[$k] = $_ENV[$k] ?? (isset($_SERVER[$k]) && 0 !== strpos($k, 'HTTP_') ? $_SERVER[$k] : $v); |
||
12 | } |
||
13 | } elseif (!class_exists(Dotenv::class)) { |
||
14 | throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.'); |
||
15 | } else { |
||
16 | // load all the .env files |
||
17 | (new Dotenv(false))->loadEnv(dirname(__DIR__).'/.env'); |
||
18 | } |
||
19 | |||
20 | $_SERVER += $_ENV; |
||
21 | $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev'; |
||
22 | $_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV']; |
||
23 | $_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0'; |
||
24 |