@@ -14,6 +14,9 @@ |
||
14 | 14 | $isRegex, |
15 | 15 | $filter; |
16 | 16 | |
17 | + /** |
|
18 | + * @param string $filter |
|
19 | + */ |
|
17 | 20 | public function __construct($filter, \Iterator $iterator) |
18 | 21 | { |
19 | 22 | parent::__construct($iterator); |
@@ -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) |
@@ -99,7 +99,7 @@ |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | $this->info(sprintf( |
102 | - '%d files generated', |
|
102 | + '%d files generated', |
|
103 | 103 | count($distFiles) |
104 | 104 | )); |
105 | 105 | } |
@@ -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)) |
@@ -92,7 +92,7 @@ |
||
92 | 92 | $targetContent = $this->injectValues($file, $content, $environment); |
93 | 93 | |
94 | 94 | $targetFile = substr($file, 0, strlen($this->suffix) * -1); |
95 | - $this->debug("Write $targetFile"); |
|
95 | + $this->debug("write $targetFile"); |
|
96 | 96 | |
97 | 97 | if($this->dryRun === false) |
98 | 98 | { |
@@ -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 |
@@ -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 | )); |
@@ -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 | } |
@@ -178,7 +178,7 @@ |
||
178 | 178 | |
179 | 179 | private function changeCurrentFile($filePath) |
180 | 180 | { |
181 | - $this->info("Reading $filePath"); |
|
181 | + $this->info("reading $filePath"); |
|
182 | 182 | |
183 | 183 | foreach($this->parsers as $parser) |
184 | 184 | { |
@@ -221,9 +221,9 @@ |
||
221 | 221 | foreach($files as $file => $status) |
222 | 222 | { |
223 | 223 | $message = sprintf( |
224 | - 'External file %s was %s', |
|
225 | - $file, |
|
226 | - $status['found'] ? 'found' : '<options=bold>not found</options=bold>' |
|
224 | + 'External file %s was %s', |
|
225 | + $file, |
|
226 | + $status['found'] ? 'found' : '<options=bold>not found</options=bold>' |
|
227 | 227 | ); |
228 | 228 | |
229 | 229 | $this->warning($message); |
@@ -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)', |
@@ -26,7 +26,7 @@ |
||
26 | 26 | |
27 | 27 | private function checkFilenameIsValid($filename) |
28 | 28 | { |
29 | - if(! preg_match('~.*\.conf$~', $filename)) |
|
29 | + if( ! preg_match('~.*\.conf$~', $filename)) |
|
30 | 30 | { |
31 | 31 | $this->triggerError("$filename is not a valid file name", 'Invalid dependency'); |
32 | 32 | } |