| Conditions | 5 |
| Paths | 11 |
| Total Lines | 46 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | public static function build() |
||
| 13 | { |
||
| 14 | // Build application settings |
||
| 15 | |||
| 16 | // Load settings from files |
||
| 17 | try { |
||
| 18 | // Directories list where config files located |
||
| 19 | $directories = array( |
||
| 20 | CONFIG_PATH, |
||
| 21 | ); |
||
| 22 | |||
| 23 | // Locator to find files |
||
| 24 | $locator = new FileLocator($directories); |
||
| 25 | |||
| 26 | // Load config file into an array |
||
| 27 | $loader = new PHPConfigLoader($locator); |
||
| 28 | |||
| 29 | // Import all config sections |
||
| 30 | $settings = $loader->importAll(); |
||
| 31 | |||
| 32 | } catch (Exception $ex) { |
||
| 33 | die($ex->getMessage()); |
||
| 34 | } |
||
| 35 | |||
| 36 | // Load settings from ENV vars |
||
| 37 | $settings['params']['env'] = @getenv('APPLICATION_ENV'); |
||
| 38 | $settings['accessToken']['secret_key'] = php_sapi_name() == 'cli-server' ? 'test-key' : @getenv('SECRET_KEY'); |
||
| 39 | $settings['accessToken']['iss'] = @getenv('AUTH_ISS'); |
||
| 40 | |||
| 41 | // Adjust error reporting |
||
| 42 | if (@stripos($settings['params']['env'], 'dev') !== false) { |
||
| 43 | $settings['displayErrorDetails'] = true; |
||
| 44 | } |
||
| 45 | |||
| 46 | if ($settings['displayErrorDetails']) { |
||
| 47 | error_reporting(E_ALL); |
||
| 48 | } |
||
| 49 | |||
| 50 | // Adjust settings as Slim wants to have it - inside ['settings'] section |
||
| 51 | $settings = [ |
||
| 52 | 'settings' => $settings |
||
| 53 | ]; |
||
| 54 | |||
| 55 | // Settings are ready |
||
| 56 | return $settings; |
||
| 57 | } |
||
| 58 | } |
||
| 59 |
This check compares the return type specified in the
@returnannotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.