Completed
Pull Request — master (#211)
by personal
03:19
created
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 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@
 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;
6
-  exit(1);
5
+    echo '[ERROR] It\'s required to run "composer install" before building PhpMetrics!' . PHP_EOL;
6
+    exit(1);
7 7
 }
8 8
 
9 9
 $filename = 'build/phpmetrics.phar';
Please login to merge, or discard this 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.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,9 @@
 block discarded – undo
19 19
 $files = array_merge(rglob('*.php'), rglob('*.twig'), rglob('*.json'), rglob('*.pp'));
20 20
 $exclude = '!(.git)|(.svn)|(bin)|(tests)|(Tests)|(phpmetrics)!';
21 21
 foreach($files as $file) {
22
-    if(preg_match($exclude, $file)) continue;
22
+    if(preg_match($exclude, $file)) {
23
+        continue;
24
+    }
23 25
     $path = str_replace(__DIR__.'/', '', $file);
24 26
     $phar->addFromString($path, file_get_contents($file));
25 27
 }
Please login to merge, or discard this patch.
src/Hal/Component/OOP/Extractor/Searcher.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
     {
31 31
         $end = sizeof($tokens, COUNT_NORMAL);
32 32
         $value = '';
33
-        while($startingToken < $end) {
33
+        while ($startingToken < $end) {
34 34
             $token = $tokens[$startingToken];
35
-            if(in_array($token->getValue(), $delimiters)) {
35
+            if (in_array($token->getValue(), $delimiters)) {
36 36
                 return $value;
37 37
             }
38 38
             $value .= $token->getValue();
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
     public function getPrevious(&$startingToken, TokenCollection $tokens)
53 53
     {
54 54
         $p = $startingToken - 1;
55
-        for($i = $p ; $i > 0; $i--) {
56
-            if(T_WHITESPACE !== $tokens[$i]->getType()) {
55
+        for ($i = $p; $i > 0; $i--) {
56
+            if (T_WHITESPACE !== $tokens[$i]->getType()) {
57 57
                 return $tokens[$i];
58 58
             }
59 59
         }
@@ -88,19 +88,19 @@  discard block
 block discarded – undo
88 88
         $openBrace = 0;
89 89
         $start = null;
90 90
         $len = sizeof($tokens);
91
-        for($i = $startingToken; $i < $len; $i++) {
91
+        for ($i = $startingToken; $i < $len; $i++) {
92 92
             $token = $tokens[$i];
93
-            if(T_STRING == $token->getType()) {
94
-                switch($token->getValue()) {
93
+            if (T_STRING == $token->getType()) {
94
+                switch ($token->getValue()) {
95 95
                     case '{':
96 96
                         $openBrace++;
97
-                        if(is_null($start)) {
97
+                        if (is_null($start)) {
98 98
                             $start = $startingToken = $i + 1;
99 99
                         }
100 100
                         break;
101 101
                     case '}':
102 102
                         $openBrace--;
103
-                        if($openBrace <= 0) {
103
+                        if ($openBrace <= 0) {
104 104
                             return $i;
105 105
                         }
106 106
                         break;
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
      */
120 120
     public function getExtendPosition(TokenCollection $tokens, $startingToken)
121 121
     {
122
-        for($i = $startingToken; $i > 0; $i--) {
122
+        for ($i = $startingToken; $i > 0; $i--) {
123 123
             $token = $tokens[$i];
124 124
             if ($token->getValue() === 'extends') {
125 125
                 return $i;
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
     public function getClassNamePosition(TokenCollection $tokens)
137 137
     {
138 138
         $len = sizeof($tokens);
139
-        for($i = 0; $i < $len; $i++) {
139
+        for ($i = 0; $i < $len; $i++) {
140 140
             $token = $tokens[$i];
141 141
             if ($token->getValue() === 'class') {
142 142
                 return $i;
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
      */
156 156
     public function getPositionOfPrevious($tokenType, $startingToken, TokenCollection $tokens)
157 157
     {
158
-        for($i = $startingToken; $i > 0; $i--) {
159
-            if($tokenType == $tokens->get($i)->getType()) {
158
+        for ($i = $startingToken; $i > 0; $i--) {
159
+            if ($tokenType == $tokens->get($i)->getType()) {
160 160
                 return $i;
161 161
             }
162 162
         }
@@ -174,8 +174,8 @@  discard block
 block discarded – undo
174 174
     public function getPositionOfNext($tokenType, $startingToken, TokenCollection $tokens) 
175 175
     {
176 176
         $len = sizeof($tokens);
177
-        for($i = $startingToken; $i < $len; $i++) {
178
-            if($tokenType == $tokens->get($i)->getType()) {
177
+        for ($i = $startingToken; $i < $len; $i++) {
178
+            if ($tokenType == $tokens->get($i)->getType()) {
179 179
                 return $i;
180 180
             }
181 181
         }
Please login to merge, or discard this patch.
src/Hal/Component/Token/Dumper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,13 +26,13 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/Hal/Component/OOP/Extractor/Extractor.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/Hal/Application/Config/ConfigValidator.php 2 patches
Unused Use Statements   -4 removed lines patch added patch discarded remove patch
@@ -9,10 +9,6 @@
 block discarded – undo
9 9
 
10 10
 namespace Hal\Application\Config;
11 11
 use Hal\Component\Chart\Graphviz;
12
-use Hal\Component\Config\Hydrator;
13
-use Hal\Component\Config\Loader;
14
-use Hal\Component\Config\Validator;
15
-use Symfony\Component\Console\Input\InputInterface;
16 12
 
17 13
 /**
18 14
  * Config checker
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,9 +27,9 @@
 block discarded – undo
27 27
     public function validates(Configuration $config)
28 28
     {
29 29
         // graphviz
30
-        if($config->getLogging()->getChart('bubbles')) {
30
+        if ($config->getLogging()->getChart('bubbles')) {
31 31
             $graphviz = new Graphviz();
32
-            if(!$graphviz->isAvailable()) {
32
+            if (!$graphviz->isAvailable()) {
33 33
                 throw new \RuntimeException('Graphviz not installed');
34 34
             }
35 35
         }
Please login to merge, or discard this patch.
src/Hal/Component/Chart/Graphviz.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
      */
36 36
     public function getImage($dotContent) {
37 37
 
38
-        if(!$this->isAvailable()) {
38
+        if (!$this->isAvailable()) {
39 39
             throw new \RuntimeException('Graphviz not installed');
40 40
         }
41 41
 
Please login to merge, or discard this patch.