@@ -36,7 +36,7 @@ |
||
36 | 36 | |
37 | 37 | // get latest version |
38 | 38 | $latest = '0.0.0'; |
39 | - foreach ((array)$json->package->versions as $version => $datas) { |
|
39 | + foreach ((array) $json->package->versions as $version => $datas) { |
|
40 | 40 | $version = preg_replace('([^\.\d])', '', $version); |
41 | 41 | if (!preg_match('!\d+\.\d+\.\d+!', $version)) { |
42 | 42 | continue; |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | if (!preg_match('/composer\.json|composer-dist\.json/', $filename)) { |
50 | 50 | continue; |
51 | 51 | } |
52 | - $datas = (object)json_decode(file_get_contents($filename)); |
|
52 | + $datas = (object) json_decode(file_get_contents($filename)); |
|
53 | 53 | |
54 | 54 | if (!isset($datas->require)) { |
55 | 55 | continue; |
56 | 56 | } |
57 | 57 | |
58 | - $rawRequirements = array_merge($rawRequirements, (array)$datas->require); |
|
58 | + $rawRequirements = array_merge($rawRequirements, (array) $datas->require); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | $packagist = new Packagist(); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | $package = $packagist->get($requirement); |
65 | 65 | |
66 | - $packages[$requirement] = (object)array( |
|
66 | + $packages[$requirement] = (object) array( |
|
67 | 67 | 'name' => $requirement, |
68 | 68 | 'required' => $version, |
69 | 69 | 'latest' => $package->latest, |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php require __DIR__ . '/_header.php'; ?> |
|
1 | +<?php require __DIR__.'/_header.php'; ?> |
|
2 | 2 | <div class="row"> |
3 | 3 | <div class="column"> |
4 | 4 | <div class="bloc bloc-number"> |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | <tbody id="contentClassRank" class="clusterize-content"> |
96 | 96 | <?php |
97 | 97 | $classesS = $classes; |
98 | - usort($classesS, function ($a, $b) { |
|
98 | + usort($classesS, function($a, $b) { |
|
99 | 99 | return strcmp($b['pageRank'], $a['pageRank']); |
100 | 100 | }); |
101 | 101 | //$classesS = array_slice($classesS, 0, 10); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | <tbody id="contentPackages" class="clusterize-content"> |
134 | 134 | <?php |
135 | 135 | $packages = isset($project['composer'], $project['composer']['packages']) ? $project['composer']['packages'] : []; |
136 | - usort($packages, function ($a, $b) { |
|
136 | + usort($packages, function($a, $b) { |
|
137 | 137 | return strcmp($a->name, $b->name); |
138 | 138 | }); |
139 | 139 | foreach ($packages as $package) { ?> |
@@ -141,15 +141,15 @@ discard block |
||
141 | 141 | <td><?php echo $package->name; ?></td> |
142 | 142 | <td><?php echo $package->required; ?></td> |
143 | 143 | <td><?php echo $package->latest; ?></td> |
144 | - <td><?php foreach($package->license as $license) { ?> |
|
145 | - <a target="_blank" href="https://spdx.org/licenses/<?php echo $license;?>.html"><?php echo $license;?></a> |
|
144 | + <td><?php foreach ($package->license as $license) { ?> |
|
145 | + <a target="_blank" href="https://spdx.org/licenses/<?php echo $license; ?>.html"><?php echo $license; ?></a> |
|
146 | 146 | <?php }; ?> |
147 | 147 | </td> |
148 | 148 | </tr> |
149 | 149 | <?php } ?> |
150 | 150 | </tbody> |
151 | 151 | </table> |
152 | - <?php if(0 === sizeof($packages)) { ?> |
|
152 | + <?php if (0 === sizeof($packages)) { ?> |
|
153 | 153 | <div>No composer.json file found</div> |
154 | 154 | <?php } ?> |
155 | 155 | </div> |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | <div class="column"> |
161 | 161 | <div class="bloc bloc-number"> |
162 | 162 | <div class="label">Licences of Composer dependencies</div> |
163 | - <?php if(0 === sizeof($packages)) { ?> |
|
163 | + <?php if (0 === sizeof($packages)) { ?> |
|
164 | 164 | <div>No composer.json file found</div> |
165 | 165 | <?php } ?> |
166 | 166 | <div id="svg-licenses"></div> |
@@ -199,9 +199,9 @@ discard block |
||
199 | 199 | } |
200 | 200 | } |
201 | 201 | ?> |
202 | - chartLicenses(<?php echo json_encode(array_values($json));?>); |
|
202 | + chartLicenses(<?php echo json_encode(array_values($json)); ?>); |
|
203 | 203 | } |
204 | 204 | }; |
205 | 205 | </script> |
206 | 206 | |
207 | -<?php require __DIR__ . '/_footer.php'; ?> |
|
208 | 207 | \ No newline at end of file |
208 | +<?php require __DIR__.'/_footer.php'; ?> |
|
209 | 209 | \ No newline at end of file |
@@ -62,7 +62,7 @@ |
||
62 | 62 | $code = preg_replace('!/\*.*?\*/!s', '', $code); |
63 | 63 | |
64 | 64 | // count and remove single line comments |
65 | - $code = preg_replace_callback('!(\'[^\']*\'|"[^"]*")|((?:#|\/\/).*$)!m', function (array $matches) use (&$cloc) { |
|
65 | + $code = preg_replace_callback('!(\'[^\']*\'|"[^"]*")|((?:#|\/\/).*$)!m', function(array $matches) use (&$cloc) { |
|
66 | 66 | if (isset($matches[2])) { |
67 | 67 | $cloc += 1; |
68 | 68 | } |
@@ -71,14 +71,14 @@ |
||
71 | 71 | $files = array(); |
72 | 72 | foreach ($paths as $path) { |
73 | 73 | if (is_dir($path)) { |
74 | - $path = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; |
|
74 | + $path = rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; |
|
75 | 75 | $directory = new RecursiveDirectoryIterator($path, $this->flags); |
76 | 76 | $iterator = new RecursiveIteratorIterator($directory); |
77 | 77 | |
78 | 78 | $filterRegex = sprintf( |
79 | 79 | '`^%s%s$`', |
80 | - !empty($this->excludedDirs) ? '((?!' . preg_quote(implode('|', $this->excludedDirs)) . ').)+' : '.+', |
|
81 | - '\.(' . implode('|', $this->extensions) . ')' |
|
80 | + !empty($this->excludedDirs) ? '((?!'.preg_quote(implode('|', $this->excludedDirs)).').)+' : '.+', |
|
81 | + '\.('.implode('|', $this->extensions).')' |
|
82 | 82 | ); |
83 | 83 | |
84 | 84 | $filteredIterator = new RegexIterator( |
@@ -17,7 +17,6 @@ |
||
17 | 17 | public static function getName(Node $node) |
18 | 18 | { |
19 | 19 | return ($node instanceof Node\Stmt\Class_ && $node->isAnonymous()) ? |
20 | - 'anonymous@' . spl_object_hash($node) : |
|
21 | - $node->namespacedName->toString(); |
|
20 | + 'anonymous@'.spl_object_hash($node) : $node->namespacedName->toString(); |
|
22 | 21 | } |
23 | 22 | } |
@@ -62,20 +62,20 @@ discard block |
||
62 | 62 | // extends |
63 | 63 | if (isset($node->extends)) { |
64 | 64 | if (is_array($node->extends)) { |
65 | - foreach ((array)$node->extends as $interface) { |
|
66 | - array_push($dependencies, (string)$interface); |
|
67 | - array_push($parents, (string)$interface); |
|
65 | + foreach ((array) $node->extends as $interface) { |
|
66 | + array_push($dependencies, (string) $interface); |
|
67 | + array_push($parents, (string) $interface); |
|
68 | 68 | } |
69 | 69 | } else { |
70 | - array_push($dependencies, (string)$node->extends); |
|
71 | - array_push($parents, (string)$node->extends); |
|
70 | + array_push($dependencies, (string) $node->extends); |
|
71 | + array_push($parents, (string) $node->extends); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
75 | 75 | // implements |
76 | 76 | if (isset($node->implements)) { |
77 | 77 | foreach ($node->implements as $interface) { |
78 | - array_push($dependencies, (string)$interface); |
|
78 | + array_push($dependencies, (string) $interface); |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | // return |
85 | 85 | if (isset($stmt->returnType)) { |
86 | 86 | if ($stmt->returnType instanceof Node\Name\FullyQualified) { |
87 | - array_push($dependencies, (string)$stmt->returnType); |
|
87 | + array_push($dependencies, (string) $stmt->returnType); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
@@ -92,13 +92,13 @@ discard block |
||
92 | 92 | foreach ($stmt->params as $param) { |
93 | 93 | if ($param->type) { |
94 | 94 | if ($param->type instanceof Node\Name\FullyQualified) { |
95 | - array_push($dependencies, (string)$param->type); |
|
95 | + array_push($dependencies, (string) $param->type); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | } |
99 | 99 | |
100 | 100 | // instantiations, static calls |
101 | - \iterate_over_node($stmt, function ($node) use (&$dependencies) { |
|
101 | + \iterate_over_node($stmt, function($node) use (&$dependencies) { |
|
102 | 102 | switch (true) { |
103 | 103 | case $node instanceof Node\Expr\New_: |
104 | 104 | // new MyClass |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | foreach ($matches[1] as $check) { |
118 | 118 | foreach ($this->uses as $use) { |
119 | 119 | if ($use->alias === $check) { |
120 | - array_push($dependencies, (string)($use->name)); |
|
120 | + array_push($dependencies, (string) ($use->name)); |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 | } |
@@ -44,7 +44,7 @@ |
||
44 | 44 | return; |
45 | 45 | } |
46 | 46 | if (!file_exists(dirname($logFile)) || !is_writable(dirname($logFile))) { |
47 | - throw new \RuntimeException('You don\'t have permissions to write CSV report in ' . $logFile); |
|
47 | + throw new \RuntimeException('You don\'t have permissions to write CSV report in '.$logFile); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | $availables = (new Registry())->allForStructures(); |
@@ -42,7 +42,7 @@ |
||
42 | 42 | return; |
43 | 43 | } |
44 | 44 | if (!file_exists(dirname($logFile)) || !is_writable(dirname($logFile))) { |
45 | - throw new \RuntimeException('You don\'t have permissions to write JSON report in ' . $logFile); |
|
45 | + throw new \RuntimeException('You don\'t have permissions to write JSON report in '.$logFile); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | file_put_contents($logFile, json_encode($metrics, JSON_PRETTY_PRINT)); |