@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | </div> |
2 | 2 | |
3 | 3 | <!-- Sidebar --> |
4 | -<?php if(!isset($fullwidth) || $fullwidth === false) {?> |
|
4 | +<?php if (!isset($fullwidth) || $fullwidth === false) {?> |
|
5 | 5 | <div id="sidebar"> |
6 | 6 | <div class="content"> |
7 | 7 | <div class="logo"> |
8 | - <a href="https://github.com/phpmetrics/phpmetrics"><img src="<?php echo $this->assetPath;?>images/phpmetrics-maintenability.png" |
|
8 | + <a href="https://github.com/phpmetrics/phpmetrics"><img src="<?php echo $this->assetPath; ?>images/phpmetrics-maintenability.png" |
|
9 | 9 | alt="Logo PhpMetrics"/></a> |
10 | 10 | <h1>PhpMetrics</h1> |
11 | 11 | </div> |
@@ -28,10 +28,10 @@ discard block |
||
28 | 28 | <path d="M0 0h24v24H0z" fill="none"/> |
29 | 29 | <path d="M20 8h-2.81c-.45-.78-1.07-1.45-1.82-1.96L17 4.41 15.59 3l-2.17 2.17C12.96 5.06 12.49 5 12 5c-.49 0-.96.06-1.41.17L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20V8zm-6 8h-4v-2h4v2zm0-4h-4v-2h4v2z"/> |
30 | 30 | </svg> |
31 | - Violations (<?php echo $sum->violations->total;?>) |
|
31 | + Violations (<?php echo $sum->violations->total; ?>) |
|
32 | 32 | </a> |
33 | 33 | </li> |
34 | - <?php if($this->isHomePage()) {?> |
|
34 | + <?php if ($this->isHomePage()) {?> |
|
35 | 35 | <li> |
36 | 36 | <a href="composer.html"> |
37 | 37 | <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white" width="24px" height="24px"><path d="M0 0h24v24H0z" fill="none"/><path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg> |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | </a> |
40 | 40 | </li> |
41 | 41 | <?php } ?> |
42 | - <?php if($this->isHomePage() && $config->has('junit')) { ?> |
|
42 | + <?php if ($this->isHomePage() && $config->has('junit')) { ?> |
|
43 | 43 | <li> |
44 | 44 | <a href="junit.html"> |
45 | 45 | <svg fill="#FFFFFF" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"> |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | Package relations |
134 | 134 | </a> |
135 | 135 | </li> |
136 | - <?php if($this->isHomePage() && $config->has('git')) { ?> |
|
136 | + <?php if ($this->isHomePage() && $config->has('git')) { ?> |
|
137 | 137 | <li> |
138 | 138 | <a href="git.html"> |
139 | 139 | <img src="images/logo-git.png" alt=""> |
@@ -22,7 +22,7 @@ |
||
22 | 22 | $registry = new Registry(); |
23 | 23 | $allowedKeys = array_merge($allowedKeys, $registry->allForStructures()); |
24 | 24 | |
25 | - $diff = array_diff(array_keys((array)$config), $allowedKeys); |
|
25 | + $diff = array_diff(array_keys((array) $config), $allowedKeys); |
|
26 | 26 | if (count($diff) > 0) { |
27 | 27 | throw new ConfigException( |
28 | 28 | sprintf( |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | public function __construct($name, array $config) |
27 | 27 | { |
28 | 28 | $this->name = $name; |
29 | - $this->config = (object)$config; |
|
29 | + $this->config = (object) $config; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | |
48 | 48 | public function matches(Metric $metric) |
49 | 49 | { |
50 | - $configAsArray = (array)$this->config; |
|
50 | + $configAsArray = (array) $this->config; |
|
51 | 51 | |
52 | 52 | if (!empty($this->config->type)) { |
53 | 53 | // Does the search concerns type ? |
@@ -118,14 +118,14 @@ discard block |
||
118 | 118 | |
119 | 119 | private function matchExpectedName(Metric $metric, $expectedName) |
120 | 120 | { |
121 | - return preg_match('@' . $expectedName . '@i', $metric->getName()); |
|
121 | + return preg_match('@'.$expectedName.'@i', $metric->getName()); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | private function matchInstanceOf(Metric $metric, $instanceOf) |
125 | 125 | { |
126 | 126 | foreach ($instanceOf as $expectedInterface) { |
127 | 127 | $expectedInterface = ltrim($expectedInterface, '\\'); |
128 | - if (!in_array($expectedInterface, (array)$metric->get('implements'))) { |
|
128 | + if (!in_array($expectedInterface, (array) $metric->get('implements'))) { |
|
129 | 129 | return false; |
130 | 130 | } |
131 | 131 | } |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | private function usesClasses(Metric $metric, $usesClasses) |
137 | 137 | { |
138 | 138 | foreach ($usesClasses as $expectedClass) { |
139 | - foreach ((array)$metric->get('externals') as $use) { |
|
140 | - if (preg_match('@' . $expectedClass . '@i', $use)) { |
|
139 | + foreach ((array) $metric->get('externals') as $use) { |
|
140 | + if (preg_match('@'.$expectedClass.'@i', $use)) { |
|
141 | 141 | return true; |
142 | 142 | } |
143 | 143 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | private function matchesMetric(Metric $metric, $metricName, $metricValue) |
150 | 150 | { |
151 | 151 | if (!preg_match_all('!^([=><]*)([\d\.]+)!', $metricValue, $matches, PREG_SET_ORDER)) { |
152 | - throw new \LogicException('Invalid search expression for key ' . $metricValue); |
|
152 | + throw new \LogicException('Invalid search expression for key '.$metricValue); |
|
153 | 153 | } |
154 | 154 | list(, $operator, $expected) = $matches[0]; |
155 | 155 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function writeln($message) |
27 | 27 | { |
28 | - $this->write(PHP_EOL . $message); |
|
28 | + $this->write(PHP_EOL.$message); |
|
29 | 29 | return $this; |
30 | 30 | } |
31 | 31 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | break; |
54 | 54 | } |
55 | 55 | |
56 | - $message = $color . $message . "\033[0m"; |
|
56 | + $message = $color.$message."\033[0m"; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | $this->quietMode || file_put_contents('php://stdout', $message); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | return |
97 | 97 | 0 >= version_compare( |
98 | 98 | '10.0.10586', |
99 | - PHP_WINDOWS_VERSION_MAJOR . '.' . PHP_WINDOWS_VERSION_MINOR . '.' . PHP_WINDOWS_VERSION_BUILD |
|
99 | + PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD |
|
100 | 100 | ) |
101 | 101 | || false !== getenv('ANSICON') |
102 | 102 | || 'ON' === getenv('ConEmuANSI') |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | private function resolvePath($path) |
46 | 46 | { |
47 | 47 | if (DIRECTORY_SEPARATOR !== $path[0]) { |
48 | - $path = dirname($this->filename) . DIRECTORY_SEPARATOR . $path; |
|
48 | + $path = dirname($this->filename).DIRECTORY_SEPARATOR.$path; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | return $path; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | // Composer |
80 | 80 | if (array_key_exists('composer', $jsonData)) { |
81 | - $config->set('composer', (bool)$jsonData['composer']); |
|
81 | + $config->set('composer', (bool) $jsonData['composer']); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | // Search |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | if (isset($jsonData['report']) && is_array($jsonData['report'])) { |
112 | 112 | foreach ($jsonData['report'] as $reportType => $path) { |
113 | 113 | $path = $this->resolvePath($path); |
114 | - $config->set('report-' . $reportType, $path); |
|
114 | + $config->set('report-'.$reportType, $path); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | } |
@@ -59,21 +59,21 @@ discard block |
||
59 | 59 | // extends |
60 | 60 | if (isset($node->extends)) { |
61 | 61 | if (is_array($node->extends)) { |
62 | - foreach ((array)$node->extends as $interface) { |
|
63 | - $this->pushToDependencies($dependencies, (string)$interface); |
|
64 | - array_push($parents, (string)$interface); |
|
62 | + foreach ((array) $node->extends as $interface) { |
|
63 | + $this->pushToDependencies($dependencies, (string) $interface); |
|
64 | + array_push($parents, (string) $interface); |
|
65 | 65 | } |
66 | 66 | } else { |
67 | - $this->pushToDependencies($dependencies, (string)$node->extends); |
|
68 | - array_push($parents, (string)$node->extends); |
|
67 | + $this->pushToDependencies($dependencies, (string) $node->extends); |
|
68 | + array_push($parents, (string) $node->extends); |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
72 | 72 | // implements |
73 | 73 | if (isset($node->implements)) { |
74 | 74 | foreach ($node->implements as $interface) { |
75 | - $this->pushToDependencies($dependencies, (string)$interface); |
|
76 | - array_push($interfaces, (string)$interface); |
|
75 | + $this->pushToDependencies($dependencies, (string) $interface); |
|
76 | + array_push($interfaces, (string) $interface); |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | // return |
83 | 83 | if (isset($stmt->returnType)) { |
84 | 84 | if ($stmt->returnType instanceof Node\Name\FullyQualified) { |
85 | - $this->pushToDependencies($dependencies, (string)$stmt->returnType); |
|
85 | + $this->pushToDependencies($dependencies, (string) $stmt->returnType); |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
@@ -90,13 +90,13 @@ discard block |
||
90 | 90 | foreach ($stmt->params as $param) { |
91 | 91 | if ($param->type) { |
92 | 92 | if ($param->type instanceof Node\Name\FullyQualified) { |
93 | - $this->pushToDependencies($dependencies, (string)$param->type); |
|
93 | + $this->pushToDependencies($dependencies, (string) $param->type); |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | } |
97 | 97 | |
98 | 98 | // instantiations, static calls |
99 | - \iterate_over_node($stmt, function ($node) use (&$dependencies) { |
|
99 | + \iterate_over_node($stmt, function($node) use (&$dependencies) { |
|
100 | 100 | switch (true) { |
101 | 101 | case $node instanceof Node\Expr\New_: |
102 | 102 | // new MyClass |
@@ -115,13 +115,13 @@ discard block |
||
115 | 115 | foreach ($matches[1] as $check) { |
116 | 116 | foreach ($this->uses as $use) { |
117 | 117 | if (method_exists($use, 'getAlias')) { |
118 | - if (((string)$use->getAlias()) === $check) { |
|
119 | - $this->pushToDependencies($dependencies, (string)($use->name)); |
|
118 | + if (((string) $use->getAlias()) === $check) { |
|
119 | + $this->pushToDependencies($dependencies, (string) ($use->name)); |
|
120 | 120 | } |
121 | 121 | continue; |
122 | 122 | } |
123 | 123 | if ($use->alias === $check) { |
124 | - $this->pushToDependencies($dependencies, (string)($use->name)); |
|
124 | + $this->pushToDependencies($dependencies, (string) ($use->name)); |
|
125 | 125 | } |
126 | 126 | } |
127 | 127 | } |
@@ -141,6 +141,6 @@ discard block |
||
141 | 141 | if ('self' === $lowercase || 'parent' === $lowercase) { |
142 | 142 | return; |
143 | 143 | } |
144 | - array_push($dependencies, (string)$dependency); |
|
144 | + array_push($dependencies, (string) $dependency); |
|
145 | 145 | } |
146 | 146 | } |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | continue; |
53 | 53 | } |
54 | 54 | |
55 | - if (!$graph->has($stmt->name . '()')) { |
|
56 | - $graph->insert(new TreeNode($stmt->name . '()')); |
|
55 | + if (!$graph->has($stmt->name.'()')) { |
|
56 | + $graph->insert(new TreeNode($stmt->name.'()')); |
|
57 | 57 | } |
58 | - $from = $graph->get($stmt->name . '()'); |
|
58 | + $from = $graph->get($stmt->name.'()'); |
|
59 | 59 | |
60 | - \iterate_over_node($stmt, function ($node) use ($from, &$graph) { |
|
60 | + \iterate_over_node($stmt, function($node) use ($from, &$graph) { |
|
61 | 61 | if ($node instanceof Node\Expr\PropertyFetch && isset($node->var->name) && $node->var->name == 'this') { |
62 | 62 | $name = getNameOfNode($node); |
63 | 63 | // use of attribute $this->xxx; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | if (!$node->var instanceof Node\Expr\New_ && isset($node->var->name) && getNameOfNode($node->var) === 'this') { |
74 | 74 | // use of method call $this->xxx(); |
75 | 75 | // use of attribute $this->xxx; |
76 | - $name = getNameOfNode($node->name) . '()'; |
|
76 | + $name = getNameOfNode($node->name).'()'; |
|
77 | 77 | if (!$graph->has($name)) { |
78 | 78 | $graph->insert(new TreeNode($name)); |
79 | 79 | } |
@@ -75,7 +75,7 @@ |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | // iterate over children, recursively |
78 | - $cb = function ($node) use (&$cb) { |
|
78 | + $cb = function($node) use (&$cb) { |
|
79 | 79 | $ccn = 0; |
80 | 80 | |
81 | 81 | foreach (get_object_vars($node) as $name => $member) { |
@@ -63,7 +63,7 @@ |
||
63 | 63 | ); |
64 | 64 | |
65 | 65 | $config = $this->config->get('searches')->get($searchName)->getConfig(); |
66 | - if(!empty($foundSearch) && !empty($config->failIfFound) && true === $config->failIfFound) { |
|
66 | + if (!empty($foundSearch) && !empty($config->failIfFound) && true === $config->failIfFound) { |
|
67 | 67 | $title = sprintf( |
68 | 68 | '<error>[ERR] Found %d occurrences for search "%s"</error>', |
69 | 69 | sizeof($foundSearch), |