@@ -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 | } |
@@ -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 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $this->variables = $variables; |
26 | 26 | |
27 | 27 | $this->externalReader = null; |
28 | - if(! empty($externalVariables)) |
|
28 | + if( ! empty($externalVariables)) |
|
29 | 29 | { |
30 | 30 | $this->externalReader = new Reader($externalVariables, array(), $groups); |
31 | 31 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | if(in_array($environment, $this->groupNames)) |
60 | 60 | { |
61 | - if(! isset($this->defaultEnvironmentsForGroups[$environment])) |
|
61 | + if( ! isset($this->defaultEnvironmentsForGroups[$environment])) |
|
62 | 62 | { |
63 | 63 | throw new \RuntimeException(sprintf( |
64 | 64 | 'Group can not be used as environment (try with group %s detected)', |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | private function accessVariable($variableName) |
103 | 103 | { |
104 | - if(! array_key_exists($variableName, $this->variables)) |
|
104 | + if( ! array_key_exists($variableName, $this->variables)) |
|
105 | 105 | { |
106 | 106 | throw new \RuntimeException(sprintf( |
107 | 107 | 'Unknown variable %s', |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | private function processExternal($variable, $environment) |
130 | 130 | { |
131 | - if(! $this->externalReader instanceof Reader) |
|
131 | + if( ! $this->externalReader instanceof Reader) |
|
132 | 132 | { |
133 | 133 | throw new \RuntimeException(sprintf( |
134 | 134 | 'There is no external variables. %s can not be resolve for environment %s', |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $lines = array(); |
68 | 68 | $lines[] = $separatorRow; |
69 | 69 | |
70 | - if(! empty($this->headers)) |
|
70 | + if( ! empty($this->headers)) |
|
71 | 71 | { |
72 | 72 | $lines[] = $this->renderLine($this->headers); |
73 | 73 | $lines[] = $separatorRow; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | return; |
91 | 91 | } |
92 | 92 | |
93 | - if(! empty($this->headers)) |
|
93 | + if( ! empty($this->headers)) |
|
94 | 94 | { |
95 | 95 | array_unshift($this->headers, ''); |
96 | 96 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | $this->columnsSize = array_pad(array(), $this->nbColumns, -1); |
110 | 110 | |
111 | - if(! empty($this->headers)) |
|
111 | + if( ! empty($this->headers)) |
|
112 | 112 | { |
113 | 113 | $this->updateColumnsSize(array($this->headers)); |
114 | 114 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | { |
133 | 133 | foreach($newValues as $row) |
134 | 134 | { |
135 | - if(! is_array($row)) |
|
135 | + if( ! is_array($row)) |
|
136 | 136 | { |
137 | 137 | throw new \InvalidArgumentException('Rows must be arrays'); |
138 | 138 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | private function stripTags($value) |
184 | 184 | { |
185 | - return preg_replace ('/<[^>]*>/', '', $value); |
|
185 | + return preg_replace('/<[^>]*>/', '', $value); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | private function renderLine(array $row) |
@@ -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) |
@@ -29,14 +29,14 @@ |
||
29 | 29 | |
30 | 30 | private function parseFormatters($content) |
31 | 31 | { |
32 | - if(! is_array($content)) |
|
32 | + if( ! is_array($content)) |
|
33 | 33 | { |
34 | 34 | throw new \InvalidArgumentException('Syntax error in profile [formatters]'); |
35 | 35 | } |
36 | 36 | |
37 | 37 | foreach($content as $name => $rules) |
38 | 38 | { |
39 | - if(! is_array($rules)) |
|
39 | + if( ! is_array($rules)) |
|
40 | 40 | { |
41 | 41 | throw new \InvalidArgumentException('Syntax error in profile [formatters]'); |
42 | 42 | } |
@@ -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 | } |
@@ -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 | )); |
@@ -38,12 +38,12 @@ |
||
38 | 38 | |
39 | 39 | foreach($parts as $part) |
40 | 40 | { |
41 | - if(! isset($current[$part])) |
|
41 | + if( ! isset($current[$part])) |
|
42 | 42 | { |
43 | 43 | $current[$part] = array(); |
44 | 44 | } |
45 | 45 | |
46 | - $current= & $current[$part]; |
|
46 | + $current = & $current[$part]; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | $current = $value; |
@@ -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 | { |
@@ -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 | } |
@@ -158,6 +158,9 @@ discard block |
||
158 | 158 | $this->hydratedFiles[] = $this->currentTargetFile; |
159 | 159 | } |
160 | 160 | |
161 | + /** |
|
162 | + * @param string|boolean $fileContent |
|
163 | + */ |
|
161 | 164 | private function parseFileDirectives($file, & $fileContent, $environment) |
162 | 165 | { |
163 | 166 | $this->currentFormatterName = null; |
@@ -232,6 +235,9 @@ discard block |
||
232 | 235 | } |
233 | 236 | } |
234 | 237 | |
238 | + /** |
|
239 | + * @param string $delimiter |
|
240 | + */ |
|
235 | 241 | private function generateContentForListDirective($variable, $environment, $delimiter, array $wrapper) |
236 | 242 | { |
237 | 243 | $values = $this->readValueToInject($variable, $environment); |
@@ -260,6 +266,9 @@ discard block |
||
260 | 266 | return preg_replace('~(<%\s*karma:[^%]*%>\s*)~i', '', $fileContent); |
261 | 267 | } |
262 | 268 | |
269 | + /** |
|
270 | + * @return string |
|
271 | + */ |
|
263 | 272 | private function injectValues($sourceFile, $content, $environment, $replacementCounter = 0) |
264 | 273 | { |
265 | 274 | $replacementCounter += $this->injectScalarValues($content, $environment); |
@@ -42,7 +42,7 @@ |
||
42 | 42 | { |
43 | 43 | if($verbosity <= $this->output->getVerbosity()) |
44 | 44 | { |
45 | - if(! is_array($messages)) |
|
45 | + if( ! is_array($messages)) |
|
46 | 46 | { |
47 | 47 | $messages = array($messages); |
48 | 48 | } |