Completed
Pull Request — master (#221)
by personal
04:09
created
src/Hal/Metrics/Complexity/Structural/CardAndAgresti/SystemComplexity.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
 
38 38
         $sy = $dc = $sc = array(); // in system
39
-        foreach($class->getMethods() as $method) {
39
+        foreach ($class->getMethods() as $method) {
40 40
             $fanout = sizeof($method->getDependencies(), COUNT_NORMAL);
41 41
             $v = sizeof($method->getArguments(), COUNT_NORMAL) + sizeof($method->getReturns(), COUNT_NORMAL);
42 42
 
Please login to merge, or discard this patch.
src/Hal/Metrics/Complexity/Text/Length/Result.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
      * @inheritdoc
50 50
      */
51 51
     public function asArray() {
52
-        return array (
52
+        return array(
53 53
             'loc' => $this->getLoc()
54 54
             ,'logicalLoc' => $this->getLogicalLoc()
55 55
         );
Please login to merge, or discard this patch.
Hal/Metrics/Design/Component/MaintainabilityIndex/MaintainabilityIndex.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 
50 50
 
51 51
         // comment weight
52
-        if($rLoc->getLoc() > 0) {
52
+        if ($rLoc->getLoc() > 0) {
53 53
             $CM = $rLoc->getCommentLoc() / $rLoc->getLoc();
54 54
             $result->setCommentWeight(
55 55
                 50 * sin(sqrt(2.4 * $CM))
Please login to merge, or discard this patch.
src/Hal/Metrics/Design/Component/MaintainabilityIndex/Result.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,10 +60,10 @@
 block discarded – undo
60 60
      */
61 61
     public function setMaintainabilityIndexWithoutComment($maintainabilityIndexWithoutComment)
62 62
     {
63
-        if(is_infinite($maintainabilityIndexWithoutComment)) {
63
+        if (is_infinite($maintainabilityIndexWithoutComment)) {
64 64
             $maintainabilityIndexWithoutComment = 171;
65 65
         }
66
-        $this->maintainabilityIndexWithoutComment = round($maintainabilityIndexWithoutComment,2);
66
+        $this->maintainabilityIndexWithoutComment = round($maintainabilityIndexWithoutComment, 2);
67 67
 
68 68
     }
69 69
     /**
Please login to merge, or discard this patch.
src/Hal/Metrics/Complexity/Component/McCabe/Result.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
      * @inheritdoc
50 50
      */
51 51
     public function asArray() {
52
-        return array (
52
+        return array(
53 53
             'loc' => $this->getLoc()
54 54
             ,'logicalLoc' => $this->getLogicalLoc()
55 55
         );
Please login to merge, or discard this patch.
src/Hal/Metrics/Complexity/Component/Myer/Result.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
      * @inheritdoc
50 50
      */
51 51
     public function asArray() {
52
-        return array (
52
+        return array(
53 53
             'loc' => $this->getLoc()
54 54
             ,'logicalLoc' => $this->getLogicalLoc()
55 55
         );
Please login to merge, or discard this patch.
src/Hal/Metrics/Complexity/Structural/LCOM/Result.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
      * @inheritdoc
50 50
      */
51 51
     public function asArray() {
52
-        return array (
52
+        return array(
53 53
             'loc' => $this->getLoc()
54 54
             ,'logicalLoc' => $this->getLogicalLoc()
55 55
         );
Please login to merge, or discard this patch.
artifacts/phar/build.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 chdir(__DIR__);
3 3
 
4 4
 if (!file_exists('vendor/autoload.php')) {
5
-  echo '[ERROR] It\'s required to run "composer install" before building PhpMetrics!' . PHP_EOL;
5
+  echo '[ERROR] It\'s required to run "composer install" before building PhpMetrics!'.PHP_EOL;
6 6
   exit(1);
7 7
 }
8 8
 
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
 
19 19
 $files = array_merge(rglob('*.php'), rglob('*.twig'), rglob('*.json'), rglob('*.pp'));
20 20
 $exclude = '!(.git)|(.svn)|(bin)|(tests)|(Tests)|(phpmetrics)!';
21
-foreach($files as $file) {
22
-    if(preg_match($exclude, $file)) continue;
21
+foreach ($files as $file) {
22
+    if (preg_match($exclude, $file)) continue;
23 23
     $path = str_replace(__DIR__.'/', '', $file);
24 24
     $phar->addFromString($path, file_get_contents($file));
25 25
 }
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
 
51 51
 chmod($filename, 0755);
52 52
 
53
-function rglob($pattern='*', $flags = 0, $path='')
53
+function rglob($pattern = '*', $flags = 0, $path = '')
54 54
 {
55
-    $paths=glob($path.'*', GLOB_MARK|GLOB_ONLYDIR|GLOB_NOSORT);
56
-    $files=glob($path.$pattern, $flags);
57
-    foreach ($paths as $path) { $files=array_merge($files,rglob($pattern, $flags, $path)); }
55
+    $paths = glob($path.'*', GLOB_MARK|GLOB_ONLYDIR|GLOB_NOSORT);
56
+    $files = glob($path.$pattern, $flags);
57
+    foreach ($paths as $path) { $files = array_merge($files, rglob($pattern, $flags, $path)); }
58 58
     return $files;
59 59
 }
60 60
\ No newline at end of file
Please login to merge, or discard this patch.
src/Hal/Metrics/Complexity/Text/Halstead/Halstead.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
     /**
60 60
      * Inventories tokens
61 61
      *
62
-     * @param array $tokens
62
+     * @param \SplFixedArray $tokens
63 63
      * @return $this
64 64
      */
65 65
     private function inventory($tokens)
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
     {
67 67
         $this->operators = $this->operands = array();
68 68
 
69
-        foreach($tokens as $token) {
70
-            if($this->tokenType->isOperator($token)) {
69
+        foreach ($tokens as $token) {
70
+            if ($this->tokenType->isOperator($token)) {
71 71
                 $this->operators[] = $token;
72 72
             }
73
-            else if($this->tokenType->isOperand($token)) {
73
+            else if ($this->tokenType->isOperand($token)) {
74 74
                 $this->operands[] = $token;
75 75
             }
76 76
         }
@@ -93,23 +93,23 @@  discard block
 block discarded – undo
93 93
         $this->inventory($class->getTokens());
94 94
         $result = new Result;
95 95
 
96
-        $uniqueOperators = array_map( 'unserialize', array_unique( array_map( 'serialize', $this->operators ) ) );
97
-        $uniqueOperands = array_map( 'unserialize', array_unique( array_map( 'serialize', $this->operands ) ) );
96
+        $uniqueOperators = array_map('unserialize', array_unique(array_map('serialize', $this->operators)));
97
+        $uniqueOperands = array_map('unserialize', array_unique(array_map('serialize', $this->operands)));
98 98
 
99 99
         $n1 = sizeof($uniqueOperators, COUNT_NORMAL);
100 100
         $n2 = sizeof($uniqueOperands, COUNT_NORMAL);
101 101
         $N1 = sizeof($this->operators, COUNT_NORMAL);
102 102
         $N2 = sizeof($this->operands, COUNT_NORMAL);
103 103
 
104
-        if(($n2 == 0)||($N2 == 0)) {
104
+        if (($n2 == 0) || ($N2 == 0)) {
105 105
             // files without operators
106 106
             $V = $n1 = $n2 = $N1 = $N2 = $E = $D = $B = $T = $I = $L = 0;
107 107
         } else {
108 108
             $devAbility = 3000;
109 109
             $N = $N1 + $N2;
110 110
             $n = $n1 + $n2;
111
-            $V = $N * log($n ,2);
112
-            $L = (2 / max(1,$n1)) * ($n2 / $N2);
111
+            $V = $N * log($n, 2);
112
+            $L = (2 / max(1, $n1)) * ($n2 / $N2);
113 113
             $D = ($n1 / 2) * ($N2 / $n2);
114 114
             $E = $V * $D;
115 115
             $B = $V / $devAbility;
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
         $result
121 121
             ->setLength($N1 + $N2)
122 122
             ->setVocabulary($n1 + $n2)
123
-            ->setVolume(round($V,2))
124
-            ->setDifficulty(round($D,2))
125
-            ->setEffort(round($E,2))
123
+            ->setVolume(round($V, 2))
124
+            ->setDifficulty(round($D, 2))
125
+            ->setEffort(round($E, 2))
126 126
             ->setLevel(round($L, 2))
127 127
             ->setBugs(round($B, 2))
128 128
             ->setTime(round($T))
129
-            ->setIntelligentContent(round($I,2))
129
+            ->setIntelligentContent(round($I, 2))
130 130
             ->setNumberOfOperators($N1)
131 131
             ->setNumberOfOperands($N2)
132 132
             ->setNumberOfUniqueOperators($n1)
Please login to merge, or discard this patch.