Completed
Pull Request — master (#91)
by Nicolas
04:25
created
src/Karma/Command/ConfigureActionCommand.php 3 patches
Doc Comments   +12 added lines patch added patch discarded remove patch
@@ -30,6 +30,11 @@  discard block
 block discarded – undo
30 30
     protected
31 31
         $environment;
32 32
 
33
+    /**
34
+     * @param string $name
35
+     * @param string $description
36
+     * @param string $outputTitle
37
+     */
33 38
     public function __construct(Application $app, $name, $description, $outputTitle)
34 39
     {
35 40
         $this->name = $name;
@@ -128,6 +133,10 @@  discard block
 block discarded – undo
128 133
     }
129 134
 
130 135
     abstract protected function launchConfigurationAction(ConfigurableProcessor $processor);
136
+
137
+    /**
138
+     * @return ConfigurableProcessor
139
+     */
131 140
     abstract protected function getProcessor();
132 141
 
133 142
     private function configureProcessor(ConfigurableProcessor $processor)
@@ -153,6 +162,9 @@  discard block
 block discarded – undo
153 162
         }
154 163
     }
155 164
 
165
+    /**
166
+     * @param string $optionName
167
+     */
156 168
     private function parseOptionWithAssignments(InputInterface $input, $optionName)
157 169
     {
158 170
         $strings = $input->getOption($optionName);
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
         {
147 147
             $processor->setSystemEnvironment($this->systemEnvironment);
148 148
 
149
-             $this->app['logger']->info(sprintf(
149
+                $this->app['logger']->info(sprintf(
150 150
                 'Hydrate <important>system</important> variables with <important>%s</important> values',
151 151
                 $this->systemEnvironment
152 152
             ));
@@ -197,9 +197,9 @@  discard block
 block discarded – undo
197 197
         foreach($overrides as $variable => $value)
198 198
         {
199 199
             $logger->info(sprintf(
200
-               'Override <important>%s</important> with value <important>%s</important>',
201
-               $variable,
202
-               $value
200
+                'Override <important>%s</important> with value <important>%s</important>',
201
+                $variable,
202
+                $value
203 203
             ));
204 204
 
205 205
             $value = $this->parseList($value);
@@ -216,9 +216,9 @@  discard block
 block discarded – undo
216 216
         foreach($data as $variable => $value)
217 217
         {
218 218
             $logger->info(sprintf(
219
-               'Set custom data <important>%s</important> with value <important>%s</important>',
220
-               $variable,
221
-               $value
219
+                'Set custom data <important>%s</important> with value <important>%s</important>',
220
+                $variable,
221
+                $value
222 222
             ));
223 223
 
224 224
             $reader->setCustomData($variable, $this->filterValue($value));
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
             $sourcePath = $profile->getSourcePath();
105 105
         }
106 106
 
107
-        if(! is_array($sourcePath))
107
+        if( ! is_array($sourcePath))
108 108
         {
109 109
             $sourcePath = array($sourcePath);
110 110
         }
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
     {
158 158
         $strings = $input->getOption($optionName);
159 159
 
160
-        if(! is_array($strings))
160
+        if( ! is_array($strings))
161 161
         {
162 162
             $strings = array($strings);
163 163
         }
Please login to merge, or discard this patch.
src/Karma/Configuration/Parser.php 4 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -199,6 +199,9 @@
 block discarded – undo
199 199
         return $sectionName;
200 200
     }
201 201
 
202
+    /**
203
+     * @param string $sectionName
204
+     */
202 205
     private function switchSectionParser($sectionName)
203 206
     {
204 207
         if(! isset($this->parsers[$sectionName]))
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
             if($status['found'] === false)
241 241
             {
242 242
                 $this->warning(sprintf(
243
-                   'External file %s was not found',
244
-                   $file
243
+                    'External file %s was not found',
244
+                    $file
245 245
                 ));
246 246
             }
247 247
         }
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 
295 295
     public function getDefaultEnvironmentsForGroups()
296 296
     {
297
-         $defaultEnvironments = array();
297
+            $defaultEnvironments = array();
298 298
 
299 299
         if(isset($this->parsers[self::GROUPS]))
300 300
         {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -178,7 +178,7 @@
 block discarded – undo
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
         {
Please login to merge, or discard this patch.
src/Karma/Configuration/ValueFilterIterator.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -14,6 +14,9 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/Karma/Hydrator.php 5 patches
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -127,6 +127,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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)
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -193,12 +193,12 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -266,8 +266,7 @@
 block discarded – undo
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))
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@
 block discarded – undo
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
         {
Please login to merge, or discard this patch.
src/Karma/Application.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
             
109 109
             $paths = $c['sources.path'];
110 110
             
111
-            if(! is_array($paths))
111
+            if( ! is_array($paths))
112 112
             {
113 113
                 $paths = array($paths);
114 114
             }
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
         $this['git'] = $git;
182 182
         $this['vcs'] = $git;
183 183
 
184
-        $this['vcsHandler'] = $this->protect(function (Vcs $vcs) {
184
+        $this['vcsHandler'] = $this->protect(function(Vcs $vcs) {
185 185
             $handler = new VcsHandler($vcs, $this['finder']);
186 186
 
187 187
             $handler->setLogger($this['logger'])
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
             return new \Psr\Log\NullLogger();
198 198
         });
199 199
 
200
-        $this['formatter.provider'] = $this->share(function ($c) {
200
+        $this['formatter.provider'] = $this->share(function($c) {
201 201
             return new ProfileProvider($c['profile']);
202 202
         });
203 203
 
@@ -210,19 +210,19 @@  discard block
 block discarded – undo
210 210
             return $hydrator;
211 211
         };
212 212
 
213
-        $this['generator.nameTranslator'] = $this->share(function ($c) {
213
+        $this['generator.nameTranslator'] = $this->share(function($c) {
214 214
             $translator = new FilePrefixTranslator();
215 215
             $translator->changeMasterFile($c['configuration.masterFile']);
216 216
 
217 217
             return $translator;
218 218
         });
219 219
 
220
-        $this['generator.variableProvider'] = function ($c) {
220
+        $this['generator.variableProvider'] = function($c) {
221 221
             $provider = new VariableProvider($c['parser'], $c['configuration.masterFile']);
222 222
 
223 223
             $profile = $c['profile'];
224 224
             $options = $profile->getGeneratorOptions();
225
-            if(! isset($options['translator']) || $options['translator'] === 'prefix')
225
+            if( ! isset($options['translator']) || $options['translator'] === 'prefix')
226 226
             {
227 227
                 $provider->setNameTranslator($c['generator.nameTranslator']);
228 228
             }
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
             return $provider;
231 231
         };
232 232
 
233
-        $this['configurationFilesGenerator'] = $this->share(function ($c) {
233
+        $this['configurationFilesGenerator'] = $this->share(function($c) {
234 234
             return new YamlGenerator($c['sources.fileSystem'], $c['configuration'], $c['generator.variableProvider']);
235 235
         });
236 236
     }
Please login to merge, or discard this patch.
src/Karma/Command.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@
 block discarded – undo
130 130
 ...@@...@@..
131 131
 ...@@....@@.
132 132
 
133
-ASCIIART;
133
+asciiart;
134 134
 
135 135
         $background = 'fg=magenta';
136 136
         $text = 'fg=white';
Please login to merge, or discard this patch.
src/Karma/Command/Diff.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
         $table->enableFormattingTags()
46 46
             ->setHeaders(array($environment1, $environment2))
47 47
             ->displayKeys()
48
-            ->setValueRenderingFunction(function($value){
48
+            ->setValueRenderingFunction(function($value) {
49 49
                 return $this->formatValue($value);
50 50
             });
51 51
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
         $table->enableFormattingTags()
46 46
             ->setHeaders(array($environment1, $environment2))
47 47
             ->displayKeys()
48
-            ->setValueRenderingFunction(function($value){
48
+            ->setValueRenderingFunction(function($value) {
49 49
                 return $this->formatValue($value);
50 50
             });
51 51
 
Please login to merge, or discard this patch.
src/Karma/Command/Display.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
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
             ));
Please login to merge, or discard this patch.
src/Karma/Command/Hydrate.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
     {
35 35
         $unusedVariables = $processor->getUnusedVariables();
36 36
 
37
-        if(! empty($unusedVariables))
37
+        if( ! empty($unusedVariables))
38 38
         {
39 39
             $logger = $this->app['logger'];
40 40
 
41
-            $logger->warning('You have unused variables : you should remove them or check if you have not mispelled them').
41
+            $logger->warning('You have unused variables : you should remove them or check if you have not mispelled them') .
42 42
             $logger->warning(sprintf(
43 43
                 'Unused variables : %s',
44 44
                 implode(', ', $unusedVariables)
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     {
51 51
         $unvaluedVariables = $processor->getUnvaluedVariables();
52 52
 
53
-        if(! empty($unvaluedVariables))
53
+        if( ! empty($unvaluedVariables))
54 54
         {
55 55
             $logger = $this->app['logger'];
56 56
 
Please login to merge, or discard this patch.