Completed
Push — master ( d4d654...40e20e )
by Vladimir
04:35
created
src/Command/CheckInfoCommand.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         $this
45 45
             ->setName('tvi:monitor:check:info')
46 46
             ->setDescription('Info Health Checkers')
47
-            ->addOption('group', 'g',InputOption::VALUE_OPTIONAL, 'Check group')
47
+            ->addOption('group', 'g', InputOption::VALUE_OPTIONAL, 'Check group')
48 48
         ;
49 49
     }
50 50
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         $checkMetadatas = $this->manager->getCheckMetadatas($group);
79 79
 
80 80
         if (0 === count($checkMetadatas)) {
81
-            if(empty($group)) {
81
+            if (empty($group)) {
82 82
                 $output->writeln(sprintf('<error>No checks configured.</error>'));
83 83
             } else {
84 84
                 $output->writeln(sprintf('<error>No checks configured for group %s.</error>', $group));
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         foreach ($checkMetadatas as $checkMetadata) {
90 90
 
91 91
             $currentGroup = $checkMetadata->getGroup();
92
-            if(empty($group) && $showGroup != $currentGroup) {
92
+            if (empty($group) && $showGroup != $currentGroup) {
93 93
                 $output->writeln(sprintf('<fg=yellow;options=bold>%s</>', $currentGroup));
94 94
                 $showGroup = $currentGroup;
95 95
             }
Please login to merge, or discard this patch.
src/Command/CheckGeneratorCommand.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
             ->setName('tvi:monitor:generator:check')
55 55
             ->setDescription('Generates check plugin from tvi monitor template')
56 56
             ->addArgument('checker', InputArgument::REQUIRED, 'Check name')
57
-            ->addOption('group', 'g',InputOption::VALUE_OPTIONAL, 'Check group')
58
-            ->addOption('integration-test-src', null,InputOption::VALUE_OPTIONAL, 'Path to integration tests src', null)
57
+            ->addOption('group', 'g', InputOption::VALUE_OPTIONAL, 'Check group')
58
+            ->addOption('integration-test-src', null, InputOption::VALUE_OPTIONAL, 'Path to integration tests src', null)
59 59
             ->addOption('no-backup', 'b', InputOption::VALUE_NONE, 'Do not backup existing check files.')
60 60
             ->setHelp(<<<EOT
61 61
 The <info>%command.name%</info> command generates check classes
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         @list($bundleName, $checkPath) = (count($r) == 1) ? [null, current($r)] : $r;
108 108
 
109 109
         /* @var $bundle Bundle */
110
-        if(!$bundleName) {
110
+        if (!$bundleName) {
111 111
             $defaultBundle = 'TviMonitorBundle';
112 112
             $bundle = $this->getApplication()->getKernel()->getBundle($defaultBundle);
113 113
             $output->writeln(sprintf('<info>Use default bundle <comment>%s</comment></info>', $bundle->getNamespace()));
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         }
122 122
 
123 123
         preg_match('#^(.*?)(\w+)$#', $checkPath, $m);
124
-        list($checkNamespace, $checkName) =  [$m[1], $m[2]];
124
+        list($checkNamespace, $checkName) = [$m[1], $m[2]];
125 125
 
126 126
         $checkNamespace = preg_replace('#\\\$#', '', $checkNamespace);
127 127
         $bundleNamespace = $bundle->getNamespace();
@@ -145,14 +145,14 @@  discard block
 block discarded – undo
145 145
 
146 146
         //CHECK_GROUP
147 147
         $group = $input->getOption('group');
148
-        $CHECK_GROUP = $group ? $group: $CHECK_ALIAS;
148
+        $CHECK_GROUP = $group ? $group : $CHECK_ALIAS;
149 149
 
150 150
         $checkPath = sprintf('%s%s%s', $bundle->getPath(), DIRECTORY_SEPARATOR, $checkPath);
151 151
         $checkPath = str_replace('\\', DIRECTORY_SEPARATOR, $checkPath);
152 152
 
153
-        if(is_dir($checkPath)) {
153
+        if (is_dir($checkPath)) {
154 154
 
155
-            if($noBackup && is_dir($checkPath)) {
155
+            if ($noBackup && is_dir($checkPath)) {
156 156
                 $output->writeln(sprintf('<info><error>Check %s exist</error>. Use --no-backup flag to rewrite</info>', $NAMESPACE));
157 157
                 exit(1);
158 158
             } else {
@@ -164,17 +164,17 @@  discard block
 block discarded – undo
164 164
 
165 165
         foreach ($this->tpls as $f) {
166 166
 
167
-            if(in_array($f->getBasename(), ['config.example.yml.twig', 'README.mdpp.twig'])) {
167
+            if (in_array($f->getBasename(), ['config.example.yml.twig', 'README.mdpp.twig'])) {
168 168
                 continue;
169 169
             }
170 170
 
171 171
             /* @var SplFileInfo $f */
172 172
             $fName = $f->getBasename('.twig');
173 173
 
174
-            if($fName == 'Test.php.integration') {
174
+            if ($fName == 'Test.php.integration') {
175 175
 
176 176
                 $testPath = $input->getOption('integration-test-src');
177
-                if(!$testPath) {
177
+                if (!$testPath) {
178 178
                     continue;
179 179
                 } else {
180 180
                     $fName = $f->getBasename('.integration.twig');
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
                         );
195 195
                     $fPath = preg_replace('#\\\+#', '/', $fPath);
196 196
 
197
-                    if(is_dir($fPath)) {
198
-                        if($noBackup && is_dir($fPath)) {
197
+                    if (is_dir($fPath)) {
198
+                        if ($noBackup && is_dir($fPath)) {
199 199
                             $output->writeln(sprintf('<info>Tests for <error>check %s exist</error>. Use --no-backup flag to rewrite</info>', $NAMESPACE));
200 200
                             continue;
201 201
                         } else {
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
                         @mkdir($fPath, 0775, true) && !is_dir($fPath);
206 206
                     }
207 207
                 }
208
-                $TEST_NAMESPACE = sprintf('%s\%s\%s\%s', $bundleNamespace,'Test', $checkNamespace, $checkName);
208
+                $TEST_NAMESPACE = sprintf('%s\%s\%s\%s', $bundleNamespace, 'Test', $checkNamespace, $checkName);
209 209
 
210 210
                 $tplData = [
211 211
                     'NAMESPACE'      => $TEST_NAMESPACE,
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 
221 221
                 file_put_contents($path, $res);
222 222
 
223
-                $this->createFile($fPath,'config.example.yml.twig','config.yml', $tplData);
223
+                $this->createFile($fPath, 'config.example.yml.twig', 'config.yml', $tplData);
224 224
 
225 225
             } else {
226 226
                 $path = sprintf('%s%s%s', $checkPath, DIRECTORY_SEPARATOR, $fName);
@@ -236,8 +236,8 @@  discard block
 block discarded – undo
236 236
 
237 237
                 file_put_contents($path, $res);
238 238
 
239
-                $this->createFile($checkPath,'config.example.yml.twig','config.example.yml', $tplData);
240
-                $this->createFile($checkPath,'README.mdpp.twig','README.mdpp', $tplData);
239
+                $this->createFile($checkPath, 'config.example.yml.twig', 'config.example.yml', $tplData);
240
+                $this->createFile($checkPath, 'README.mdpp.twig', 'README.mdpp', $tplData);
241 241
             }
242 242
         }
243 243
     }
@@ -254,13 +254,13 @@  discard block
 block discarded – undo
254 254
      */
255 255
     private function createFile(string $basePath, string $from, string $to, array $tplData)
256 256
     {
257
-        $r = array_filter($this->tpls, function (SplFileInfo $f) use($from) {
257
+        $r = array_filter($this->tpls, function(SplFileInfo $f) use($from) {
258 258
             return $f->getBasename() == $from;
259 259
         });
260 260
 
261 261
         /* @var  SplFileInfo $f */
262 262
         $f = current($r);
263
-        if($f) {
263
+        if ($f) {
264 264
             $res = $this->twig->render($f->getRelativePathname(), $tplData);
265 265
             $savePath = sprintf('%s%s%s', $basePath, DIRECTORY_SEPARATOR, $to);
266 266
             file_put_contents($savePath, $res);
Please login to merge, or discard this patch.