@@ -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", |
@@ -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 | |
@@ -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\FormatterProviders; |
| 6 | 6 | |
@@ -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\FormatterProviders; |
| 6 | 6 | |
@@ -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\FormatterProviders; |
| 6 | 6 | |
@@ -32,14 +32,14 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | private function parseFormatters($content): void |
| 34 | 34 | { |
| 35 | - if(! is_array($content)) |
|
| 35 | + if( ! is_array($content)) |
|
| 36 | 36 | { |
| 37 | 37 | throw new \InvalidArgumentException('Syntax error in profile [formatters]'); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | foreach($content as $name => $rules) |
| 41 | 41 | { |
| 42 | - if(! is_array($rules)) |
|
| 42 | + if( ! is_array($rules)) |
|
| 43 | 43 | { |
| 44 | 44 | throw new \InvalidArgumentException('Syntax error in profile [formatters]'); |
| 45 | 45 | } |
@@ -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 | |
@@ -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 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | foreach(array_keys($this->attributes) as $name) |
| 69 | 69 | { |
| 70 | - if(! isset($values[$name])) |
|
| 70 | + if( ! isset($values[$name])) |
|
| 71 | 71 | { |
| 72 | 72 | continue; |
| 73 | 73 | } |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | return true; |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | - if(! $parameterValidators[$parameter]($value)) |
|
| 201 | + if( ! $parameterValidators[$parameter]($value)) |
|
| 202 | 202 | { |
| 203 | 203 | throw new \RuntimeException('Paramater %s format is invalid'); |
| 204 | 204 | } |
@@ -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 | |
@@ -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\Display; |
| 6 | 6 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $lines = array(); |
| 70 | 70 | $lines[] = $separatorRow; |
| 71 | 71 | |
| 72 | - if(! empty($this->headers)) |
|
| 72 | + if( ! empty($this->headers)) |
|
| 73 | 73 | { |
| 74 | 74 | $lines[] = $this->renderLine($this->headers); |
| 75 | 75 | $lines[] = $separatorRow; |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | return; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - if(! empty($this->headers)) |
|
| 95 | + if( ! empty($this->headers)) |
|
| 96 | 96 | { |
| 97 | 97 | array_unshift($this->headers, ''); |
| 98 | 98 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | $this->columnsSize = array_pad(array(), $this->nbColumns, -1); |
| 112 | 112 | |
| 113 | - if(! empty($this->headers)) |
|
| 113 | + if( ! empty($this->headers)) |
|
| 114 | 114 | { |
| 115 | 115 | $this->updateColumnsSize(array($this->headers)); |
| 116 | 116 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | foreach($this->rows as $row) |
| 126 | 126 | { |
| 127 | - if(is_array($row) ||$row instanceof \Countable) |
|
| 127 | + if(is_array($row) || $row instanceof \Countable) |
|
| 128 | 128 | { |
| 129 | 129 | $this->nbColumns = max($this->nbColumns, count($row)); |
| 130 | 130 | } |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | { |
| 138 | 138 | foreach($newValues as $row) |
| 139 | 139 | { |
| 140 | - if(! is_array($row)) |
|
| 140 | + if( ! is_array($row)) |
|
| 141 | 141 | { |
| 142 | 142 | throw new \InvalidArgumentException('Rows must be arrays'); |
| 143 | 143 | } |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | private function stripTags($value) |
| 189 | 189 | { |
| 190 | - return preg_replace ('/<[^>]*>/', '', $value); |
|
| 190 | + return preg_replace('/<[^>]*>/', '', $value); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | private function renderLine(array $row) |