@@ -26,13 +26,13 @@ |
||
26 | 26 | public function dump(TokenCollection $tokens, $start = 0, $len = 0) |
27 | 27 | { |
28 | 28 | $str = ''; |
29 | - if($len == 0) { |
|
29 | + if ($len == 0) { |
|
30 | 30 | $len = sizeof($tokens); |
31 | 31 | } |
32 | - if($start < 0) { |
|
32 | + if ($start < 0) { |
|
33 | 33 | $start = 0; |
34 | 34 | } |
35 | - for($i = $start; $i < $len; $i++) { |
|
35 | + for ($i = $start; $i < $len; $i++) { |
|
36 | 36 | $str .= sprintf("\n%s : %s", token_name($tokens[$i]->getType()), $tokens[$i]->getValue()); |
37 | 37 | } |
38 | 38 | return $str; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | $this->tokenizer = $tokenizer; |
50 | 50 | $this->searcher = new Searcher(); |
51 | - $this->result= new Result; |
|
51 | + $this->result = new Result; |
|
52 | 52 | |
53 | 53 | $this->extractors = (object) array( |
54 | 54 | 'class' => new ClassExtractor($this->searcher) |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | $endAnonymous = 0; |
81 | 81 | $mainContextClass = null; // class containing a anonymous class |
82 | 82 | |
83 | - for($n = 0; $n < $len; $n++) { |
|
83 | + for ($n = 0; $n < $len; $n++) { |
|
84 | 84 | |
85 | - if($mainContextClass && $n > $endAnonymous) { |
|
85 | + if ($mainContextClass && $n > $endAnonymous) { |
|
86 | 86 | // anonymous class is finished. We back to parent class |
87 | 87 | // methods will be added to the main class now |
88 | 88 | $class = $mainContextClass; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | $token = $tokens[$n]; |
93 | 93 | |
94 | - switch($token->getType()) { |
|
94 | + switch ($token->getType()) { |
|
95 | 95 | |
96 | 96 | case T_USE: |
97 | 97 | $alias = $this->extractors->alias->extract($n, $tokens); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | case T_CLASS: |
132 | 132 | $i = $n; |
133 | 133 | // avoid MyClass::class syntax |
134 | - if($this->searcher->isPrecededBy(T_DOUBLE_COLON, $i, $tokens, 1)) { |
|
134 | + if ($this->searcher->isPrecededBy(T_DOUBLE_COLON, $i, $tokens, 1)) { |
|
135 | 135 | continue; |
136 | 136 | } |
137 | 137 | |
@@ -142,14 +142,14 @@ discard block |
||
142 | 142 | $result->pushClass($c); |
143 | 143 | |
144 | 144 | // PHP 7 and inner classes |
145 | - if($c instanceof ReflectedAnonymousClass) { |
|
145 | + if ($c instanceof ReflectedAnonymousClass) { |
|
146 | 146 | // avoid to consider anonymous class as main class |
147 | 147 | $p = $n; |
148 | 148 | $endAnonymous = $this->searcher->getPositionOfClosingBrace($p, $tokens); |
149 | 149 | $mainContextClass = $class; |
150 | 150 | |
151 | 151 | // add anonymous class in method |
152 | - if($method) { |
|
152 | + if ($method) { |
|
153 | 153 | $method->pushAnonymousClass($c); |
154 | 154 | } |
155 | 155 | } |
@@ -157,10 +157,10 @@ discard block |
||
157 | 157 | break; |
158 | 158 | |
159 | 159 | case T_FUNCTION: |
160 | - if($class) { |
|
160 | + if ($class) { |
|
161 | 161 | // avoid closure |
162 | 162 | $next = $tokens[$n + 1]; |
163 | - if(T_WHITESPACE != $next->getType()) { |
|
163 | + if (T_WHITESPACE != $next->getType()) { |
|
164 | 164 | continue; |
165 | 165 | } |
166 | 166 | $method = $this->extractors->method->extract($n, $tokens, $class); |
@@ -9,10 +9,6 @@ |
||
9 | 9 | |
10 | 10 | namespace Hal\Application\Command\Job; |
11 | 11 | use Hal\Application\Extension\ExtensionService; |
12 | -use Hal\Application\Formater\Chart; |
|
13 | -use Hal\Application\Formater\Details; |
|
14 | -use Hal\Application\Formater\Summary; |
|
15 | -use Hal\Application\Formater\Violations; |
|
16 | 12 | use Hal\Application\Score\Scoring; |
17 | 13 | use Hal\Component\Aggregator\DirectoryAggregatorFlat; |
18 | 14 | use Hal\Component\Bounds\BoundsInterface; |
@@ -10,13 +10,10 @@ |
||
10 | 10 | namespace Hal\Application\Command\Job; |
11 | 11 | use Hal\Application\Extension\ExtensionService; |
12 | 12 | use Hal\Application\Extension\extensionsService; |
13 | -use Hal\Application\Extension\Repository; |
|
14 | 13 | use Hal\Application\Formater\Chart; |
15 | 14 | use Hal\Application\Formater\Details; |
16 | 15 | use Hal\Application\Formater\Summary; |
17 | 16 | use Hal\Application\Formater\Violations; |
18 | -use Hal\Application\Score\Scoring; |
|
19 | -use Hal\Component\Aggregator\DirectoryAggregatorFlat; |
|
20 | 17 | use Hal\Component\Bounds\BoundsInterface; |
21 | 18 | use Hal\Component\Config\ConfigurationInterface; |
22 | 19 | use Hal\Component\File\Finder; |
@@ -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; |
@@ -18,7 +18,7 @@ |
||
18 | 18 | /** |
19 | 19 | * @var Repository |
20 | 20 | */ |
21 | - private $repository; |
|
21 | + private $repository; |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * ExtensionService constructor. |
@@ -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()); |