@@ -26,11 +26,13 @@ discard block |
||
| 26 | 26 | { |
| 27 | 27 | if (is_array($options)) |
| 28 | 28 | { |
| 29 | - if (isset($options['cache_dir'])) |
|
| 30 | - $this->cache_dir = $options['cache_dir']; |
|
| 29 | + if (isset($options['cache_dir'])) { |
|
| 30 | + $this->cache_dir = $options['cache_dir']; |
|
| 31 | + } |
|
| 31 | 32 | |
| 32 | - if (isset($options['debug'])) |
|
| 33 | - $this->debug = $options['debug']; |
|
| 33 | + if (isset($options['debug'])) { |
|
| 34 | + $this->debug = $options['debug']; |
|
| 35 | + } |
|
| 34 | 36 | } |
| 35 | 37 | |
| 36 | 38 | $this->file = $file; |
@@ -55,8 +57,7 @@ discard block |
||
| 55 | 57 | ); |
| 56 | 58 | |
| 57 | 59 | $config = include $cache->getPath(); |
| 58 | - } |
|
| 59 | - else |
|
| 60 | + } else |
|
| 60 | 61 | { |
| 61 | 62 | $config = $this->loadConfig(); |
| 62 | 63 | } |
@@ -23,8 +23,9 @@ discard block |
||
| 23 | 23 | $data = $this->loadFile($path); |
| 24 | 24 | |
| 25 | 25 | // empty file |
| 26 | - if ($data === NULL) |
|
| 27 | - $data = array(); |
|
| 26 | + if ($data === NULL) { |
|
| 27 | + $data = array(); |
|
| 28 | + } |
|
| 28 | 29 | |
| 29 | 30 | // not an array |
| 30 | 31 | if (!is_array($data)) |
@@ -43,23 +44,26 @@ discard block |
||
| 43 | 44 | |
| 44 | 45 | protected function loadFile($file) |
| 45 | 46 | { |
| 46 | - if (!class_exists('Symfony\Component\Yaml\Parser')) |
|
| 47 | - throw new RuntimeException('Unable to load YAML config files as the Symfony Yaml Component is not installed.'); |
|
| 47 | + if (!class_exists('Symfony\Component\Yaml\Parser')) { |
|
| 48 | + throw new RuntimeException('Unable to load YAML config files as the Symfony Yaml Component is not installed.'); |
|
| 49 | + } |
|
| 48 | 50 | |
| 49 | - if (!stream_is_local($file)) |
|
| 50 | - throw new InvalidArgumentException(sprintf('This is not a local file "%s".', $file)); |
|
| 51 | + if (!stream_is_local($file)) { |
|
| 52 | + throw new InvalidArgumentException(sprintf('This is not a local file "%s".', $file)); |
|
| 53 | + } |
|
| 51 | 54 | |
| 52 | - if (!file_exists($file)) |
|
| 53 | - throw new InvalidArgumentException(sprintf('The service file "%s" is not valid.', $file)); |
|
| 55 | + if (!file_exists($file)) { |
|
| 56 | + throw new InvalidArgumentException(sprintf('The service file "%s" is not valid.', $file)); |
|
| 57 | + } |
|
| 54 | 58 | |
| 55 | - if ($this->yamlParser === NULL) |
|
| 56 | - $this->yamlParser = new YamlParser(); |
|
| 59 | + if ($this->yamlParser === NULL) { |
|
| 60 | + $this->yamlParser = new YamlParser(); |
|
| 61 | + } |
|
| 57 | 62 | |
| 58 | 63 | try |
| 59 | 64 | { |
| 60 | 65 | $data = $this->yamlParser->parse(file_get_contents($file)); |
| 61 | - } |
|
| 62 | - catch (ParseException $e) |
|
| 66 | + } catch (ParseException $e) |
|
| 63 | 67 | { |
| 64 | 68 | throw new InvalidArgumentException(sprintf('The file "%s" does not contain valid YAML.', $file), 0, $e); |
| 65 | 69 | } |
@@ -84,8 +88,9 @@ discard block |
||
| 84 | 88 | |
| 85 | 89 | foreach ($config->data['imports'] as $import) |
| 86 | 90 | { |
| 87 | - if (!is_array($import)) |
|
| 88 | - throw new InvalidArgumentException(sprintf('The values in the "imports" key should be arrays in %s. Check your YAML syntax.', $file)); |
|
| 91 | + if (!is_array($import)) { |
|
| 92 | + throw new InvalidArgumentException(sprintf('The values in the "imports" key should be arrays in %s. Check your YAML syntax.', $file)); |
|
| 93 | + } |
|
| 89 | 94 | |
| 90 | 95 | $this->setCurrentDir($defaultDirectory); |
| 91 | 96 | $sub_config = $this->import($import['resource'], null, isset($import['ignore_errors']) ? (bool) $import['ignore_errors'] : false, $file); |