@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | * Extracts visibility |
| 134 | 134 | * |
| 135 | 135 | * @param ReflectedMethod $method |
| 136 | - * @param $n |
|
| 136 | + * @param integer $n |
|
| 137 | 137 | * @param TokenCollection $tokens |
| 138 | 138 | * @return $this |
| 139 | 139 | */ |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * Extracts state |
| 159 | 159 | * |
| 160 | 160 | * @param ReflectedMethod $method |
| 161 | - * @param $n |
|
| 161 | + * @param integer $n |
|
| 162 | 162 | * @param TokenCollection $tokens |
| 163 | 163 | * @return $this |
| 164 | 164 | */ |
@@ -262,6 +262,7 @@ discard block |
||
| 262 | 262 | * Extract the list of returned values |
| 263 | 263 | * |
| 264 | 264 | * @param ReflectedMethod $method |
| 265 | + * @param integer $n |
|
| 265 | 266 | * @return $this |
| 266 | 267 | */ |
| 267 | 268 | private function extractReturns(ReflectedMethod $method, $n, TokenCollection $tokens) { |
@@ -11,7 +11,6 @@ |
||
| 11 | 11 | use Hal\Component\OOP\Reflected\MethodUsage; |
| 12 | 12 | use Hal\Component\OOP\Reflected\ReflectedArgument; |
| 13 | 13 | use Hal\Component\OOP\Reflected\ReflectedClass; |
| 14 | -use Hal\Component\OOP\Reflected\ReflectedClass\ReflectedAnonymousClass; |
|
| 15 | 14 | use Hal\Component\OOP\Reflected\ReflectedMethod; |
| 16 | 15 | use Hal\Component\OOP\Reflected\ReflectedReturn; |
| 17 | 16 | use Hal\Component\OOP\Resolver\TypeResolver; |
@@ -145,7 +145,7 @@ |
||
| 145 | 145 | case $this->searcher->isPrecededBy(T_PROTECTED, $n, $tokens, 4): |
| 146 | 146 | $visibility = ReflectedMethod::VISIBILITY_PROTECTED; |
| 147 | 147 | break; |
| 148 | - case $this->searcher->isPrecededBy(T_PUBLIC, $n, $tokens, 4): |
|
| 148 | + case $this->searcher->isPrecededBy(T_PUBLIC, $n, $tokens, 4): |
|
| 149 | 149 | default: |
| 150 | 150 | $visibility = ReflectedMethod::VISIBILITY_PUBLIC; |
| 151 | 151 | break; |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $start = $n; |
| 56 | 56 | |
| 57 | 57 | $declaration = $this->searcher->getUnder(array(')'), $n, $tokens); |
| 58 | - if(!preg_match('!function\s+(.*)\(\s*(.*)!is', $declaration, $matches)) { |
|
| 58 | + if (!preg_match('!function\s+(.*)\(\s*(.*)!is', $declaration, $matches)) { |
|
| 59 | 59 | throw new \Exception(sprintf("Closure detected instead of method\nDetails:\n%s", $declaration)); |
| 60 | 60 | } |
| 61 | 61 | list(, $name, $args) = $matches; |
@@ -68,21 +68,21 @@ discard block |
||
| 68 | 68 | $this->extractState($method, $p = $start, $tokens); // please keep "p = start" |
| 69 | 69 | |
| 70 | 70 | $arguments = preg_split('!\s*,\s*!m', $args); |
| 71 | - foreach($arguments as $argDecl) { |
|
| 71 | + foreach ($arguments as $argDecl) { |
|
| 72 | 72 | |
| 73 | - if(0 == strlen($argDecl)) { |
|
| 73 | + if (0 == strlen($argDecl)) { |
|
| 74 | 74 | continue; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $elems = preg_split('!([\s=]+)!', $argDecl); |
| 78 | 78 | $isRequired = 2 == sizeof($elems, COUNT_NORMAL); |
| 79 | 79 | |
| 80 | - if(sizeof($elems, COUNT_NORMAL) == 1) { |
|
| 80 | + if (sizeof($elems, COUNT_NORMAL) == 1) { |
|
| 81 | 81 | list($name, $type) = array_pad($elems, 2, null); |
| 82 | 82 | } else { |
| 83 | - if('$' == $elems[0][0]) { |
|
| 83 | + if ('$' == $elems[0][0]) { |
|
| 84 | 84 | $name = $elems[0]; |
| 85 | - $type = null; |
|
| 85 | + $type = null; |
|
| 86 | 86 | $isRequired = false; |
| 87 | 87 | } else { |
| 88 | 88 | list($type, $name) = array_pad($elems, 2, null); |
@@ -96,9 +96,9 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | |
| 98 | 98 | // does method has body ? (example: interface ; abstract classes) |
| 99 | - $p = $n + 1; |
|
| 99 | + $p = $n + 1; |
|
| 100 | 100 | $underComma = trim($this->searcher->getUnder(array(';'), $p, $tokens)); |
| 101 | - if(strlen($underComma) > 0) { |
|
| 101 | + if (strlen($underComma) > 0) { |
|
| 102 | 102 | // |
| 103 | 103 | // Body |
| 104 | 104 | $this->extractContent($method, $n, $tokens); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | // Tokens |
| 110 | 110 | $end = $this->searcher->getPositionOfClosingBrace($n, $tokens); |
| 111 | - if($end > 0) { |
|
| 111 | + if ($end > 0) { |
|
| 112 | 112 | $method->setTokens($tokens->extract($n, $end)); |
| 113 | 113 | } |
| 114 | 114 | } else { |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | * @return $this |
| 139 | 139 | */ |
| 140 | 140 | public function extractVisibility(ReflectedMethod $method, $n, TokenCollection $tokens) { |
| 141 | - switch(true) { |
|
| 141 | + switch (true) { |
|
| 142 | 142 | case $this->searcher->isPrecededBy(T_PRIVATE, $n, $tokens, 4): |
| 143 | 143 | $visibility = ReflectedMethod::VISIBILITY_PRIVATE; |
| 144 | 144 | break; |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | * @return $this |
| 164 | 164 | */ |
| 165 | 165 | public function extractState(ReflectedMethod $method, $n, TokenCollection $tokens) { |
| 166 | - if($this->searcher->isPrecededBy(T_STATIC, $n, $tokens, 4)) { |
|
| 166 | + if ($this->searcher->isPrecededBy(T_STATIC, $n, $tokens, 4)) { |
|
| 167 | 167 | $method->setState(ReflectedMethod::STATE_STATIC); |
| 168 | 168 | } |
| 169 | 169 | return $this; |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | */ |
| 180 | 180 | private function extractContent(ReflectedMethod $method, $n, TokenCollection $tokens) { |
| 181 | 181 | $end = $this->searcher->getPositionOfClosingBrace($n, $tokens); |
| 182 | - if($end > 0) { |
|
| 182 | + if ($end > 0) { |
|
| 183 | 183 | $collection = $tokens->extract($n, $end); |
| 184 | 184 | $method->setContent($collection->asString()); |
| 185 | 185 | } |
@@ -202,13 +202,13 @@ discard block |
||
| 202 | 202 | $extractor = new CallExtractor($this->searcher, $currentClass); |
| 203 | 203 | $start = $n; |
| 204 | 204 | $len = sizeof($tokens, COUNT_NORMAL); |
| 205 | - for($i = $start; $i < $len; $i++) { |
|
| 205 | + for ($i = $start; $i < $len; $i++) { |
|
| 206 | 206 | $token = $tokens[$i]; |
| 207 | - switch($token->getType()) { |
|
| 207 | + switch ($token->getType()) { |
|
| 208 | 208 | case T_PAAMAYIM_NEKUDOTAYIM: |
| 209 | 209 | case T_NEW: |
| 210 | 210 | $call = $extractor->extract($i, $tokens, $currentClass); |
| 211 | - if($call !== 'class') { // anonymous class |
|
| 211 | + if ($call !== 'class') { // anonymous class |
|
| 212 | 212 | $method->pushDependency($call); |
| 213 | 213 | $method->pushInstanciedClass($call); |
| 214 | 214 | } |
@@ -219,9 +219,9 @@ discard block |
||
| 219 | 219 | // |
| 220 | 220 | // Parameters in Method API |
| 221 | 221 | $resolver = new TypeResolver(); |
| 222 | - foreach($method->getArguments() as $argument) { |
|
| 222 | + foreach ($method->getArguments() as $argument) { |
|
| 223 | 223 | $name = $argument->getType(); |
| 224 | - if(strlen($name) > 0 && !$resolver->isNative($name)) { |
|
| 224 | + if (strlen($name) > 0 && !$resolver->isNative($name)) { |
|
| 225 | 225 | $method->pushDependency($name); |
| 226 | 226 | } |
| 227 | 227 | } |
@@ -240,10 +240,10 @@ discard block |
||
| 240 | 240 | private function extractCalls(ReflectedMethod $method, $n, TokenCollection $tokens) { |
| 241 | 241 | |
| 242 | 242 | // $this->foo(), $c->foo() |
| 243 | - if(preg_match_all('!(\$[\w]*)\-\>(\w*?)\(!', $method->getContent(), $matches, PREG_SET_ORDER)) { |
|
| 244 | - foreach($matches as $m) { |
|
| 243 | + if (preg_match_all('!(\$[\w]*)\-\>(\w*?)\(!', $method->getContent(), $matches, PREG_SET_ORDER)) { |
|
| 244 | + foreach ($matches as $m) { |
|
| 245 | 245 | $function = $m[2]; |
| 246 | - if('$this' == $m[1]) { |
|
| 246 | + if ('$this' == $m[1]) { |
|
| 247 | 247 | $method->pushInternalCall($function); |
| 248 | 248 | } else { |
| 249 | 249 | $method->pushExternalCall($m[1], $function); |
@@ -251,8 +251,8 @@ discard block |
||
| 251 | 251 | } |
| 252 | 252 | } |
| 253 | 253 | // (new X)->foo() |
| 254 | - if(preg_match_all('!\(new (\w+?).*?\)\->(\w+)\(!', $method->getContent(), $matches, PREG_SET_ORDER)) { |
|
| 255 | - foreach($matches as $m) { |
|
| 254 | + if (preg_match_all('!\(new (\w+?).*?\)\->(\w+)\(!', $method->getContent(), $matches, PREG_SET_ORDER)) { |
|
| 255 | + foreach ($matches as $m) { |
|
| 256 | 256 | $method->pushExternalCall($m[1], $m[2]); |
| 257 | 257 | } |
| 258 | 258 | } |
@@ -272,9 +272,9 @@ discard block |
||
| 272 | 272 | // we cannot use specific token. The ":" delimiter is a T_STRING token |
| 273 | 273 | // in regex we match ":" followed by any character except another ":" |
| 274 | 274 | $following = $this->searcher->getUnder(array('{', ';'), $n, $tokens); |
| 275 | - if(preg_match('@(?<!:):\s*(\w+)@', $following, $matches)) { |
|
| 275 | + if (preg_match('@(?<!:):\s*(\w+)@', $following, $matches)) { |
|
| 276 | 276 | $type = trim($matches[1]); |
| 277 | - if(empty($type)) { |
|
| 277 | + if (empty($type)) { |
|
| 278 | 278 | return $this; |
| 279 | 279 | } |
| 280 | 280 | $return = new ReflectedReturn($type, ReflectedReturn::VALUE_UNKNOW, ReflectedReturn::STRICT_TYPE_HINT); |
@@ -283,8 +283,8 @@ discard block |
||
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | // array of available values based on code |
| 286 | - if(preg_match_all('!([\s;]return\s|^return\s+)(.*?);!', $method->getContent(), $matches)) { |
|
| 287 | - foreach($matches[2] as $m) { |
|
| 286 | + if (preg_match_all('!([\s;]return\s|^return\s+)(.*?);!', $method->getContent(), $matches)) { |
|
| 287 | + foreach ($matches[2] as $m) { |
|
| 288 | 288 | $value = trim($m, ";\t\n\r\0\x0B"); |
| 289 | 289 | $return = new ReflectedReturn($resolver->resolve($m), $value, ReflectedReturn::ESTIMATED_TYPE_HINT); |
| 290 | 290 | $method->pushReturn($return); |
@@ -302,21 +302,21 @@ discard block |
||
| 302 | 302 | private function extractUsage(ReflectedMethod $method) { |
| 303 | 303 | $tokens = $method->getTokens(); |
| 304 | 304 | $codes = $values = array(); |
| 305 | - foreach($tokens as $token) { |
|
| 306 | - if(in_array($token->getType(), array(T_WHITESPACE, T_BOOL_CAST, T_INT_CAST, T_STRING_CAST, T_DOUBLE_CAST, T_OBJECT_CAST))) { |
|
| 305 | + foreach ($tokens as $token) { |
|
| 306 | + if (in_array($token->getType(), array(T_WHITESPACE, T_BOOL_CAST, T_INT_CAST, T_STRING_CAST, T_DOUBLE_CAST, T_OBJECT_CAST))) { |
|
| 307 | 307 | continue; |
| 308 | 308 | } |
| 309 | 309 | array_push($codes, $token->getType()); |
| 310 | 310 | array_push($values, $token->getValue()); |
| 311 | 311 | } |
| 312 | - switch(true) { |
|
| 313 | - case preg_match('!^(get)|(is)|(has).*!',$method->getName()) && $codes == array(T_RETURN, T_VARIABLE, T_OBJECT_OPERATOR, T_STRING, T_STRING): |
|
| 312 | + switch (true) { |
|
| 313 | + case preg_match('!^(get)|(is)|(has).*!', $method->getName()) && $codes == array(T_RETURN, T_VARIABLE, T_OBJECT_OPERATOR, T_STRING, T_STRING): |
|
| 314 | 314 | $method->setUsage(MethodUsage::USAGE_GETTER); |
| 315 | 315 | break; |
| 316 | 316 | // basic setter |
| 317 | - case preg_match('!^set.*!',$method->getName()) && $codes == array(T_VARIABLE, T_OBJECT_OPERATOR,T_STRING,T_STRING, T_VARIABLE, T_STRING) && $values[3] == '=': |
|
| 317 | + case preg_match('!^set.*!', $method->getName()) && $codes == array(T_VARIABLE, T_OBJECT_OPERATOR, T_STRING, T_STRING, T_VARIABLE, T_STRING) && $values[3] == '=': |
|
| 318 | 318 | // fluent setter |
| 319 | - case preg_match('!^set.*!',$method->getName()) && $codes == array(T_VARIABLE, T_OBJECT_OPERATOR,T_STRING,T_STRING, T_VARIABLE, T_STRING, T_RETURN, T_VARIABLE, T_STRING) |
|
| 319 | + case preg_match('!^set.*!', $method->getName()) && $codes == array(T_VARIABLE, T_OBJECT_OPERATOR, T_STRING, T_STRING, T_VARIABLE, T_STRING, T_RETURN, T_VARIABLE, T_STRING) |
|
| 320 | 320 | && $values[3] == '=' && $values[7] == '$this': |
| 321 | 321 | $method->setUsage(MethodUsage::USAGE_SETTER); |
| 322 | 322 | break; |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
| 166 | - * @return array |
|
| 166 | + * @return \Hal\Component\Token\TokenCollection |
|
| 167 | 167 | */ |
| 168 | 168 | public function getTokens() |
| 169 | 169 | { |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | /** |
| 368 | - * @param $class |
|
| 368 | + * @param string|null $class |
|
| 369 | 369 | * @return $this |
| 370 | 370 | */ |
| 371 | 371 | public function pushInstanciedClass($class) { |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | /** |
| 389 | - * @param $call |
|
| 389 | + * @param string $call |
|
| 390 | 390 | * @return $this |
| 391 | 391 | */ |
| 392 | 392 | public function pushInternalCall($call) |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | /** |
| 407 | - * @param $call |
|
| 407 | + * @param string $call |
|
| 408 | 408 | * @return $this |
| 409 | 409 | */ |
| 410 | 410 | public function pushExternalCall($call) |
@@ -189,10 +189,10 @@ discard block |
||
| 189 | 189 | // on read : compare with aliases. We cannot make it in pushDependency() => aliases aren't yet known |
| 190 | 190 | $result = array(); |
| 191 | 191 | $resolver = new TypeResolver(); |
| 192 | - foreach($this->returns as $return) { |
|
| 192 | + foreach ($this->returns as $return) { |
|
| 193 | 193 | $type = $this->nameResolver->resolve($return->getType(), null); |
| 194 | 194 | |
| 195 | - if("\\" !== $type[0] &&!$resolver->isNative($type)) { |
|
| 195 | + if ("\\" !== $type[0] && !$resolver->isNative($type)) { |
|
| 196 | 196 | $type = $this->namespace.'\\'.$type; |
| 197 | 197 | } |
| 198 | 198 | |
@@ -233,21 +233,21 @@ discard block |
||
| 233 | 233 | { |
| 234 | 234 | // on read : compare with aliases. We cannot make it in pushDependency() => aliases aren't yet known |
| 235 | 235 | $dependencies = array(); |
| 236 | - foreach($this->dependencies as $name) { |
|
| 236 | + foreach ($this->dependencies as $name) { |
|
| 237 | 237 | array_push($dependencies, $this->nameResolver->resolve($name, null)); |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | // returned values |
| 241 | 241 | $resolver = new TypeResolver(); |
| 242 | - foreach($this->returns as $return) { |
|
| 242 | + foreach ($this->returns as $return) { |
|
| 243 | 243 | $name = $return->getType(); |
| 244 | - if(!$resolver->isNative($name)) { |
|
| 244 | + if (!$resolver->isNative($name)) { |
|
| 245 | 245 | array_push($dependencies, $this->nameResolver->resolve($name, null)); |
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | // anonymous classes in method (inner class) |
| 250 | - foreach($this->anonymousClasses as $c) { |
|
| 250 | + foreach ($this->anonymousClasses as $c) { |
|
| 251 | 251 | array_push($dependencies, $c->getParent()); |
| 252 | 252 | $dependencies = array_merge($dependencies, $c->getDependencies()); |
| 253 | 253 | } |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | public function getInstanciedClasses() |
| 380 | 380 | { |
| 381 | 381 | $classes = array(); |
| 382 | - foreach($this->instanciedClasses as $name) { |
|
| 382 | + foreach ($this->instanciedClasses as $name) { |
|
| 383 | 383 | array_push($classes, $this->nameResolver->resolve($name, null)); |
| 384 | 384 | } |
| 385 | 385 | return $classes; |
@@ -83,7 +83,7 @@ |
||
| 83 | 83 | /** |
| 84 | 84 | * Clean php source |
| 85 | 85 | * |
| 86 | - * @param $content |
|
| 86 | + * @param string $content |
|
| 87 | 87 | * @return string |
| 88 | 88 | */ |
| 89 | 89 | private function cleanup($content) { |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | public function __construct(Cache $cache = null) |
| 28 | 28 | { |
| 29 | - if(null == $cache) { |
|
| 29 | + if (null == $cache) { |
|
| 30 | 30 | $cache = new CacheNull(); |
| 31 | 31 | } |
| 32 | 32 | $this->cache = $cache; |
@@ -41,13 +41,13 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public function tokenize($filename) { |
| 43 | 43 | |
| 44 | - if($this->cache->has($filename)) { |
|
| 44 | + if ($this->cache->has($filename)) { |
|
| 45 | 45 | return new TokenCollection($this->cache->get($filename)); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | $size = filesize($filename); |
| 49 | 49 | $limit = 102400; // around 100 Ko |
| 50 | - if($size > $limit) { |
|
| 50 | + if ($size > $limit) { |
|
| 51 | 51 | $tokens = $this->tokenizeLargeFile($filename); |
| 52 | 52 | } else { |
| 53 | 53 | $tokens = token_get_all($this->cleanup(file_get_contents($filename))); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | EOT; |
| 75 | 75 | $output = shell_exec('php -r \''.$code.'\''); |
| 76 | 76 | $tokens = unserialize($output); |
| 77 | - if(false === $tokens) { |
|
| 77 | + if (false === $tokens) { |
|
| 78 | 78 | throw new NoTokenizableException(sprintf('Cannot tokenize "%s". This file is probably too big. Please try to increase memory_limit', $filename)); |
| 79 | 79 | } |
| 80 | 80 | return $tokens; |
@@ -2,8 +2,8 @@ |
||
| 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'; |
@@ -2,7 +2,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
@@ -19,7 +19,9 @@ |
||
| 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 | } |
@@ -1,4 +1,4 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // PHP 7 |
| 3 | -defined('T_SPACESHIP') ||define('T_SPACESHIP', '<=>'); // 289 |
|
| 4 | -defined('T_COALESCE') ||define('T_COALESCE', '??'); // 282 |
|
| 5 | 3 | \ No newline at end of file |
| 4 | +defined('T_SPACESHIP') || define('T_SPACESHIP', '<=>'); // 289 |
|
| 5 | +defined('T_COALESCE') || define('T_COALESCE', '??'); // 282 |
|
| 6 | 6 | \ No newline at end of file |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | |
| 48 | 48 | public function execute(array $files) { |
| 49 | 49 | $object = new FileSystemComplexity($this->classMap); |
| 50 | - foreach($files as $filename) { |
|
| 50 | + foreach ($files as $filename) { |
|
| 51 | 51 | $result = $object->calculate($filename); |
| 52 | 52 | $this->collection->get($filename)->setSystemComplexity($result); |
| 53 | 53 | } |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | |
| 52 | 52 | // link between coupling and files |
| 53 | 53 | $fileCoupling = new FileCoupling($this->classMap, $couplingMap); |
| 54 | - foreach($files as $filename) { |
|
| 54 | + foreach ($files as $filename) { |
|
| 55 | 55 | $rCoupling = $fileCoupling->calculate($filename); |
| 56 | 56 | $this->collection->get($filename)->setCoupling($rCoupling); |
| 57 | 57 | } |
@@ -134,7 +134,7 @@ |
||
| 134 | 134 | ->setHalstead($rHalstead) |
| 135 | 135 | ->setMaintainabilityIndex($rMaintainability); |
| 136 | 136 | |
| 137 | - if($this->withOOP) { |
|
| 137 | + if ($this->withOOP) { |
|
| 138 | 138 | $rOOP = $this->extractor->extract($filename); |
| 139 | 139 | $this->classMap->push($filename, $rOOP); |
| 140 | 140 | $resultSet->setOOP($rOOP); |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | |
| 48 | 48 | public function execute(array $files) { |
| 49 | 49 | $fileCoupling = new FileLackOfCohesionOfMethods($this->classMap); |
| 50 | - foreach($files as $filename) { |
|
| 50 | + foreach ($files as $filename) { |
|
| 51 | 51 | $result = $fileCoupling->calculate($filename); |
| 52 | 52 | $this->collection->get($filename)->setLcom($result); |
| 53 | 53 | } |