@@ -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 | } |
@@ -193,12 +193,12 @@ |
||
193 | 193 | $values = $this->readValueToInject($variable, $environment); |
194 | 194 | $formatter = $this->getFormatterForCurrentTargetFile(); |
195 | 195 | |
196 | - if(! is_array($values)) |
|
196 | + if( ! is_array($values)) |
|
197 | 197 | { |
198 | 198 | $values = array($values); |
199 | 199 | } |
200 | 200 | |
201 | - array_walk($values, function (& $value) use ($formatter) { |
|
201 | + array_walk($values, function(& $value) use ($formatter) { |
|
202 | 202 | $value = $formatter->format($value); |
203 | 203 | }); |
204 | 204 |
@@ -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 | { |
@@ -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'; |
@@ -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 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | |
43 | 43 | public function getAllVariables() |
44 | 44 | { |
45 | - $variables = array_map(function($key){ |
|
45 | + $variables = array_map(function($key) { |
|
46 | 46 | return $this->extractVariableName($key); |
47 | 47 | }, array_keys($this->values)); |
48 | 48 |
@@ -42,7 +42,7 @@ |
||
42 | 42 | |
43 | 43 | public function getAllVariables() |
44 | 44 | { |
45 | - $variables = array_map(function($key){ |
|
45 | + $variables = array_map(function($key) { |
|
46 | 46 | return $this->extractVariableName($key); |
47 | 47 | }, array_keys($this->values)); |
48 | 48 |
@@ -37,7 +37,7 @@ |
||
37 | 37 | return $this->values[$key]['value']; |
38 | 38 | } |
39 | 39 | |
40 | - throw new \RuntimeException("Variable $variable does not exist"); |
|
40 | + throw new \RuntimeException("variable $variable does not exist"); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | public function getAllVariables() |
@@ -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 | { |
@@ -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])) |
@@ -239,9 +239,9 @@ discard block |
||
239 | 239 | foreach($files as $file => $status) |
240 | 240 | { |
241 | 241 | $message = sprintf( |
242 | - 'External file %s was %s', |
|
243 | - $file, |
|
244 | - $status['found'] ? 'found' : 'not found' |
|
242 | + 'External file %s was %s', |
|
243 | + $file, |
|
244 | + $status['found'] ? 'found' : 'not found' |
|
245 | 245 | ); |
246 | 246 | |
247 | 247 | $this->warning($message); |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | |
296 | 296 | public function getDefaultEnvironmentsForGroups() |
297 | 297 | { |
298 | - $defaultEnvironments = array(); |
|
298 | + $defaultEnvironments = array(); |
|
299 | 299 | |
300 | 300 | if(isset($this->parsers[self::GROUPS])) |
301 | 301 | { |
@@ -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)', |