@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public function getDefinedOptions() |
| 54 | 54 | { |
| 55 | - if (! $this->defined) { |
|
| 55 | + if ( ! $this->defined) { |
|
| 56 | 56 | return null; |
| 57 | 57 | } |
| 58 | 58 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | return $this->defined->getArrayCopy(); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - return (array)$this->defined; |
|
| 63 | + return (array) $this->defined; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function getDefaultOptions() |
| 74 | 74 | { |
| 75 | - if (! $this->defaults) { |
|
| 75 | + if ( ! $this->defaults) { |
|
| 76 | 76 | return null; |
| 77 | 77 | } |
| 78 | 78 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | return $this->defaults->getArrayCopy(); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - return (array)$this->defaults; |
|
| 83 | + return (array) $this->defaults; |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function getRequiredOptions() |
| 94 | 94 | { |
| 95 | - if (! $this->required) { |
|
| 95 | + if ( ! $this->required) { |
|
| 96 | 96 | return null; |
| 97 | 97 | } |
| 98 | 98 | |
@@ -100,6 +100,6 @@ discard block |
||
| 100 | 100 | return $this->required->getArrayCopy(); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - return (array)$this->required; |
|
| 103 | + return (array) $this->required; |
|
| 104 | 104 | } |
| 105 | 105 | } |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | $schema = $schema->getArrayCopy(); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - if (! is_array($schema)) { |
|
| 66 | + if ( ! is_array($schema)) { |
|
| 67 | 67 | throw new InvalidArgumentException( |
| 68 | 68 | sprintf( |
| 69 | 69 | _('Invalid schema source: %1$s'), |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | * |
| 33 | 33 | * @param string $uri URI of the resource to load. |
| 34 | 34 | * |
| 35 | - * @return array Data contained within the resource. |
|
| 35 | + * @return boolean Data contained within the resource. |
|
| 36 | 36 | */ |
| 37 | 37 | public static function canLoad($uri) |
| 38 | 38 | { |
@@ -86,7 +86,7 @@ |
||
| 86 | 86 | */ |
| 87 | 87 | protected function validateUri($uri) |
| 88 | 88 | { |
| 89 | - if (! is_readable($uri)) { |
|
| 89 | + if ( ! is_readable($uri)) { |
|
| 90 | 90 | throw new FailedToLoadConfigException( |
| 91 | 91 | sprintf( |
| 92 | 92 | _('The requested PHP config file "%1$s" does not exist or is not readable.'), |
@@ -88,7 +88,7 @@ |
||
| 88 | 88 | public static function getLoader($loaderClass) |
| 89 | 89 | { |
| 90 | 90 | try { |
| 91 | - if (! array_key_exists($loaderClass, static::$loaderInstances)) { |
|
| 91 | + if ( ! array_key_exists($loaderClass, static::$loaderInstances)) { |
|
| 92 | 92 | static::$loaderInstances[$loaderClass] = new $loaderClass; |
| 93 | 93 | } |
| 94 | 94 | |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $this->validator = $validator; |
| 84 | 84 | |
| 85 | 85 | // Make sure $config is either a string or array. |
| 86 | - if (! (is_string($config) || is_array($config))) { |
|
| 86 | + if ( ! (is_string($config) || is_array($config))) { |
|
| 87 | 87 | throw new InvalidConfigurationSourceException( |
| 88 | 88 | sprintf( |
| 89 | 89 | _('Invalid configuration source: %1$s'), |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | // Finally, validate the resulting config. |
| 116 | - if (! $this->isValid()) { |
|
| 116 | + if ( ! $this->isValid()) { |
|
| 117 | 117 | throw new InvalidConfigException( |
| 118 | 118 | sprintf( |
| 119 | 119 | _('ConfigInterface file is not valid: %1$s'), |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | protected function resolveOptions($config) |
| 154 | 154 | { |
| 155 | - if (! $this->schema) { |
|
| 155 | + if ( ! $this->schema) { |
|
| 156 | 156 | return $config; |
| 157 | 157 | } |
| 158 | 158 | |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | $defaults = $this->schema->getDefaultOptions(); |
| 194 | 194 | $required = $this->schema->getRequiredOptions(); |
| 195 | 195 | |
| 196 | - if (! $defined && ! $defaults && ! $required) { |
|
| 196 | + if ( ! $defined && ! $defaults && ! $required) { |
|
| 197 | 197 | return false; |
| 198 | 198 | } |
| 199 | 199 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | * |
| 134 | 134 | * @since 0.4.2 |
| 135 | 135 | * |
| 136 | - * @return ConfigInterface Configuration settings to use. |
|
| 136 | + * @return Config|null Configuration settings to use. |
|
| 137 | 137 | */ |
| 138 | 138 | protected function fetchDefaultConfig() |
| 139 | 139 | { |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | * |
| 152 | 152 | * @since 0.4.2 |
| 153 | 153 | * |
| 154 | - * @return ConfigInterface Configuration settings to use. |
|
| 154 | + * @return Config|null Configuration settings to use. |
|
| 155 | 155 | */ |
| 156 | 156 | protected function fetchConfig($configFile) |
| 157 | 157 | { |
@@ -139,7 +139,7 @@ |
||
| 139 | 139 | { |
| 140 | 140 | $configFile = method_exists($this, 'getDefaultConfigFile') |
| 141 | 141 | ? $this->getDefaultConfigFile() |
| 142 | - : __DIR__ . '/../config/defaults.php'; |
|
| 142 | + : __DIR__.'/../config/defaults.php'; |
|
| 143 | 143 | |
| 144 | 144 | return $this->fetchConfig($configFile); |
| 145 | 145 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @param string|array $_ List of files. |
| 45 | 45 | * |
| 46 | - * @return ConfigInterface Instance of a ConfigInterface implementation. |
|
| 46 | + * @return Config|null Instance of a ConfigInterface implementation. |
|
| 47 | 47 | */ |
| 48 | 48 | public static function createFromFile($_) |
| 49 | 49 | { |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * |
| 88 | 88 | * @param array $array Array with configuration values. |
| 89 | 89 | * |
| 90 | - * @return ConfigInterface Instance of a ConfigInterface implementation. |
|
| 90 | + * @return Config|null Instance of a ConfigInterface implementation. |
|
| 91 | 91 | */ |
| 92 | 92 | public static function createFromArray(array $array) |
| 93 | 93 | { |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * |
| 110 | 110 | * @param mixed $_ Array with configuration values. |
| 111 | 111 | * |
| 112 | - * @return ConfigInterface Instance of a ConfigInterface implementation. |
|
| 112 | + * @return Config|null Instance of a ConfigInterface implementation. |
|
| 113 | 113 | */ |
| 114 | 114 | public static function create($_) |
| 115 | 115 | { |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | * |
| 136 | 136 | * @param mixed $_ Array with configuration values. |
| 137 | 137 | * |
| 138 | - * @return ConfigInterface Instance of a ConfigInterface implementation. |
|
| 138 | + * @return Config|null Instance of a ConfigInterface implementation. |
|
| 139 | 139 | */ |
| 140 | 140 | public static function merge($_) |
| 141 | 141 | { |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | * |
| 163 | 163 | * @param string|array $_ List of files. |
| 164 | 164 | * |
| 165 | - * @return ConfigInterface Instance of a ConfigInterface implementation. |
|
| 165 | + * @return Config|null Instance of a ConfigInterface implementation. |
|
| 166 | 166 | */ |
| 167 | 167 | public static function mergeFromFiles($_) |
| 168 | 168 | { |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | * @since 0.4.4 |
| 232 | 232 | * |
| 233 | 233 | * @param string $identifier Identifier to look for in the cache. |
| 234 | - * @param mixed $fallback Fallback to use to fill the cache. If $fallback is a callable, it will be executed |
|
| 234 | + * @param \Closure $fallback Fallback to use to fill the cache. If $fallback is a callable, it will be executed |
|
| 235 | 235 | * with $identifier as an argument. |
| 236 | 236 | * |
| 237 | 237 | * @return mixed The latest content of the cache for the given identifier. |
@@ -57,12 +57,12 @@ discard block |
||
| 57 | 57 | try { |
| 58 | 58 | $file = array_pop($files); |
| 59 | 59 | |
| 60 | - if (! is_readable($file)) { |
|
| 60 | + if ( ! is_readable($file)) { |
|
| 61 | 61 | continue; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | $config = static::createFromArray( |
| 65 | - static::getFromCache($file, function ($file) { |
|
| 65 | + static::getFromCache($file, function($file) { |
|
| 66 | 66 | return Loader::load($file); |
| 67 | 67 | }) |
| 68 | 68 | ); |
@@ -177,11 +177,11 @@ discard block |
||
| 177 | 177 | try { |
| 178 | 178 | $file = array_pop($files); |
| 179 | 179 | |
| 180 | - if (! is_readable($file)) { |
|
| 180 | + if ( ! is_readable($file)) { |
|
| 181 | 181 | continue; |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - $new_data = static::getFromCache($file, function ($file) { |
|
| 184 | + $new_data = static::getFromCache($file, function($file) { |
|
| 185 | 185 | return Loader::load($file); |
| 186 | 186 | }); |
| 187 | 187 | |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | */ |
| 239 | 239 | protected static function getFromCache($identifier, $fallback) |
| 240 | 240 | { |
| 241 | - if (! array_key_exists($identifier, static::$configFilesCache)) { |
|
| 241 | + if ( ! array_key_exists($identifier, static::$configFilesCache)) { |
|
| 242 | 242 | static::$configFilesCache[$identifier] = is_callable($fallback) |
| 243 | 243 | ? $fallback($identifier) |
| 244 | 244 | : $fallback; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | parent::__construct($config, ArrayObject::ARRAY_AS_PROPS); |
| 52 | 52 | |
| 53 | 53 | if (null !== $delimiter) { |
| 54 | - $this->delimiter = (array)$delimiter; |
|
| 54 | + $this->delimiter = (array) $delimiter; |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $array = $this->getArrayCopy(); |
| 103 | 103 | while (count($keys) > 0) { |
| 104 | 104 | $key = array_pop($keys); |
| 105 | - if (! array_key_exists($key, $array)) { |
|
| 105 | + if ( ! array_key_exists($key, $array)) { |
|
| 106 | 106 | return false; |
| 107 | 107 | } |
| 108 | 108 | $array = $array[$key]; |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | public function getKeys() |
| 136 | 136 | { |
| 137 | - return array_keys((array)$this); |
|
| 137 | + return array_keys((array) $this); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | { |
| 172 | 172 | $keys = $this->getKeyArguments(func_get_args()); |
| 173 | 173 | |
| 174 | - if (! $this->hasKey($keys)) { |
|
| 174 | + if ( ! $this->hasKey($keys)) { |
|
| 175 | 175 | throw new KeyNotFoundException( |
| 176 | 176 | sprintf( |
| 177 | 177 | _('The configuration key %1$s does not exist.'), |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | // Replace all of the configured delimiters by the first one, so that we can then use explode(). |
| 234 | 234 | $normalizedString = str_replace($this->delimiter, $this->delimiter[0], $keyString); |
| 235 | 235 | |
| 236 | - return (array)explode($this->delimiter[0], $normalizedString); |
|
| 236 | + return (array) explode($this->delimiter[0], $normalizedString); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | /** |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | * |
| 33 | 33 | * @param string $uri URI of the resource to load. |
| 34 | 34 | * |
| 35 | - * @return array Data contained within the resource. |
|
| 35 | + * @return boolean Data contained within the resource. |
|
| 36 | 36 | */ |
| 37 | 37 | public static function canLoad($uri) |
| 38 | 38 | { |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $data = json_decode(file_get_contents($uri), true); |
| 59 | 59 | ob_end_clean(); |
| 60 | 60 | |
| 61 | - return (array)$data; |
|
| 61 | + return (array) $data; |
|
| 62 | 62 | } catch (Exception $exception) { |
| 63 | 63 | throw new FailedToLoadConfigException( |
| 64 | 64 | sprintf( |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | protected function validateUri($uri) |
| 86 | 86 | { |
| 87 | - if (! is_readable($uri)) { |
|
| 87 | + if ( ! is_readable($uri)) { |
|
| 88 | 88 | throw new FailedToLoadConfigException( |
| 89 | 89 | sprintf( |
| 90 | 90 | _('The requested JSON config file "%1$s" does not exist or is not readable.'), |