@@ -116,7 +116,7 @@ |
||
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | $this->output->writeln( |
| 119 | - $this->getLogo($this->output->isDecorated()) |
|
| 119 | + $this->getLogo($this->output->isDecorated()) |
|
| 120 | 120 | ); |
| 121 | 121 | } |
| 122 | 122 | |
@@ -130,7 +130,7 @@ |
||
| 130 | 130 | ...@@...@@.. |
| 131 | 131 | ...@@....@@. |
| 132 | 132 | |
| 133 | -ASCIIART; |
|
| 133 | +asciiart; |
|
| 134 | 134 | |
| 135 | 135 | $background = 'fg=magenta'; |
| 136 | 136 | $text = 'fg=white'; |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Karma; |
| 6 | 6 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | { |
| 147 | 147 | $processor->setSystemEnvironment($this->systemEnvironment); |
| 148 | 148 | |
| 149 | - $this->app['logger']->info(sprintf( |
|
| 149 | + $this->app['logger']->info(sprintf( |
|
| 150 | 150 | 'Hydrate <important>system</important> variables with <important>%s</important> values', |
| 151 | 151 | $this->systemEnvironment |
| 152 | 152 | )); |
@@ -197,9 +197,9 @@ discard block |
||
| 197 | 197 | foreach($overrides as $variable => $value) |
| 198 | 198 | { |
| 199 | 199 | $logger->info(sprintf( |
| 200 | - 'Override <important>%s</important> with value <important>%s</important>', |
|
| 201 | - $variable, |
|
| 202 | - $value |
|
| 200 | + 'Override <important>%s</important> with value <important>%s</important>', |
|
| 201 | + $variable, |
|
| 202 | + $value |
|
| 203 | 203 | )); |
| 204 | 204 | |
| 205 | 205 | $value = $this->parseList($value); |
@@ -216,9 +216,9 @@ discard block |
||
| 216 | 216 | foreach($data as $variable => $value) |
| 217 | 217 | { |
| 218 | 218 | $logger->info(sprintf( |
| 219 | - 'Set custom data <important>%s</important> with value <important>%s</important>', |
|
| 220 | - $variable, |
|
| 221 | - $value |
|
| 219 | + 'Set custom data <important>%s</important> with value <important>%s</important>', |
|
| 220 | + $variable, |
|
| 221 | + $value |
|
| 222 | 222 | )); |
| 223 | 223 | |
| 224 | 224 | $reader->setCustomData($variable, $this->filterValue($value)); |
@@ -32,6 +32,11 @@ discard block |
||
| 32 | 32 | protected |
| 33 | 33 | $environment; |
| 34 | 34 | |
| 35 | + /** |
|
| 36 | + * @param string $name |
|
| 37 | + * @param string $description |
|
| 38 | + * @param string $outputTitle |
|
| 39 | + */ |
|
| 35 | 40 | public function __construct(Application $app, $name, $description, $outputTitle) |
| 36 | 41 | { |
| 37 | 42 | $this->name = $name; |
@@ -169,6 +174,9 @@ discard block |
||
| 169 | 174 | } |
| 170 | 175 | } |
| 171 | 176 | |
| 177 | + /** |
|
| 178 | + * @param string $optionName |
|
| 179 | + */ |
|
| 172 | 180 | private function parseOptionWithAssignments(InputInterface $input, $optionName) |
| 173 | 181 | { |
| 174 | 182 | $strings = $input->getOption($optionName); |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Karma\Command; |
| 6 | 6 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $sourcePath = $profile->getSourcePath(); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - if(! is_array($sourcePath)) |
|
| 110 | + if( ! is_array($sourcePath)) |
|
| 111 | 111 | { |
| 112 | 112 | $sourcePath = [$sourcePath]; |
| 113 | 113 | } |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | { |
| 174 | 174 | $strings = $input->getOption($optionName); |
| 175 | 175 | |
| 176 | - if(! is_array($strings)) |
|
| 176 | + if( ! is_array($strings)) |
|
| 177 | 177 | { |
| 178 | 178 | $strings = [$strings]; |
| 179 | 179 | } |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | $table->enableFormattingTags() |
| 46 | 46 | ->setHeaders(array($environment1, $environment2)) |
| 47 | 47 | ->displayKeys() |
| 48 | - ->setValueRenderingFunction(function($value){ |
|
| 48 | + ->setValueRenderingFunction(function($value) { |
|
| 49 | 49 | return $this->formatValue($value); |
| 50 | 50 | }); |
| 51 | 51 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Karma\Command; |
| 6 | 6 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $table->enableFormattingTags() |
| 48 | 48 | ->setHeaders(array($environment1, $environment2)) |
| 49 | 49 | ->displayKeys() |
| 50 | - ->setValueRenderingFunction(function($value){ |
|
| 50 | + ->setValueRenderingFunction(function($value) { |
|
| 51 | 51 | return $this->formatValue($value); |
| 52 | 52 | }); |
| 53 | 53 | |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | foreach($values as $variable => $value) |
| 62 | 62 | { |
| 63 | 63 | $this->output->writeln(sprintf( |
| 64 | - '<fg=cyan>%s</fg=cyan> = %s', |
|
| 64 | + '<fg=cyan>%s</fg=cyan> = %s', |
|
| 65 | 65 | $variable, |
| 66 | 66 | $this->formatValue($value) |
| 67 | 67 | )); |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Karma\Command; |
| 6 | 6 | |
@@ -153,7 +153,7 @@ |
||
| 153 | 153 | if(! empty($errors)) |
| 154 | 154 | { |
| 155 | 155 | throw new \RuntimeException(sprintf( |
| 156 | - 'Error : a group can not be part of another group (%s)', |
|
| 156 | + 'Error : a group can not be part of another group (%s)', |
|
| 157 | 157 | implode(', ', $errors) |
| 158 | 158 | )); |
| 159 | 159 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Karma\Configuration\Parser; |
| 6 | 6 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | private function hasDuplicatedValues(array $values): bool |
| 112 | 112 | { |
| 113 | - $duplicatedValues = array_filter(array_count_values($values), function ($counter) { |
|
| 113 | + $duplicatedValues = array_filter(array_count_values($values), function($counter) { |
|
| 114 | 114 | return $counter !== 1; |
| 115 | 115 | }); |
| 116 | 116 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | $errors = array_intersect($allEnvironments, array_keys($this->groups)); |
| 158 | 158 | |
| 159 | - if(! empty($errors)) |
|
| 159 | + if( ! empty($errors)) |
|
| 160 | 160 | { |
| 161 | 161 | throw new \RuntimeException(sprintf( |
| 162 | 162 | 'Error : a group can not be part of another group (%s)', |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | if(! isset($this->defaultEnvironmentsForGroups[$environment])) |
| 62 | 62 | { |
| 63 | 63 | throw new \RuntimeException(sprintf( |
| 64 | - 'Group can not be used as environment (try with group %s detected)', |
|
| 64 | + 'Group can not be used as environment (try with group %s detected)', |
|
| 65 | 65 | $environment |
| 66 | 66 | )); |
| 67 | 67 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Karma\Configuration; |
| 6 | 6 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | $this->variables = $variables; |
| 28 | 28 | |
| 29 | 29 | $this->externalReader = null; |
| 30 | - if(! empty($externalVariables)) |
|
| 30 | + if( ! empty($externalVariables)) |
|
| 31 | 31 | { |
| 32 | 32 | $this->externalReader = new Reader($externalVariables, [], $groups); |
| 33 | 33 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | if(in_array($environment, $this->groupNames)) |
| 62 | 62 | { |
| 63 | - if(! isset($this->defaultEnvironmentsForGroups[$environment])) |
|
| 63 | + if( ! isset($this->defaultEnvironmentsForGroups[$environment])) |
|
| 64 | 64 | { |
| 65 | 65 | throw new \RuntimeException(sprintf( |
| 66 | 66 | 'Group can not be used as environment (try with group %s detected)', |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | private function accessVariable(string $variableName) |
| 105 | 105 | { |
| 106 | - if(! array_key_exists($variableName, $this->variables)) |
|
| 106 | + if( ! array_key_exists($variableName, $this->variables)) |
|
| 107 | 107 | { |
| 108 | 108 | throw new \RuntimeException(sprintf( |
| 109 | 109 | 'Unknown variable %s', |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | |
| 131 | 131 | private function processExternal(string $variable, string $environment) |
| 132 | 132 | { |
| 133 | - if(! $this->externalReader instanceof Reader) |
|
| 133 | + if( ! $this->externalReader instanceof Reader) |
|
| 134 | 134 | { |
| 135 | 135 | throw new \RuntimeException(sprintf( |
| 136 | 136 | 'There is no external variables. %s can not be resolve for environment %s', |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - throw new \RuntimeException("Key $key not found"); |
|
| 39 | + throw new \RuntimeException("key $key not found"); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | public function read($key) |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Karma\Filesystem\Adapters; |
| 6 | 6 | |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | if(stripos($variableName, self::DELIMITER) === false) |
| 28 | 28 | { |
| 29 | 29 | throw new \RuntimeException(sprintf( |
| 30 | - 'Variable %s does not contain delimiter (%s)', |
|
| 30 | + 'Variable %s does not contain delimiter (%s)', |
|
| 31 | 31 | $variableName, |
| 32 | 32 | self::DELIMITER |
| 33 | 33 | )); |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Karma\Generator\ConfigurationFileGenerators; |
| 6 | 6 | |
@@ -39,12 +39,12 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | foreach($parts as $part) |
| 41 | 41 | { |
| 42 | - if(! isset($current[$part])) |
|
| 42 | + if( ! isset($current[$part])) |
|
| 43 | 43 | { |
| 44 | 44 | $current[$part] = array(); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - $current= & $current[$part]; |
|
| 47 | + $current = & $current[$part]; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | $current = $value; |
@@ -266,8 +266,7 @@ |
||
| 266 | 266 | { |
| 267 | 267 | $formatter = $this->getFormatterForCurrentTargetFile(); |
| 268 | 268 | |
| 269 | - $content = preg_replace_callback(self::VARIABLE_REGEX, function(array $matches) use($environment, $formatter) |
|
| 270 | - { |
|
| 269 | + $content = preg_replace_callback(self::VARIABLE_REGEX, function(array $matches) use($environment, $formatter) { |
|
| 271 | 270 | $value = $this->readValueToInject($matches['variableName'], $environment); |
| 272 | 271 | |
| 273 | 272 | if(is_array($value)) |
@@ -118,7 +118,7 @@ |
||
| 118 | 118 | |
| 119 | 119 | $targetContent = $this->injectValues($file, $content, $environment, $replacementCounter); |
| 120 | 120 | |
| 121 | - $this->debug("Write $this->currentTargetFile"); |
|
| 121 | + $this->debug("write $this->currentTargetFile"); |
|
| 122 | 122 | |
| 123 | 123 | if($this->dryRun === false) |
| 124 | 124 | { |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | $this->info(sprintf( |
| 113 | - '%d files generated', |
|
| 113 | + '%d files generated', |
|
| 114 | 114 | count($files) |
| 115 | 115 | )); |
| 116 | 116 | } |
@@ -253,6 +253,10 @@ discard block |
||
| 253 | 253 | } |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | + /** |
|
| 257 | + * @param string $environment |
|
| 258 | + * @param string $delimiter |
|
| 259 | + */ |
|
| 256 | 260 | private function generateContentForListDirective($variable, $environment, $delimiter, array $wrapper) |
| 257 | 261 | { |
| 258 | 262 | $values = $this->readValueToInject($variable, $environment); |
@@ -276,11 +280,19 @@ discard block |
||
| 276 | 280 | ); |
| 277 | 281 | } |
| 278 | 282 | |
| 283 | + /** |
|
| 284 | + * @param string $fileContent |
|
| 285 | + */ |
|
| 279 | 286 | private function removeFileDirectives($fileContent) |
| 280 | 287 | { |
| 281 | 288 | return preg_replace('~(<%\s*karma:[^%]*%>\s*)~i', '', $fileContent); |
| 282 | 289 | } |
| 283 | 290 | |
| 291 | + /** |
|
| 292 | + * @param string $sourceFile |
|
| 293 | + * @param string $content |
|
| 294 | + * @param string $environment |
|
| 295 | + */ |
|
| 284 | 296 | private function injectValues($sourceFile, $content, $environment, $replacementCounter = 0) |
| 285 | 297 | { |
| 286 | 298 | $replacementCounter += $this->injectScalarValues($content, $environment); |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types = 1); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace Karma; |
| 6 | 6 | |
@@ -258,12 +258,12 @@ discard block |
||
| 258 | 258 | $values = $this->readValueToInject($variable, $environment); |
| 259 | 259 | $formatter = $this->getFormatterForCurrentTargetFile(); |
| 260 | 260 | |
| 261 | - if(! is_array($values)) |
|
| 261 | + if( ! is_array($values)) |
|
| 262 | 262 | { |
| 263 | 263 | $values = array($values); |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | - array_walk($values, function (& $value) use ($formatter) { |
|
| 266 | + array_walk($values, function(& $value) use ($formatter) { |
|
| 267 | 267 | $value = $formatter->format($value); |
| 268 | 268 | }); |
| 269 | 269 | |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | { |
| 373 | 373 | $values = $this->readValueToInject($matches['variableName'], $environment); |
| 374 | 374 | |
| 375 | - if(!is_array($values)) |
|
| 375 | + if( ! is_array($values)) |
|
| 376 | 376 | { |
| 377 | 377 | throw new \RuntimeException(sprintf( |
| 378 | 378 | "Nested variable detected [%s] while writing %s at line %d", |