@@ -32,6 +32,11 @@ discard block |
||
32 | 32 | protected |
33 | 33 | $environment; |
34 | 34 | |
35 | + /** |
|
36 | + * @param string $name |
|
37 | + * @param string $description |
|
38 | + * @param string $outputTitle |
|
39 | + */ |
|
35 | 40 | public function __construct(Application $app, $name, $description, $outputTitle) |
36 | 41 | { |
37 | 42 | $this->name = $name; |
@@ -169,6 +174,9 @@ discard block |
||
169 | 174 | } |
170 | 175 | } |
171 | 176 | |
177 | + /** |
|
178 | + * @param string $optionName |
|
179 | + */ |
|
172 | 180 | private function parseOptionWithAssignments(InputInterface $input, $optionName) |
173 | 181 | { |
174 | 182 | $strings = $input->getOption($optionName); |
@@ -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\Command; |
6 | 6 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $sourcePath = $profile->getSourcePath(); |
108 | 108 | } |
109 | 109 | |
110 | - if(! is_array($sourcePath)) |
|
110 | + if( ! is_array($sourcePath)) |
|
111 | 111 | { |
112 | 112 | $sourcePath = [$sourcePath]; |
113 | 113 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | { |
174 | 174 | $strings = $input->getOption($optionName); |
175 | 175 | |
176 | - if(! is_array($strings)) |
|
176 | + if( ! is_array($strings)) |
|
177 | 177 | { |
178 | 178 | $strings = [$strings]; |
179 | 179 | } |
@@ -48,6 +48,9 @@ |
||
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
51 | + /** |
|
52 | + * @param string $environment |
|
53 | + */ |
|
51 | 54 | public function getAllValuesForEnvironment(?string $environment = null) |
52 | 55 | { |
53 | 56 | $result = array(); |
@@ -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\Configuration; |
6 | 6 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | public function setDefaultEnvironment(string $environment): void |
44 | 44 | { |
45 | - if(! empty($environment) && is_string($environment)) |
|
45 | + if( ! empty($environment) && is_string($environment)) |
|
46 | 46 | { |
47 | 47 | $this->defaultEnvironment = $environment; |
48 | 48 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | }, $value); |
92 | 92 | } |
93 | 93 | |
94 | - if(! is_string($value)) |
|
94 | + if( ! is_string($value)) |
|
95 | 95 | { |
96 | 96 | return $value; |
97 | 97 | } |
@@ -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\Configuration; |
6 | 6 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | public function enableIncludeSupport(): self |
53 | 53 | { |
54 | - if(! isset($this->parsers[self::INCLUDES])) |
|
54 | + if( ! isset($this->parsers[self::INCLUDES])) |
|
55 | 55 | { |
56 | 56 | $this->parsers[self::INCLUDES] = new IncludeParser(); |
57 | 57 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | public function enableExternalSupport(): self |
63 | 63 | { |
64 | - if(! isset($this->parsers[self::EXTERNALS])) |
|
64 | + if( ! isset($this->parsers[self::EXTERNALS])) |
|
65 | 65 | { |
66 | 66 | $this->parsers[self::EXTERNALS] = new ExternalParser(new Parser($this->fs)); |
67 | 67 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | public function enableGroupSupport(): self |
73 | 73 | { |
74 | - if(! isset($this->parsers[self::GROUPS])) |
|
74 | + if( ! isset($this->parsers[self::GROUPS])) |
|
75 | 75 | { |
76 | 76 | $this->parsers[self::GROUPS] = new GroupParser(); |
77 | 77 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | { |
105 | 105 | $files = [$masterFilePath]; |
106 | 106 | |
107 | - while(! empty($files)) |
|
107 | + while( ! empty($files)) |
|
108 | 108 | { |
109 | 109 | foreach($files as $file) |
110 | 110 | { |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | private function extractLines(string $filePath): array |
157 | 157 | { |
158 | - if(! $this->fs->has($filePath)) |
|
158 | + if( ! $this->fs->has($filePath)) |
|
159 | 159 | { |
160 | 160 | throw new \RuntimeException("$filePath does not exist"); |
161 | 161 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | |
206 | 206 | private function switchSectionParser(string $sectionName): void |
207 | 207 | { |
208 | - if(! isset($this->parsers[$sectionName])) |
|
208 | + if( ! isset($this->parsers[$sectionName])) |
|
209 | 209 | { |
210 | 210 | throw new \RuntimeException('Unknown section name ' . $sectionName); |
211 | 211 | } |
@@ -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\Configuration; |
6 | 6 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | public function getAllVariables(): array |
46 | 46 | { |
47 | - $variables = array_map(function($key){ |
|
47 | + $variables = array_map(function($key) { |
|
48 | 48 | return $this->extractVariableName($key); |
49 | 49 | }, array_keys($this->values)); |
50 | 50 |
@@ -44,7 +44,7 @@ |
||
44 | 44 | |
45 | 45 | public function getAllVariables(): array |
46 | 46 | { |
47 | - $variables = array_map(function($key){ |
|
47 | + $variables = array_map(function($key) { |
|
48 | 48 | return $this->extractVariableName($key); |
49 | 49 | }, array_keys($this->values)); |
50 | 50 |
@@ -39,7 +39,7 @@ |
||
39 | 39 | return $this->values[$key]['value']; |
40 | 40 | } |
41 | 41 | |
42 | - throw new \RuntimeException("Variable $variable does not exist"); |
|
42 | + throw new \RuntimeException("variable $variable does not exist"); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | public function getAllVariables(): array |
@@ -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\Configuration; |
6 | 6 | |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | $this->variables = $variables; |
28 | 28 | |
29 | 29 | $this->externalReader = null; |
30 | - if(! empty($externalVariables)) |
|
30 | + if( ! empty($externalVariables)) |
|
31 | 31 | { |
32 | 32 | $this->externalReader = new Reader($externalVariables, [], $groups); |
33 | 33 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | if(in_array($environment, $this->groupNames)) |
62 | 62 | { |
63 | - if(! isset($this->defaultEnvironmentsForGroups[$environment])) |
|
63 | + if( ! isset($this->defaultEnvironmentsForGroups[$environment])) |
|
64 | 64 | { |
65 | 65 | throw new \RuntimeException(sprintf( |
66 | 66 | 'Group can not be used as environment (try with group %s detected)', |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | private function accessVariable(string $variableName) |
105 | 105 | { |
106 | - if(! array_key_exists($variableName, $this->variables)) |
|
106 | + if( ! array_key_exists($variableName, $this->variables)) |
|
107 | 107 | { |
108 | 108 | throw new \RuntimeException(sprintf( |
109 | 109 | 'Unknown variable %s', |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | private function processExternal(string $variable, string $environment) |
132 | 132 | { |
133 | - if(! $this->externalReader instanceof Reader) |
|
133 | + if( ! $this->externalReader instanceof Reader) |
|
134 | 134 | { |
135 | 135 | throw new \RuntimeException(sprintf( |
136 | 136 | 'There is no external variables. %s can not be resolve for environment %s', |
@@ -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\Configuration\Parser; |
6 | 6 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | private function hasDuplicatedValues(array $values): bool |
112 | 112 | { |
113 | - $duplicatedValues = array_filter(array_count_values($values), function ($counter) { |
|
113 | + $duplicatedValues = array_filter(array_count_values($values), function($counter) { |
|
114 | 114 | return $counter !== 1; |
115 | 115 | }); |
116 | 116 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | $errors = array_intersect($allEnvironments, array_keys($this->groups)); |
158 | 158 | |
159 | - if(! empty($errors)) |
|
159 | + if( ! empty($errors)) |
|
160 | 160 | { |
161 | 161 | throw new \RuntimeException(sprintf( |
162 | 162 | 'Error : a group can not be part of another group (%s)', |
@@ -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\Configuration\Parser; |
6 | 6 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | private function checkFilenameIsValid(string $filename): void |
32 | 32 | { |
33 | - if(! preg_match('~.*\.conf$~', $filename)) |
|
33 | + if( ! preg_match('~.*\.conf$~', $filename)) |
|
34 | 34 | { |
35 | 35 | $this->triggerError("$filename is not a valid file name", 'Invalid dependency'); |
36 | 36 | } |
@@ -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(string $value): string |
189 | 189 | { |
190 | - return preg_replace ('/<[^>]*>/', '', $value); |
|
190 | + return preg_replace('/<[^>]*>/', '', $value); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | private function renderLine(array $row): string |
@@ -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 |