@@ -60,10 +60,10 @@ |
||
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 | /** |
@@ -28,16 +28,16 @@ |
||
28 | 28 | |
29 | 29 | $ac = $cc = $abstractness = 0; |
30 | 30 | |
31 | - foreach($results as $result) { |
|
31 | + foreach ($results as $result) { |
|
32 | 32 | $rOOP = $result->getOOP(); |
33 | - if(is_object($rOOP)) { |
|
33 | + if (is_object($rOOP)) { |
|
34 | 34 | $cc += sizeof($rOOP->getConcreteClasses(), COUNT_NORMAL); |
35 | 35 | $ac += sizeof($rOOP->getAbstractClasses(), COUNT_NORMAL); |
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
39 | 39 | $result = new Result; |
40 | - if($ac + $cc > 0) { |
|
40 | + if ($ac + $cc > 0) { |
|
41 | 41 | $abstractness = round($ac / ($ac + $cc), 2); |
42 | 42 | } |
43 | 43 | $result->setAbstractness($abstractness); |
@@ -28,16 +28,16 @@ |
||
28 | 28 | |
29 | 29 | $ca = $ce = $i = 0; |
30 | 30 | |
31 | - foreach($results as $result) { |
|
31 | + foreach ($results as $result) { |
|
32 | 32 | $r = $result->getCoupling(); |
33 | - if(is_object($r)) { |
|
33 | + if (is_object($r)) { |
|
34 | 34 | $ce += $r->getEfferentCoupling(); |
35 | 35 | $ca += $r->getAfferentCoupling(); |
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
39 | 39 | $result = new Result; |
40 | - if($ca + $ce > 0) { |
|
40 | + if ($ca + $ce > 0) { |
|
41 | 41 | $i = round($ce / ($ca + $ce), 2); |
42 | 42 | } |
43 | 43 | $result->setInstability($i); |
@@ -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 | } |
@@ -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 | } |
@@ -49,7 +49,7 @@ |
||
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 | ); |
@@ -49,7 +49,7 @@ |
||
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 | ); |
@@ -49,7 +49,7 @@ |
||
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 | ); |
@@ -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 | } |