@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | $files = $this->finder->find($this->path); |
94 | 94 | |
95 | - if(0 == sizeof($files, COUNT_NORMAL)) { |
|
95 | + if (0 == sizeof($files, COUNT_NORMAL)) { |
|
96 | 96 | throw new \LogicException('No file found'); |
97 | 97 | } |
98 | 98 | |
@@ -116,12 +116,12 @@ discard block |
||
116 | 116 | , $classMap |
117 | 117 | ); |
118 | 118 | |
119 | - foreach($files as $k => $filename) { |
|
119 | + foreach ($files as $k => $filename) { |
|
120 | 120 | |
121 | 121 | $progress->advance(); |
122 | 122 | |
123 | 123 | // Integrity |
124 | - if(!$this->ignoreErrors && !$syntaxChecker->isCorrect($filename)) { |
|
124 | + if (!$this->ignoreErrors && !$syntaxChecker->isCorrect($filename)) { |
|
125 | 125 | $this->output->writeln(sprintf('<error>file %s is not valid and has been skipped</error>', $filename)); |
126 | 126 | unset($files[$k]); |
127 | 127 | continue; |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | // Analyze |
131 | 131 | try { |
132 | 132 | $resultSet = $fileAnalyzer->execute($filename); |
133 | - } catch(NoTokenizableException $e) { |
|
133 | + } catch (NoTokenizableException $e) { |
|
134 | 134 | $this->output->writeln(sprintf("<error>file %s has been skipped: \n%s</error>", $filename, $e->getMessage())); |
135 | 135 | unset($files[$k]); |
136 | 136 | continue; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $progress->finish(); |
152 | 152 | |
153 | 153 | |
154 | - if($this->withOOP) { |
|
154 | + if ($this->withOOP) { |
|
155 | 155 | // COUPLING (should be done after parsing files) |
156 | 156 | $this->output->write(str_pad("\x0DAnalyzing coupling. This will take few minutes...", 80, "\x20")); |
157 | 157 | $couplingAnalyzer = new CouplingAnalyzer($classMap, $collection); |
@@ -47,7 +47,7 @@ |
||
47 | 47 | * @inheritdoc |
48 | 48 | */ |
49 | 49 | public function execute(ResultCollection $collection, ResultCollection $aggregatedResults) { |
50 | - foreach($this->jobs as $job) { |
|
50 | + foreach ($this->jobs as $job) { |
|
51 | 51 | $job->execute($collection, $aggregatedResults); |
52 | 52 | } |
53 | 53 | } |
@@ -60,7 +60,7 @@ |
||
60 | 60 | * @inheritdoc |
61 | 61 | */ |
62 | 62 | public function execute(ResultCollection $collection, ResultCollection $aggregatedResults) { |
63 | - if(!$this->enabled) { |
|
63 | + if (!$this->enabled) { |
|
64 | 64 | return; |
65 | 65 | } |
66 | 66 |
@@ -61,12 +61,12 @@ |
||
61 | 61 | * @inheritdoc |
62 | 62 | */ |
63 | 63 | public function execute(ResultCollection $collection, ResultCollection $aggregatedResults) { |
64 | - if(!$this->destination) { |
|
64 | + if (!$this->destination) { |
|
65 | 65 | return; |
66 | 66 | } |
67 | 67 | |
68 | 68 | $dir = dirname($this->destination); |
69 | - if(!file_exists($dir)) { |
|
69 | + if (!file_exists($dir)) { |
|
70 | 70 | mkdir($dir, 0777, true); |
71 | 71 | } |
72 | 72 | $this->output->writeln(sprintf('Generating %s Report...', $this->formater->getName())); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | 'path', InputArgument::OPTIONAL, 'Path to explore' |
39 | 39 | ) |
40 | 40 | ->addOption( |
41 | - 'report-html',null, InputOption::VALUE_REQUIRED, 'Path to save report in HTML format. Example: /tmp/report.html' |
|
41 | + 'report-html', null, InputOption::VALUE_REQUIRED, 'Path to save report in HTML format. Example: /tmp/report.html' |
|
42 | 42 | ) |
43 | 43 | ->addOption( |
44 | 44 | 'report-xml', null, InputOption::VALUE_REQUIRED, 'Path to save summary report in XML format. Example: /tmp/report.xml' |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $config = $configFactory->factory($input); |
103 | 103 | |
104 | 104 | // files |
105 | - if(null === $config->getPath()->getBasePath()) { |
|
105 | + if (null === $config->getPath()->getBasePath()) { |
|
106 | 106 | throw new \LogicException('Please provide a path to analyze'); |
107 | 107 | } |
108 | 108 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | // evaluation of success |
131 | 131 | $rule = $config->getFailureCondition(); |
132 | - if(null !== $rule) { |
|
132 | + if (null !== $rule) { |
|
133 | 133 | $evaluator = new Evaluator($collection, $aggregatedResults, $bounds); |
134 | 134 | $result = $evaluator->evaluate($rule); |
135 | 135 | // fail if failure-condition is realized |
@@ -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,18 +46,18 @@ 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('ignore-errors')) > 0 && $config->setIgnoreErrors(true); |
63 | 63 |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @param array $defaults |
29 | 29 | */ |
30 | 30 | public function __construct(array $defaults = null) { |
31 | - if(is_null($defaults)) { |
|
31 | + if (is_null($defaults)) { |
|
32 | 32 | $defaults = array('.phpmetrics.yml', '.phpmetrics.yml.dist', '.phpmetrics-dist.yml'); |
33 | 33 | } |
34 | 34 | $this->defaults = $defaults; |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function locate($filename) { |
44 | 44 | |
45 | - if(null === $filename) { |
|
45 | + if (null === $filename) { |
|
46 | 46 | // try to use default configfile : .phpmetrics.yml or .phpmetrics.yml.dist |
47 | - foreach($this->defaults as $filenameToCheck) { |
|
47 | + foreach ($this->defaults as $filenameToCheck) { |
|
48 | 48 | $filenameToCheck = getcwd().DIRECTORY_SEPARATOR.$filenameToCheck; |
49 | 49 | if (true === $this->isFileAccessible($filenameToCheck)) { |
50 | 50 | return $filenameToCheck; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | return null; |
54 | 54 | } |
55 | 55 | |
56 | - if(false === $this->isFileAccessible($filename)) { |
|
56 | + if (false === $this->isFileAccessible($filename)) { |
|
57 | 57 | throw new \RuntimeException('configuration file is not accessible'); |
58 | 58 | } |
59 | 59 |
@@ -33,7 +33,7 @@ |
||
33 | 33 | { |
34 | 34 | $available = ['metrics', 'self-update']; |
35 | 35 | $arg = $input->getFirstArgument(); |
36 | - if(!in_array($arg, $available) ||'metrics' === $arg) { |
|
36 | + if (!in_array($arg, $available) || 'metrics' === $arg) { |
|
37 | 37 | // default argument : we don't want to provide the name of the command by default |
38 | 38 | $inputDefinition = $this->getDefinition(); |
39 | 39 | $inputDefinition->setArguments(); |
@@ -51,19 +51,19 @@ discard block |
||
51 | 51 | /** |
52 | 52 | * @inheritdoc |
53 | 53 | */ |
54 | - public function terminate(ResultCollection $collection, ResultCollection $groupedResults){ |
|
54 | + public function terminate(ResultCollection $collection, ResultCollection $groupedResults) { |
|
55 | 55 | |
56 | 56 | $text = 'digraph G {' |
57 | - . PHP_EOL .'bgcolor=white;' |
|
58 | - . PHP_EOL .'node [shape=circle, color=lightblue2, style=filled];'; |
|
57 | + . PHP_EOL.'bgcolor=white;' |
|
58 | + . PHP_EOL.'node [shape=circle, color=lightblue2, style=filled];'; |
|
59 | 59 | |
60 | 60 | $width = 300; |
61 | 61 | |
62 | - foreach($collection as $item) { |
|
62 | + foreach ($collection as $item) { |
|
63 | 63 | |
64 | 64 | // color |
65 | 65 | $valid = $this->validator->validate('maintainabilityIndex', $item->getMaintainabilityIndex()->getMaintainabilityIndex()); |
66 | - switch($valid) { |
|
66 | + switch ($valid) { |
|
67 | 67 | case Validator::CRITICAL: $color = 'red'; break; |
68 | 68 | case Validator::GOOD: $color = 'chartreuse4'; break; |
69 | 69 | case Validator::WARNING: $color = 'gold1'; break; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | // size |
74 | 74 | $size = round($item->getMcCabe()->getCyclomaticComplexityNumber() * $width / 100); |
75 | 75 | |
76 | - $text .= PHP_EOL. sprintf('"%1$s" [color=%2$s, tooltip="%3$s", width=%4$s, height=%4$s, label=""];' |
|
76 | + $text .= PHP_EOL.sprintf('"%1$s" [color=%2$s, tooltip="%3$s", width=%4$s, height=%4$s, label=""];' |
|
77 | 77 | , $item->getName() |
78 | 78 | , $color |
79 | 79 | , $item->getName() |