@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $locator = new ConfigLocator(); |
38 | 38 | $filename = $locator->locate($input->getOption('config')); |
39 | 39 | |
40 | - if(null !== $filename) { |
|
40 | + if (null !== $filename) { |
|
41 | 41 | $loader = new Loader($hydrator); |
42 | 42 | $config = $loader->load($filename); |
43 | 43 | } else { |
@@ -46,21 +46,21 @@ discard block |
||
46 | 46 | |
47 | 47 | |
48 | 48 | // then, overwrite configuration by arguments provided in run |
49 | - strlen($input->getArgument('path')) > 0 && $config->getPath()->setBasePath($input->getArgument('path')); |
|
50 | - strlen($input->getOption('extensions')) > 0 && $config->getPath()->setExtensions($input->getOption('extensions')); |
|
51 | - strlen($input->getOption('excluded-dirs')) > 0 && $config->getPath()->setExcludedDirs($input->getOption('excluded-dirs')); |
|
52 | - strlen($input->getOption('symlinks')) > 0 && $config->getPath()->setFollowSymlinks(true); |
|
53 | - strlen($input->getOption('report-xml')) > 0 && $config->getLogging()->setReport('xml', $input->getOption('report-xml')); |
|
54 | - strlen($input->getOption('report-cli')) > 0 && $config->getLogging()->setReport('cli', $input->getOption('report-cli')); |
|
55 | - strlen($input->getOption('report-json')) > 0 && $config->getLogging()->setReport('json', $input->getOption('report-json')); |
|
56 | - strlen($input->getOption('report-html')) > 0 && $config->getLogging()->setReport('html', $input->getOption('report-html')); |
|
57 | - strlen($input->getOption('report-csv')) > 0 && $config->getLogging()->setReport('csv', $input->getOption('report-csv')); |
|
49 | + strlen($input->getArgument('path')) > 0 && $config->getPath()->setBasePath($input->getArgument('path')); |
|
50 | + strlen($input->getOption('extensions')) > 0 && $config->getPath()->setExtensions($input->getOption('extensions')); |
|
51 | + strlen($input->getOption('excluded-dirs')) > 0 && $config->getPath()->setExcludedDirs($input->getOption('excluded-dirs')); |
|
52 | + strlen($input->getOption('symlinks')) > 0 && $config->getPath()->setFollowSymlinks(true); |
|
53 | + strlen($input->getOption('report-xml')) > 0 && $config->getLogging()->setReport('xml', $input->getOption('report-xml')); |
|
54 | + strlen($input->getOption('report-cli')) > 0 && $config->getLogging()->setReport('cli', $input->getOption('report-cli')); |
|
55 | + strlen($input->getOption('report-json')) > 0 && $config->getLogging()->setReport('json', $input->getOption('report-json')); |
|
56 | + strlen($input->getOption('report-html')) > 0 && $config->getLogging()->setReport('html', $input->getOption('report-html')); |
|
57 | + strlen($input->getOption('report-csv')) > 0 && $config->getLogging()->setReport('csv', $input->getOption('report-csv')); |
|
58 | 58 | strlen($input->getOption('violations-xml')) > 0 && $config->getLogging()->setViolation('xml', $input->getOption('violations-xml')); |
59 | - strlen($input->getOption('chart-bubbles')) > 0 && $config->getLogging()->setChart('bubbles', $input->getOption('chart-bubbles')); |
|
60 | - strlen($input->getOption('failure-condition')) > 0 && $config->setFailureCondition($input->getOption('failure-condition')); |
|
59 | + strlen($input->getOption('chart-bubbles')) > 0 && $config->getLogging()->setChart('bubbles', $input->getOption('chart-bubbles')); |
|
60 | + strlen($input->getOption('failure-condition')) > 0 && $config->setFailureCondition($input->getOption('failure-condition')); |
|
61 | 61 | strlen($input->getOption('template-title')) > 0 && $config->getTemplate()->setTitle($input->getOption('template-title')); |
62 | 62 | strlen($input->getOption('offline')) > 0 && $config->getTemplate()->setOffline($input->getOption('offline')); |
63 | - strlen($input->getOption('plugins')) > 0 && $config->getExtensions()->setExtensions(explode(',', $input->getOption('plugins'))); |
|
63 | + strlen($input->getOption('plugins')) > 0 && $config->getExtensions()->setExtensions(explode(',', $input->getOption('plugins'))); |
|
64 | 64 | strlen($input->getOption('ignore-errors')) > 0 && $config->setIgnoreErrors(true); |
65 | 65 | |
66 | 66 | return $config; |
@@ -47,7 +47,7 @@ |
||
47 | 47 | public function receive(Configuration $config, ResultCollection $collection, ResultCollection $aggregatedResults, Bounds $bounds) |
48 | 48 | { |
49 | 49 | // search controller |
50 | - foreach($this->repository->all() as $item) { |
|
50 | + foreach ($this->repository->all() as $item) { |
|
51 | 51 | $item->receive($config, $collection, $aggregatedResults, $bounds); |
52 | 52 | } |
53 | 53 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | |
10 | 10 | namespace Hal\Application\Extension; |
11 | 11 | |
12 | -class Repository{ |
|
12 | +class Repository { |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * @var array |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function textify($v) |
54 | 54 | { |
55 | - return ucfirst(preg_replace( '/([a-z0-9])([A-Z])/', "$1 $2", $v )); |
|
55 | + return ucfirst(preg_replace('/([a-z0-9])([A-Z])/', "$1 $2", $v)); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -74,12 +74,12 @@ discard block |
||
74 | 74 | public function extensionsMenu(ExtensionService $extensions) |
75 | 75 | { |
76 | 76 | $html = ''; |
77 | - foreach($extensions->getRepository()->all() as $extension) { |
|
77 | + foreach ($extensions->getRepository()->all() as $extension) { |
|
78 | 78 | $helper = $extension->getReporterHtmlSummary(); |
79 | - if(!$helper) { |
|
79 | + if (!$helper) { |
|
80 | 80 | continue; |
81 | 81 | } |
82 | - foreach($helper->getMenus() as $name => $label) { |
|
82 | + foreach ($helper->getMenus() as $name => $label) { |
|
83 | 83 | $html .= sprintf('<li id="link-%s"><a>%s</a></li>', $name, $label); |
84 | 84 | } |
85 | 85 | } |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | public function extensionsJs(ExtensionService $extensions) |
94 | 94 | { |
95 | 95 | $html = ''; |
96 | - foreach($extensions->getRepository()->all() as $extension) { |
|
96 | + foreach ($extensions->getRepository()->all() as $extension) { |
|
97 | 97 | $helper = $extension->getReporterHtmlSummary(); |
98 | - if(!$helper) { |
|
98 | + if (!$helper) { |
|
99 | 99 | continue; |
100 | 100 | } |
101 | 101 | $html .= $helper->renderJs(); |
@@ -110,9 +110,9 @@ discard block |
||
110 | 110 | public function extensionsContent(ExtensionService $extensions) |
111 | 111 | { |
112 | 112 | $html = ''; |
113 | - foreach($extensions->getRepository()->all() as $extension) { |
|
113 | + foreach ($extensions->getRepository()->all() as $extension) { |
|
114 | 114 | $helper = $extension->getReporterHtmlSummary(); |
115 | - if(!$helper) { |
|
115 | + if (!$helper) { |
|
116 | 116 | continue; |
117 | 117 | } |
118 | 118 | $html .= $helper->renderHtml(); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | /** |
69 | 69 | * @inheritdoc |
70 | 70 | */ |
71 | - public function terminate(ResultCollection $collection, ResultCollection $groupedResults){ |
|
71 | + public function terminate(ResultCollection $collection, ResultCollection $groupedResults) { |
|
72 | 72 | |
73 | 73 | $this->output->write(str_pad("\x0D", 80, "\x20")); |
74 | 74 | $this->output->writeln(''); |
@@ -76,14 +76,14 @@ discard block |
||
76 | 76 | // score |
77 | 77 | $score = $collection->getScore(); |
78 | 78 | foreach ($score->all() as $name => $value) { |
79 | - $this->output->writeln(sprintf('%s %s', str_pad($name, 35, '.'), str_pad($value, 5, ' ', STR_PAD_LEFT). ' / ' . Scoring::MAX)); |
|
79 | + $this->output->writeln(sprintf('%s %s', str_pad($name, 35, '.'), str_pad($value, 5, ' ', STR_PAD_LEFT).' / '.Scoring::MAX)); |
|
80 | 80 | } |
81 | 81 | $this->output->writeln(''); |
82 | 82 | |
83 | 83 | // extensions |
84 | - foreach($this->extensionsService->getRepository()->all() as $plugin) { |
|
84 | + foreach ($this->extensionsService->getRepository()->all() as $plugin) { |
|
85 | 85 | $helper = $plugin->getReporterCliSummary(); |
86 | - if(!$helper) { |
|
86 | + if (!$helper) { |
|
87 | 87 | continue; |
88 | 88 | } |
89 | 89 | $this->output->write($helper->render()); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | 'path', InputArgument::OPTIONAL, 'Path to explore' |
43 | 43 | ) |
44 | 44 | ->addOption( |
45 | - 'report-html',null, InputOption::VALUE_REQUIRED, 'Path to save report in HTML format. Example: /tmp/report.html' |
|
45 | + 'report-html', null, InputOption::VALUE_REQUIRED, 'Path to save report in HTML format. Example: /tmp/report.html' |
|
46 | 46 | ) |
47 | 47 | ->addOption( |
48 | 48 | 'report-xml', null, InputOption::VALUE_REQUIRED, 'Path to save summary report in XML format. Example: /tmp/report.xml' |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $config = $configFactory->factory($input); |
113 | 113 | |
114 | 114 | // files |
115 | - if(null === $config->getPath()->getBasePath()) { |
|
115 | + if (null === $config->getPath()->getBasePath()) { |
|
116 | 116 | throw new \LogicException('Please provide a path to analyze'); |
117 | 117 | } |
118 | 118 | |
@@ -125,8 +125,8 @@ discard block |
||
125 | 125 | |
126 | 126 | // prepare plugins |
127 | 127 | $repository = new Repository(); |
128 | - foreach($config->getExtensions()->getExtensions() as $filename) { |
|
129 | - if(!file_exists($filename) ||!is_readable($filename)) { |
|
128 | + foreach ($config->getExtensions()->getExtensions() as $filename) { |
|
129 | + if (!file_exists($filename) || !is_readable($filename)) { |
|
130 | 130 | $output->writeln(sprintf('<error>Plugin %s skipped: not found</error>', $filename)); |
131 | 131 | continue; |
132 | 132 | } |
@@ -150,8 +150,8 @@ discard block |
||
150 | 150 | $output->writeln(''); |
151 | 151 | |
152 | 152 | // provide data to extensions |
153 | - if(($n = sizeof($repository->all())) > 0) { |
|
154 | - $output->writeln(sprintf('%d %s. Executing analyzis', $n, ($n > 1 ? 'plugins are enabled' : 'plugin is enabled') )); |
|
153 | + if (($n = sizeof($repository->all())) > 0) { |
|
154 | + $output->writeln(sprintf('%d %s. Executing analyzis', $n, ($n > 1 ? 'plugins are enabled' : 'plugin is enabled'))); |
|
155 | 155 | $extensionService->receive($config, $collection, $aggregatedResults, $bounds); |
156 | 156 | } |
157 | 157 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | |
166 | 166 | // evaluation of success |
167 | 167 | $rule = $config->getFailureCondition(); |
168 | - if(null !== $rule) { |
|
168 | + if (null !== $rule) { |
|
169 | 169 | $evaluator = new Evaluator($collection, $aggregatedResults, $bounds); |
170 | 170 | $result = $evaluator->evaluate($rule); |
171 | 171 | // fail if failure-condition is realized |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | // rules |
54 | 54 | $rules = ''; |
55 | - foreach($this->ruleset->asArray() as $key => $values) { |
|
55 | + foreach ($this->ruleset->asArray() as $key => $values) { |
|
56 | 56 | $rules .= sprintf(' %s: [ %s ]%s', $key, implode(', ', $values), PHP_EOL); |
57 | 57 | } |
58 | 58 | |
@@ -72,12 +72,12 @@ discard block |
||
72 | 72 | EOT; |
73 | 73 | |
74 | 74 | // write file |
75 | - if(!$this->destination) { |
|
75 | + if (!$this->destination) { |
|
76 | 76 | throw new \LogicException('Please provide a destination'); |
77 | 77 | } |
78 | 78 | |
79 | 79 | $dir = dirname($this->destination); |
80 | - if(!file_exists($dir)) { |
|
80 | + if (!file_exists($dir)) { |
|
81 | 81 | mkdir($dir, 0777, true); |
82 | 82 | } |
83 | 83 |
@@ -27,9 +27,9 @@ |
||
27 | 27 | public function validates(Configuration $config) |
28 | 28 | { |
29 | 29 | // graphviz |
30 | - if($config->getLogging()->getChart('bubbles')) { |
|
30 | + if ($config->getLogging()->getChart('bubbles')) { |
|
31 | 31 | $graphviz = new Graphviz(); |
32 | - if(!$graphviz->isAvailable()) { |
|
32 | + if (!$graphviz->isAvailable()) { |
|
33 | 33 | throw new \RuntimeException('Graphviz not installed'); |
34 | 34 | } |
35 | 35 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | */ |
36 | 36 | public function getImage($dotContent) { |
37 | 37 | |
38 | - if(!$this->isAvailable()) { |
|
38 | + if (!$this->isAvailable()) { |
|
39 | 39 | throw new \RuntimeException('Graphviz not installed'); |
40 | 40 | } |
41 | 41 |