Passed
Push — main ( e4bb4c...5c25a7 )
by Michiel
06:10
created

config/bootstrap.php (3 issues)

1
<?php
2
0 ignored issues
show
Missing file doc comment
Loading history...
3
use Symfony\Component\Yaml\Yaml;
4
5
require dirname(__DIR__).'/vendor/autoload.php';
6
7
$parametersPath = dirname(__DIR__).'/config/openconext/parameters.yaml';
8
$parameters = Yaml::parseFile($parametersPath);
9
$parameters = $parameters['parameters'];
10
$requiredParameters = ['app_env', 'app_debug', 'app_secret'];
11
12
// Test if required parameters are set
13
if (0 !== count(array_diff($requiredParameters, array_keys($parameters)))) {
14
    throw new RuntimeException(sprintf(
0 ignored issues
show
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
15
        'Required parameters are not configured, required params are: %s, configure them in %s',
16
        implode(', ', $requiredParameters),
17
        $parametersPath
18
    ));
0 ignored issues
show
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
19
}
20
21
$_SERVER['APP_ENV'] = $parameters['app_env'];
22
$_SERVER['APP_DEBUG'] = $parameters['app_debug'];
23
$_SERVER['APP_SECRET'] = $parameters['app_secret'];
24
25
// Allow the application environment (dev/test/prod) to change via the APP_ENV environment variable.
26
if (array_key_exists('APP_ENV', $_ENV)) {
27
    $_SERVER['APP_ENV'] = $_ENV['APP_ENV'];
28
}
29
30
filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';
31