Completed
Pull Request — master (#243)
by Jon
03:33
created
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/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/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.
src/Hal/Application/Formater/Violations/Xml.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     /**
51 51
      * @inheritdoc
52 52
      */
53
-    public function terminate(ResultCollection $collection, ResultCollection $groupedResults){
53
+    public function terminate(ResultCollection $collection, ResultCollection $groupedResults) {
54 54
 
55 55
 
56 56
         // root
@@ -61,18 +61,18 @@  discard block
 block discarded – undo
61 61
         $root->setAttribute('timestamp', date('c'));
62 62
 
63 63
         // violations
64
-        foreach($collection as $item) {
64
+        foreach ($collection as $item) {
65 65
             $file = $xml->createElement('file');
66 66
             $file->setAttribute('name', realpath($item->getFilename()));
67 67
 
68 68
             $array = $item->asArray();
69 69
             $hasViolation = false;
70
-            foreach($array as $key => $value) {
70
+            foreach ($array as $key => $value) {
71 71
                 $result = $this->validator->validate($key, $value);
72
-                if(Validator::GOOD !== $result && Validator::UNKNOWN !== $result) {
72
+                if (Validator::GOOD !== $result && Validator::UNKNOWN !== $result) {
73 73
                     $hasViolation = true;
74 74
                     $violation = $xml->createElement('violation');
75
-                    $violation->setAttribute('beginline' , 1);
75
+                    $violation->setAttribute('beginline', 1);
76 76
                     $violation->setAttribute('endline', $array['loc']);
77 77
                     $violation->setAttribute('rule', $key);
78 78
                     $violation->setAttribute('ruleset', $key);
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
                 }
90 90
             }
91 91
 
92
-            if($hasViolation) {
92
+            if ($hasViolation) {
93 93
                 $root->appendChild($file);
94 94
             }
95 95
         }
Please login to merge, or discard this patch.
src/Hal/Application/Rule/RuleSet.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
      */
37 37
     public function __construct(array $rules = array())
38 38
     {
39
-        if(!$rules) {
39
+        if (!$rules) {
40 40
             $rules = array(
41 41
                 'cyclomaticComplexity' => array(10, 6, 2)
42 42
                 , 'maintainabilityIndex' => array(0, 69, 85)
Please login to merge, or discard this patch.
src/Hal/Application/Rule/Validator.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
     public function validate($key, $value) {
63 63
         $rule = $this->ruleSet->getRule($key);
64 64
 
65
-        if(!is_array($rule) || !is_numeric($value)) {
65
+        if (!is_array($rule) || !is_numeric($value)) {
66 66
             return self::UNKNOWN;
67 67
         }
68 68
 
69 69
         // according order
70
-        if($rule[0] < $rule[2]) {
70
+        if ($rule[0] < $rule[2]) {
71 71
             // critical < warn < good
72
-            switch(true) {
72
+            switch (true) {
73 73
                 case $value < $rule[1]:
74 74
                     return self::CRITICAL;
75 75
                 case $value >= $rule[1] && $value < $rule[2]:
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
             }
80 80
         }
81 81
         // critical > warn > good
82
-        switch(true) {
82
+        switch (true) {
83 83
             case $value > $rule[1]:
84 84
                 return self::CRITICAL;
85 85
             case $value < $rule[2]:
Please login to merge, or discard this patch.
src/Hal/Application/Score/Calculator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
         $score = (($note - $bad) / ($good - $bad)) * $this->limit;
33 33
         $score = max(0, $score);
34
-        $score = min ($this->limit, $score);
34
+        $score = min($this->limit, $score);
35 35
         return round($score, 2);
36 36
     }
37 37
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
         $score = $this->limit - ($note - $good) / ($bad - $good) * $this->limit;
47 47
         $score = max(0, $score);
48
-        $score = min ($this->limit, $score);
48
+        $score = min($this->limit, $score);
49 49
         return round($score, 2);
50 50
     }
51 51
 }
52 52
\ No newline at end of file
Please login to merge, or discard this patch.
src/Hal/Application/Score/Result.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
  *
17 17
  * @author Jean-François Lépine <https://twitter.com/Halleck45>
18 18
  */
19
-class Result implements ScoreInterface{
19
+class Result implements ScoreInterface {
20 20
 
21 21
     /**
22 22
      * @var array
Please login to merge, or discard this patch.