Completed
Push — master ( 256029...39e557 )
by personal
02:46
created
src/Hal/Application/Config/ConfigFactory.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Hal/Application/Config/ConfigLocator.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Hal/Application/Console/PhpMetricsApplication.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
src/Hal/Application/Formater/Chart/Bubbles.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -51,19 +51,19 @@  discard block
 block discarded – undo
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
 block discarded – undo
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()
Please login to merge, or discard this patch.
src/Hal/Application/Formater/Details/Cli.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     /**
55 55
      * @inheritdoc
56 56
      */
57
-    public function terminate(ResultCollection $collection, ResultCollection $groupedResults){
57
+    public function terminate(ResultCollection $collection, ResultCollection $groupedResults) {
58 58
 
59 59
         $output = new BufferedOutput(OutputInterface::VERBOSITY_NORMAL, true);
60 60
 //        $output->write(str_pad("\x0D", 80, "\x20"));
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
             ))
104 104
             ->setLayout(TableHelper::LAYOUT_DEFAULT);
105 105
 
106
-        foreach($groupedResults as $result) {
106
+        foreach ($groupedResults as $result) {
107 107
             $table->addRow(array_merge(
108 108
                 array(
109 109
                     str_repeat('  ', $result->getDepth()).$result->getName()
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
     private function getStyle($key, $value) {
159 159
         $score = $this->validator->validate($key, $value);
160 160
 
161
-        switch($score) {
161
+        switch ($score) {
162 162
             case Validator::GOOD:
163 163
                 return 'fg=green';
164 164
             case Validator::WARNING:
Please login to merge, or discard this patch.
src/Hal/Application/Formater/Details/Csv.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,20 +29,20 @@
 block discarded – undo
29 29
     /**
30 30
      * @inheritdoc
31 31
      */
32
-    public function terminate(ResultCollection $collection, ResultCollection $groupedResults){
32
+    public function terminate(ResultCollection $collection, ResultCollection $groupedResults) {
33 33
 
34 34
         $fwd = fopen('php://memory', 'w');
35
-        if(sizeof($collection, COUNT_NORMAL) > 0) {
35
+        if (sizeof($collection, COUNT_NORMAL) > 0) {
36 36
             $r = current($collection->asArray());
37 37
             $labels = array_keys($r);
38 38
             fputcsv($fwd, $labels);
39 39
         }
40
-        foreach($collection as $item) {
40
+        foreach ($collection as $item) {
41 41
             fputcsv($fwd, $item->asArray());
42 42
         }
43 43
 
44 44
         rewind($fwd);
45
-        $r =  stream_get_contents($fwd);
45
+        $r = stream_get_contents($fwd);
46 46
         fclose($fwd);
47 47
         return $r;
48 48
     }
Please login to merge, or discard this patch.
src/Hal/Application/Formater/Summary/Cli.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     /**
61 61
      * @inheritdoc
62 62
      */
63
-    public function terminate(ResultCollection $collection, ResultCollection $groupedResults){
63
+    public function terminate(ResultCollection $collection, ResultCollection $groupedResults) {
64 64
 
65 65
         $this->output->write(str_pad("\x0D", 80, "\x20"));
66 66
         $this->output->writeln('');
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         $score = $collection->getScore();
70 70
 //        if($score) {
71 71
             foreach ($score->all() as $name => $value) {
72
-                $this->output->writeln(sprintf('%s %s', str_pad($name, 35, '.'),  str_pad($value, 5, ' ', STR_PAD_LEFT). ' / ' . Scoring::MAX));
72
+                $this->output->writeln(sprintf('%s %s', str_pad($name, 35, '.'), str_pad($value, 5, ' ', STR_PAD_LEFT).' / '.Scoring::MAX));
73 73
             }
74 74
         $this->output->writeln('');
75 75
 //        }
Please login to merge, or discard this patch.
src/Hal/Application/Formater/Summary/Html.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     /**
62 62
      * @inheritdoc
63 63
      */
64
-    public function terminate(ResultCollection $collection, ResultCollection $groupedResults){
64
+    public function terminate(ResultCollection $collection, ResultCollection $groupedResults) {
65 65
         \Twig_Autoloader::register();
66 66
         $loader = new \Twig_Loader_Filesystem(__DIR__.'/../../../../../templates/html');
67 67
         $twig = new \Twig_Environment($loader, array('cache' => false));
@@ -92,14 +92,14 @@  discard block
 block discarded – undo
92 92
         $array = array();
93 93
 
94 94
         // map of classes an relations
95
-        foreach($collection as $item) {
95
+        foreach ($collection as $item) {
96 96
 
97 97
             // case of oop is disabled
98
-            if(!$item->getOOP()) {
98
+            if (!$item->getOOP()) {
99 99
                 continue;
100 100
             }
101 101
 
102
-            foreach($item->getOOP()->getClasses() as $class) {
102
+            foreach ($item->getOOP()->getClasses() as $class) {
103 103
                 $array[$class->getFullname()] = (object) array(
104 104
                     'name' => $class->getFullname()
105 105
                     , 'size' => 3000
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
         }
113 113
 
114 114
         // dependency can not be in the parsed sources (for example, native PHP classes)
115
-        foreach($array as $class => $infos) {
116
-            foreach($infos->relations as $relation) {
117
-                if(!isset($array[$relation])) {
115
+        foreach ($array as $class => $infos) {
116
+            foreach ($infos->relations as $relation) {
117
+                if (!isset($array[$relation])) {
118 118
                     $array[$relation] = (object) array('name' => $relation, 'relations' => array(), 'size' => 3000);
119 119
                 }
120 120
 //                array_push($array[$relation]->imports, $class);
Please login to merge, or discard this patch.
src/Hal/Application/Formater/Summary/Xml.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
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
         $bounds = $this->bound->calculate($collection);
57 57
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
         // modules
65 65
         $modules = $xml->createElement('modules');
66
-        foreach($groupedResults as $result) {
66
+        foreach ($groupedResults as $result) {
67 67
             $module = $xml->createElement('module');
68 68
             $this->injectsBounds($module, $result->getBounds());
69 69
             $module->setAttribute('namespace', $result->getName());
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         $node->setAttribute('length', $bound->getAverage('length'));
99 99
 
100 100
         $hasOOP = null !== $bound->getSum('instability');
101
-        if($hasOOP) {
101
+        if ($hasOOP) {
102 102
             $node->setAttribute('lcom', $bound->getAverage('lcom'));
103 103
             $node->setAttribute('instability', $bound->getAverage('instability'));
104 104
             $node->setAttribute('efferentCoupling', $bound->getAverage('efferentCoupling'));
Please login to merge, or discard this patch.