@@ -127,6 +127,9 @@ discard block |
||
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
130 | + /** |
|
131 | + * @param string|boolean $fileContent |
|
132 | + */ |
|
130 | 133 | private function parseFileDirectives($file, & $fileContent, $environment) |
131 | 134 | { |
132 | 135 | $this->currentFormatterName = null; |
@@ -210,6 +213,9 @@ discard block |
||
210 | 213 | return preg_replace('~(<%\s*karma:[^%]*%>\s*)~i', '', $fileContent); |
211 | 214 | } |
212 | 215 | |
216 | + /** |
|
217 | + * @return string |
|
218 | + */ |
|
213 | 219 | private function injectValues($sourceFile, $content, $environment, $replacementCounter = 0) |
214 | 220 | { |
215 | 221 | $replacementCounter += $this->injectScalarValues($content, $environment); |
@@ -334,6 +340,9 @@ discard block |
||
334 | 340 | return "\n"; |
335 | 341 | } |
336 | 342 | |
343 | + /** |
|
344 | + * @param string $targetFile |
|
345 | + */ |
|
337 | 346 | private function backupFile($targetFile) |
338 | 347 | { |
339 | 348 | if($this->enableBackup === true) |
@@ -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)) |
@@ -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'; |
@@ -102,8 +102,8 @@ |
||
102 | 102 | private function printHeader() |
103 | 103 | { |
104 | 104 | $this->output->writeln(sprintf( |
105 | - '<comment>%s</comment>', |
|
106 | - $this->getLogo() |
|
105 | + '<comment>%s</comment>', |
|
106 | + $this->getLogo() |
|
107 | 107 | )); |
108 | 108 | } |
109 | 109 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | public function setDefaultEnvironment($environment) |
42 | 42 | { |
43 | - if(! empty($environment) && is_string($environment)) |
|
43 | + if( ! empty($environment) && is_string($environment)) |
|
44 | 44 | { |
45 | 45 | $this->defaultEnvironment = $environment; |
46 | 46 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | private function handleCustomData($value) |
90 | 90 | { |
91 | - if(! is_string($value)) |
|
91 | + if( ! is_string($value)) |
|
92 | 92 | { |
93 | 93 | return $value; |
94 | 94 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | { |
9 | 9 | if(is_array($value)) |
10 | 10 | { |
11 | - return array_map(function ($item) { |
|
11 | + return array_map(function($item) { |
|
12 | 12 | return $this->filterOneValue($item); |
13 | 13 | }, $value); |
14 | 14 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | private function filterOneValue($value) |
20 | 20 | { |
21 | - if(! is_string($value)) |
|
21 | + if( ! is_string($value)) |
|
22 | 22 | { |
23 | 23 | return $value; |
24 | 24 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | public function enableIncludeSupport() |
51 | 51 | { |
52 | - if(! isset($this->parsers[self::INCLUDES])) |
|
52 | + if( ! isset($this->parsers[self::INCLUDES])) |
|
53 | 53 | { |
54 | 54 | $this->parsers[self::INCLUDES] = new IncludeParser(); |
55 | 55 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | public function enableExternalSupport() |
61 | 61 | { |
62 | - if(! isset($this->parsers[self::EXTERNALS])) |
|
62 | + if( ! isset($this->parsers[self::EXTERNALS])) |
|
63 | 63 | { |
64 | 64 | $this->parsers[self::EXTERNALS] = new ExternalParser(new Parser($this->fs)); |
65 | 65 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | public function enableGroupSupport() |
71 | 71 | { |
72 | - if(! isset($this->parsers[self::GROUPS])) |
|
72 | + if( ! isset($this->parsers[self::GROUPS])) |
|
73 | 73 | { |
74 | 74 | $this->parsers[self::GROUPS] = new GroupParser(); |
75 | 75 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | { |
102 | 102 | $files = array($masterFilePath); |
103 | 103 | |
104 | - while(! empty($files)) |
|
104 | + while( ! empty($files)) |
|
105 | 105 | { |
106 | 106 | foreach($files as $file) |
107 | 107 | { |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | |
152 | 152 | private function extractLines($filePath) |
153 | 153 | { |
154 | - if(! $this->fs->has($filePath)) |
|
154 | + if( ! $this->fs->has($filePath)) |
|
155 | 155 | { |
156 | 156 | throw new \RuntimeException("$filePath does not exist"); |
157 | 157 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | |
202 | 202 | private function switchSectionParser($sectionName) |
203 | 203 | { |
204 | - if(! isset($this->parsers[$sectionName])) |
|
204 | + if( ! isset($this->parsers[$sectionName])) |
|
205 | 205 | { |
206 | 206 | throw new \RuntimeException('Unknown section name ' . $sectionName); |
207 | 207 | } |
@@ -77,6 +77,9 @@ discard block |
||
77 | 77 | return $this; |
78 | 78 | } |
79 | 79 | |
80 | + /** |
|
81 | + * @param string $masterFilePath |
|
82 | + */ |
|
80 | 83 | public function parse($masterFilePath) |
81 | 84 | { |
82 | 85 | try |
@@ -199,6 +202,9 @@ discard block |
||
199 | 202 | return $sectionName; |
200 | 203 | } |
201 | 204 | |
205 | + /** |
|
206 | + * @param string $sectionName |
|
207 | + */ |
|
202 | 208 | private function switchSectionParser($sectionName) |
203 | 209 | { |
204 | 210 | if(! isset($this->parsers[$sectionName])) |
@@ -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 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | |
105 | 105 | private function hasDuplicatedValues(array $values) |
106 | 106 | { |
107 | - $duplicatedValues = array_filter(array_count_values($values), function ($counter) { |
|
107 | + $duplicatedValues = array_filter(array_count_values($values), function($counter) { |
|
108 | 108 | return $counter !== 1; |
109 | 109 | }); |
110 | 110 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | |
151 | 151 | $errors = array_intersect($allEnvironments, array_keys($this->groups)); |
152 | 152 | |
153 | - if(! empty($errors)) |
|
153 | + if( ! empty($errors)) |
|
154 | 154 | { |
155 | 155 | throw new \RuntimeException(sprintf( |
156 | 156 | 'Error : a group can not be part of another group (%s)', |
@@ -49,7 +49,7 @@ |
||
49 | 49 | { |
50 | 50 | if($value === '<string>') |
51 | 51 | { |
52 | - $result = function ($value) use ($result) { |
|
52 | + $result = function($value) use ($result) { |
|
53 | 53 | return str_replace('<string>', $value, $result); |
54 | 54 | }; |
55 | 55 | } |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | private function writeLevel($level) |
51 | 51 | { |
52 | 52 | $message = str_pad(sprintf( |
53 | - '[%s]', |
|
54 | - strtoupper($level) |
|
53 | + '[%s]', |
|
54 | + strtoupper($level) |
|
55 | 55 | ), 10); |
56 | 56 | |
57 | 57 | $this->output->write($this->colorizeMessage($level, $message)); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | if(isset($colors[$level])) |
68 | 68 | { |
69 | 69 | $message = sprintf( |
70 | - '<%1$s>%2$s</%1$s>', |
|
70 | + '<%1$s>%2$s</%1$s>', |
|
71 | 71 | 'fg=' . $colors[$level], |
72 | 72 | $message |
73 | 73 | ); |
@@ -64,7 +64,7 @@ |
||
64 | 64 | $rootPath = ''; |
65 | 65 | } |
66 | 66 | |
67 | - if(! empty($rootPath)) |
|
67 | + if( ! empty($rootPath)) |
|
68 | 68 | { |
69 | 69 | $rootPath .= $directorySeparator; |
70 | 70 | } |