@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | private function resolve($id): object |
| 93 | 93 | { |
| 94 | - if (! is_string($id)) { |
|
| 94 | + if (!is_string($id)) { |
|
| 95 | 95 | throw new ContainerException("Identifier is not a string."); |
| 96 | 96 | } |
| 97 | 97 | if (Validator::key($id)->validate($this->instances)) { |
@@ -117,13 +117,13 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | private function autoResolve(string $class): object |
| 119 | 119 | { |
| 120 | - if (! class_exists($class)) { |
|
| 120 | + if (!class_exists($class)) { |
|
| 121 | 121 | throw new ContainerException(sprintf("Class %s does not exists.", $class)); |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | $reflection = new \ReflectionClass($class); |
| 125 | 125 | |
| 126 | - if (! $reflection->isInstantiable()) { |
|
| 126 | + if (!$reflection->isInstantiable()) { |
|
| 127 | 127 | throw new ContainerException(sprintf("Class %s is not instantiable.", $class)); |
| 128 | 128 | } |
| 129 | 129 | if (($constructor = $reflection->getConstructor()) === null) { |
@@ -50,12 +50,12 @@ |
||
| 50 | 50 | { |
| 51 | 51 | $configPath = $input->getArgument('config-path'); |
| 52 | 52 | |
| 53 | - if (! file_exists($configPath)) { |
|
| 53 | + if (!file_exists($configPath)) { |
|
| 54 | 54 | throw new InvalidConfigException(sprintf('Config file "%s" does not exists.', $configPath)); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | $extension = pathinfo($configPath, PATHINFO_EXTENSION); |
| 58 | - if (! Validator::key($extension)->validate(static::CONSOLE_CONFIG_FACTORIES)) { |
|
| 58 | + if (!Validator::key($extension)->validate(static::CONSOLE_CONFIG_FACTORIES)) { |
|
| 59 | 59 | throw new InvalidConfigException( |
| 60 | 60 | sprintf('Config file "%s" must have .yml, .json or .php extension.', $configPath) |
| 61 | 61 | ); |
@@ -105,7 +105,7 @@ |
||
| 105 | 105 | $sourceDirectory, |
| 106 | 106 | $exception->getMessage() |
| 107 | 107 | )); |
| 108 | - if (! $config->hasIgnore()) { |
|
| 108 | + if (!$config->hasIgnore()) { |
|
| 109 | 109 | return false; |
| 110 | 110 | } |
| 111 | 111 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | public function invoke(string $configPath): ConsoleConfigInterface |
| 22 | 22 | { |
| 23 | 23 | $configArray = require $configPath; |
| 24 | - if (! is_array($configArray)) { |
|
| 24 | + if (!is_array($configArray)) { |
|
| 25 | 25 | throw new InvalidConfigException('Unable to parse PHP config'); |
| 26 | 26 | } |
| 27 | 27 | |
@@ -38,13 +38,13 @@ discard block |
||
| 38 | 38 | private function validateBooleans($config):void |
| 39 | 39 | { |
| 40 | 40 | // Check boolean parameters |
| 41 | - if (! Validator::key('overwrite', Validator::boolType())->validate($config)) { |
|
| 41 | + if (!Validator::key('overwrite', Validator::boolType())->validate($config)) { |
|
| 42 | 42 | throw new InvalidConfigException('"overwrite" parameter must be set as a boolean.'); |
| 43 | 43 | } |
| 44 | - if (! Validator::key('auto', Validator::boolType())->validate($config)) { |
|
| 44 | + if (!Validator::key('auto', Validator::boolType())->validate($config)) { |
|
| 45 | 45 | throw new InvalidConfigException('"auto" parameter must be set as a boolean.'); |
| 46 | 46 | } |
| 47 | - if (! Validator::key('ignore', Validator::boolType())->validate($config)) { |
|
| 47 | + if (!Validator::key('ignore', Validator::boolType())->validate($config)) { |
|
| 48 | 48 | throw new InvalidConfigException('"ignore" parameter must be set as a boolean.'); |
| 49 | 49 | } |
| 50 | 50 | } |
@@ -59,10 +59,10 @@ discard block |
||
| 59 | 59 | private function validateStrings($config): void |
| 60 | 60 | { |
| 61 | 61 | // Check string parameters |
| 62 | - if (! Validator::key('include', Validator::stringType())->validate($config)) { |
|
| 62 | + if (!Validator::key('include', Validator::stringType())->validate($config)) { |
|
| 63 | 63 | throw new InvalidConfigException('"include" parameter must be set as a string.'); |
| 64 | 64 | } |
| 65 | - if (! Validator::key('exclude', Validator::stringType())->validate($config)) { |
|
| 65 | + if (!Validator::key('exclude', Validator::stringType())->validate($config)) { |
|
| 66 | 66 | throw new InvalidConfigException('"exclude" parameter must be set as a string.'); |
| 67 | 67 | } |
| 68 | 68 | } |
@@ -77,11 +77,11 @@ discard block |
||
| 77 | 77 | private function validateDirs($config): void |
| 78 | 78 | { |
| 79 | 79 | // Check that dirs exists |
| 80 | - if (! Validator::key('dirs', Validator::arrayType()->length(1, null))->validate($config)) { |
|
| 80 | + if (!Validator::key('dirs', Validator::arrayType()->length(1, null))->validate($config)) { |
|
| 81 | 81 | throw new InvalidConfigException('"dirs" parameter is not an array or does not contains elements.'); |
| 82 | 82 | } |
| 83 | 83 | // Validate each dirs |
| 84 | - if (! Validator::arrayVal() |
|
| 84 | + if (!Validator::arrayVal() |
|
| 85 | 85 | ->each(Validator::stringType(), Validator::stringType())->validate($config['dirs']) |
| 86 | 86 | ) { |
| 87 | 87 | throw new InvalidConfigException('Some directories in "dirs" parameter are not strings.'); |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | public function addDirectory(string $sourceDirectory, string $targetDirectory): void |
| 135 | 135 | { |
| 136 | - if (! Validator::arrayType()->validate($this->config['dirs'])) { |
|
| 136 | + if (!Validator::arrayType()->validate($this->config['dirs'])) { |
|
| 137 | 137 | $this->config['dirs'] = []; |
| 138 | 138 | } |
| 139 | 139 | $this->config['dirs'][$sourceDirectory] = $targetDirectory; |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | public function invoke(string $configPath): ConsoleConfigInterface |
| 22 | 22 | { |
| 23 | 23 | $configArray = json_decode(file_get_contents($configPath), true); |
| 24 | - if (! is_array($configArray)) { |
|
| 24 | + if (!is_array($configArray)) { |
|
| 25 | 25 | throw new InvalidConfigException('Unable to parse JSON config'); |
| 26 | 26 | } |
| 27 | 27 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function parse(string $sourceDirectory, string $targetDirectory): DirectoryModelInterface |
| 71 | 71 | { |
| 72 | - if (! $this->fileSystem->has($sourceDirectory) || ! $this->fileSystem->getMimetype($sourceDirectory) === 'directory') { |
|
| 72 | + if (!$this->fileSystem->has($sourceDirectory) || !$this->fileSystem->getMimetype($sourceDirectory) === 'directory') { |
|
| 73 | 73 | throw new ParsingException(sprintf('The source directory "%s" does not exist.', $sourceDirectory)); |
| 74 | 74 | } |
| 75 | 75 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $this->output->writeln(sprintf('<comment>Parsing file "%s" completed.</comment>', $file['path'])); |
| 108 | 108 | } |
| 109 | 109 | } catch (ParsingException $exception) { |
| 110 | - if (! $this->config->hasIgnore()) { |
|
| 110 | + if (!$this->config->hasIgnore()) { |
|
| 111 | 111 | throw new ParsingException($exception->getMessage()); |
| 112 | 112 | } |
| 113 | 113 | $this->output->writeln(sprintf('<error>%s</error>', $exception->getMessage())); |