@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | ->setName('tvi:monitor:generator:check') |
48 | 48 | ->setDescription('Generates check plugin from tvi monitor template') |
49 | 49 | ->addArgument('name', InputArgument::REQUIRED, 'Check name') |
50 | - ->addOption('group', 'g',InputOption::VALUE_OPTIONAL, 'Check group') |
|
51 | - ->addOption('integration-test-src', null,InputOption::VALUE_OPTIONAL, 'Path to integration tests src', null) |
|
50 | + ->addOption('group', 'g', InputOption::VALUE_OPTIONAL, 'Check group') |
|
51 | + ->addOption('integration-test-src', null, InputOption::VALUE_OPTIONAL, 'Path to integration tests src', null) |
|
52 | 52 | ->addOption('no-backup', 'b', InputOption::VALUE_NONE, 'Do not backup existing check files.') |
53 | 53 | ->setHelp(<<<EOT |
54 | 54 | The <info>%command.name%</info> command generates check classes |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | @list($bundleName, $checkPath) = (count($r) == 1) ? [null, current($r)] : $r; |
102 | 102 | |
103 | 103 | /* @var $bundle Bundle */ |
104 | - if(!$bundleName) { |
|
104 | + if (!$bundleName) { |
|
105 | 105 | $defaultBundle = 'TviMonitorBundle'; |
106 | 106 | $bundle = $this->getApplication()->getKernel()->getBundle($defaultBundle); |
107 | 107 | $output->writeln(sprintf('<info>Use default bundle <comment>%s</comment></info>', $bundle->getNamespace())); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | preg_match('#^(.*?)(\w+)$#', $checkPath, $m); |
118 | - list($checkNamespace, $checkName) = [$m[1], $m[2]]; |
|
118 | + list($checkNamespace, $checkName) = [$m[1], $m[2]]; |
|
119 | 119 | |
120 | 120 | $checkNamespace = preg_replace('#\\\$#', '', $checkNamespace); |
121 | 121 | $bundleNamespace = $bundle->getNamespace(); |
@@ -139,14 +139,14 @@ discard block |
||
139 | 139 | |
140 | 140 | //CHECK_GROUP |
141 | 141 | $group = $input->getOption('group'); |
142 | - $CHECK_GROUP = $group ? $group: $CHECK_ALIAS; |
|
142 | + $CHECK_GROUP = $group ? $group : $CHECK_ALIAS; |
|
143 | 143 | |
144 | 144 | $checkPath = sprintf('%s%s%s', $bundle->getPath(), DIRECTORY_SEPARATOR, $checkPath); |
145 | 145 | $checkPath = str_replace('\\', DIRECTORY_SEPARATOR, $checkPath); |
146 | 146 | |
147 | - if(is_dir($checkPath)) { |
|
147 | + if (is_dir($checkPath)) { |
|
148 | 148 | |
149 | - if($noBackup && is_dir($checkPath)) { |
|
149 | + if ($noBackup && is_dir($checkPath)) { |
|
150 | 150 | $output->writeln(sprintf('<info><error>Check %s exist</error>. Use --no-backup flag to rewrite</info>', $NAMESPACE)); |
151 | 151 | exit(1); |
152 | 152 | } else { |
@@ -158,17 +158,17 @@ discard block |
||
158 | 158 | |
159 | 159 | foreach ($this->tpls as $f) { |
160 | 160 | |
161 | - if(in_array($f->getBasename(), ['config.example.yml.twig', 'README.mdpp.twig'])) { |
|
161 | + if (in_array($f->getBasename(), ['config.example.yml.twig', 'README.mdpp.twig'])) { |
|
162 | 162 | continue; |
163 | 163 | } |
164 | 164 | |
165 | 165 | /* @var SplFileInfo $f */ |
166 | 166 | $fName = $f->getBasename('.twig'); |
167 | 167 | |
168 | - if($fName == 'Test.php.integration') { |
|
168 | + if ($fName == 'Test.php.integration') { |
|
169 | 169 | |
170 | 170 | $testPath = $input->getOption('integration-test-src'); |
171 | - if(!$testPath) { |
|
171 | + if (!$testPath) { |
|
172 | 172 | continue; |
173 | 173 | } else { |
174 | 174 | $fName = $f->getBasename('.integration.twig'); |
@@ -188,8 +188,8 @@ discard block |
||
188 | 188 | ); |
189 | 189 | $fPath = preg_replace('#\\\+#', '/', $fPath); |
190 | 190 | |
191 | - if(is_dir($fPath)) { |
|
192 | - if($noBackup && is_dir($fPath)) { |
|
191 | + if (is_dir($fPath)) { |
|
192 | + if ($noBackup && is_dir($fPath)) { |
|
193 | 193 | $output->writeln(sprintf('<info>Tests for <error>check %s exist</error>. Use --no-backup flag to rewrite</info>', $NAMESPACE)); |
194 | 194 | continue; |
195 | 195 | } else { |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | @mkdir($fPath, 0775, true) && !is_dir($fPath); |
200 | 200 | } |
201 | 201 | } |
202 | - $TEST_NAMESPACE = sprintf('%s\%s\%s\%s', $bundleNamespace,'Test', $checkNamespace, $checkName); |
|
202 | + $TEST_NAMESPACE = sprintf('%s\%s\%s\%s', $bundleNamespace, 'Test', $checkNamespace, $checkName); |
|
203 | 203 | |
204 | 204 | $tplData = [ |
205 | 205 | 'NAMESPACE' => $TEST_NAMESPACE, |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | |
215 | 215 | file_put_contents($path, $res); |
216 | 216 | |
217 | - $this->createFile($fPath,'config.example.yml.twig','config.yml', $tplData); |
|
217 | + $this->createFile($fPath, 'config.example.yml.twig', 'config.yml', $tplData); |
|
218 | 218 | |
219 | 219 | } else { |
220 | 220 | $path = sprintf('%s%s%s', $checkPath, DIRECTORY_SEPARATOR, $fName); |
@@ -230,8 +230,8 @@ discard block |
||
230 | 230 | |
231 | 231 | file_put_contents($path, $res); |
232 | 232 | |
233 | - $this->createFile($checkPath,'config.example.yml.twig','config.example.yml', $tplData); |
|
234 | - $this->createFile($checkPath,'README.mdpp.twig','README.mdpp', $tplData); |
|
233 | + $this->createFile($checkPath, 'config.example.yml.twig', 'config.example.yml', $tplData); |
|
234 | + $this->createFile($checkPath, 'README.mdpp.twig', 'README.mdpp', $tplData); |
|
235 | 235 | } |
236 | 236 | } |
237 | 237 | } |
@@ -248,13 +248,13 @@ discard block |
||
248 | 248 | */ |
249 | 249 | private function createFile(string $basePath, string $from, string $to, array $tplData) |
250 | 250 | { |
251 | - $r = array_filter($this->tpls, function (SplFileInfo $f) use($from) { |
|
251 | + $r = array_filter($this->tpls, function(SplFileInfo $f) use($from) { |
|
252 | 252 | return $f->getBasename() == $from; |
253 | 253 | }); |
254 | 254 | |
255 | 255 | /* @var SplFileInfo $f */ |
256 | 256 | $f = current($r); |
257 | - if($f) { |
|
257 | + if ($f) { |
|
258 | 258 | $res = $this->twig->render($f->getRelativePathname(), $tplData); |
259 | 259 | $savePath = sprintf('%s%s%s', $basePath, DIRECTORY_SEPARATOR, $to); |
260 | 260 | file_put_contents($savePath, $res); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $this |
37 | 37 | ->setName('tvi:monitor:check:info') |
38 | 38 | ->setDescription('Info Health Checkers') |
39 | - ->addOption('group', 'g',InputOption::VALUE_OPTIONAL, 'Check group') |
|
39 | + ->addOption('group', 'g', InputOption::VALUE_OPTIONAL, 'Check group') |
|
40 | 40 | ; |
41 | 41 | } |
42 | 42 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $checkMetadatas = $this->runnerManager->getCheckMetadatas($group); |
64 | 64 | |
65 | 65 | if (0 === count($checkMetadatas)) { |
66 | - if(empty($group)) { |
|
66 | + if (empty($group)) { |
|
67 | 67 | $output->writeln(sprintf('<error>No checks configured.</error>')); |
68 | 68 | } else { |
69 | 69 | $output->writeln(sprintf('<error>No checks configured for group %s.</error>', $group)); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | foreach ($checkMetadatas as $checkMetadata) { |
75 | 75 | |
76 | 76 | $currentGroup = $checkMetadata->getGroup(); |
77 | - if(empty($group) && $showGroup != $currentGroup) { |
|
77 | + if (empty($group) && $showGroup != $currentGroup) { |
|
78 | 78 | $output->writeln(sprintf('<fg=yellow;options=bold>%s</>', $currentGroup)); |
79 | 79 | $showGroup = $currentGroup; |
80 | 80 | } |