@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php require __DIR__ . '/_header.php'; ?> |
|
1 | +<?php require __DIR__.'/_header.php'; ?> |
|
2 | 2 | |
3 | 3 | <div class="row"> |
4 | 4 | <div class="column"> |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | </div> |
40 | 40 | |
41 | -<?php require __DIR__ . '/_footer.php'; ?> |
|
41 | +<?php require __DIR__.'/_footer.php'; ?> |
|
42 | 42 | |
43 | 43 | |
44 | 44 | <script type="text/javascript"> |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -require __DIR__ . '/_header.php'; ?> |
|
2 | +require __DIR__.'/_header.php'; ?> |
|
3 | 3 | |
4 | 4 | <?php |
5 | 5 | |
@@ -88,4 +88,4 @@ discard block |
||
88 | 88 | </div> |
89 | 89 | |
90 | 90 | |
91 | -<?php require __DIR__ . '/_footer.php'; ?> |
|
92 | 91 | \ No newline at end of file |
92 | +<?php require __DIR__.'/_footer.php'; ?> |
|
93 | 93 | \ No newline at end of file |
@@ -44,30 +44,30 @@ discard block |
||
44 | 44 | $nbInterfaces = 0; |
45 | 45 | foreach ($metrics->all() as $key => $item) { |
46 | 46 | if ($item instanceof ClassMetric) { |
47 | - $classes[] = $item->all();; |
|
47 | + $classes[] = $item->all(); ; |
|
48 | 48 | } |
49 | 49 | if ($item instanceof InterfaceMetric) { |
50 | 50 | $nbInterfaces++; |
51 | 51 | } |
52 | 52 | if ($item instanceof FunctionMetric) { |
53 | - $functions[$key] = $item->all();; |
|
53 | + $functions[$key] = $item->all(); ; |
|
54 | 54 | } |
55 | 55 | if ($item instanceof FileMetric) { |
56 | - $files[$key] = $item->all();; |
|
56 | + $files[$key] = $item->all(); ; |
|
57 | 57 | } |
58 | 58 | if ($item instanceof ProjectMetric) { |
59 | - $project[$key] = $item->all();; |
|
59 | + $project[$key] = $item->all(); ; |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | 63 | // sums |
64 | - $sum = (object)[ |
|
64 | + $sum = (object) [ |
|
65 | 65 | 'loc' => 0, |
66 | 66 | 'cloc' => 0, |
67 | 67 | 'lloc' => 0, |
68 | 68 | 'nbMethods' => 0, |
69 | 69 | ]; |
70 | - $avg = (object)[ |
|
70 | + $avg = (object) [ |
|
71 | 71 | 'ccn' => [], |
72 | 72 | 'bugs' => [], |
73 | 73 | 'kanDefect' => [], |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $violations[$name]++; |
129 | 129 | } |
130 | 130 | } |
131 | - $sum->violations = (object)$violations; |
|
131 | + $sum->violations = (object) $violations; |
|
132 | 132 | |
133 | 133 | |
134 | 134 | $this->avg = $avg; |
@@ -60,18 +60,18 @@ discard block |
||
60 | 60 | // extends |
61 | 61 | if (isset($node->extends)) { |
62 | 62 | if (is_array($node->extends)) { |
63 | - foreach ((array)$node->extends as $interface) { |
|
64 | - array_push($dependencies, (string)$interface); |
|
63 | + foreach ((array) $node->extends as $interface) { |
|
64 | + array_push($dependencies, (string) $interface); |
|
65 | 65 | } |
66 | 66 | } else { |
67 | - array_push($dependencies, (string)$node->extends); |
|
67 | + array_push($dependencies, (string) $node->extends); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
71 | 71 | // implements |
72 | 72 | if (isset($node->implements)) { |
73 | 73 | foreach ($node->implements as $interface) { |
74 | - array_push($dependencies, (string)$interface); |
|
74 | + array_push($dependencies, (string) $interface); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
@@ -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 | - array_push($dependencies, (string)$stmt->returnType); |
|
85 | + array_push($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 | - array_push($dependencies, (string)$param->type); |
|
93 | + array_push($dependencies, (string) $param->type); |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | } |
97 | 97 | |
98 | 98 | // instanciations, 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,7 +115,7 @@ discard block |
||
115 | 115 | foreach ($matches[1] as $check) { |
116 | 116 | foreach ($this->uses as $use) { |
117 | 117 | if ($use->alias === $check) { |
118 | - array_push($dependencies, (string)($use->name)); |
|
118 | + array_push($dependencies, (string) ($use->name)); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | } |
@@ -56,7 +56,7 @@ |
||
56 | 56 | $operands = []; |
57 | 57 | $operators = []; |
58 | 58 | |
59 | - iterate_over_node($node, function ($node) use (&$operators, &$operands) { |
|
59 | + iterate_over_node($node, function($node) use (&$operators, &$operands) { |
|
60 | 60 | |
61 | 61 | if ( |
62 | 62 | $node instanceof Node\Expr\BinaryOp |
@@ -52,7 +52,7 @@ |
||
52 | 52 | $output = 0; |
53 | 53 | $fanout = []; |
54 | 54 | |
55 | - iterate_over_node($node, function ($node) use (&$output, &$fanout) { |
|
55 | + iterate_over_node($node, function($node) use (&$output, &$fanout) { |
|
56 | 56 | switch (true) { |
57 | 57 | case $node instanceof Stmt\Return_: |
58 | 58 | $output++; |
@@ -45,12 +45,12 @@ discard block |
||
45 | 45 | foreach ($node->stmts as $stmt) { |
46 | 46 | if ($stmt instanceof Stmt\ClassMethod) { |
47 | 47 | |
48 | - if (!$graph->has($stmt->name . '()')) { |
|
49 | - $graph->insert(new TreeNode($stmt->name . '()')); |
|
48 | + if (!$graph->has($stmt->name.'()')) { |
|
49 | + $graph->insert(new TreeNode($stmt->name.'()')); |
|
50 | 50 | } |
51 | - $from = $graph->get($stmt->name . '()'); |
|
51 | + $from = $graph->get($stmt->name.'()'); |
|
52 | 52 | |
53 | - \iterate_over_node($stmt, function ($node) use ($from, &$graph) { |
|
53 | + \iterate_over_node($stmt, function($node) use ($from, &$graph) { |
|
54 | 54 | |
55 | 55 | if ($node instanceof Node\Expr\PropertyFetch && isset($node->var->name) && $node->var->name == 'this') { |
56 | 56 | $name = getNameOfNode($node); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | if (!$node->var instanceof Node\Expr\New_ && isset($node->var->name) && getNameOfNode($node->var) === 'this') { |
69 | 69 | // use of method call $this->xxx(); |
70 | 70 | // use of attribute $this->xxx; |
71 | - $name = getNameOfNode($node->name) . '()'; |
|
71 | + $name = getNameOfNode($node->name).'()'; |
|
72 | 72 | if (!$graph->has($name)) { |
73 | 73 | $graph->insert(new TreeNode($name)); |
74 | 74 | } |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | $select = $while = $if = 0; |
44 | 44 | |
45 | - iterate_over_node($node, function ($node) use (&$while, &$select, &$if) { |
|
45 | + iterate_over_node($node, function($node) use (&$while, &$select, &$if) { |
|
46 | 46 | switch (true) { |
47 | 47 | case $node instanceof Stmt\Do_: |
48 | 48 | case $node instanceof Stmt\Foreach_: |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | } |
59 | 59 | }); |
60 | 60 | |
61 | - $defect = 0.15 + 0.23 * $while + 0.22 * $select + 0.07 * $if; |
|
61 | + $defect = 0.15 + 0.23 * $while + 0.22 * $select + 0.07 * $if; |
|
62 | 62 | $class->set('kanDefect', round($defect, 2)); |
63 | 63 | } |
64 | 64 | } |
@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace Hal\Metric\Class_\Complexity; |
3 | 3 | |
4 | -use Hal\Component\Reflected\Method; |
|
5 | 4 | use Hal\Metric\Metrics; |
6 | 5 | use PhpParser\Node; |
7 | 6 | use PhpParser\Node\Stmt; |
@@ -51,7 +51,7 @@ |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | $r = shell_exec(sprintf('%s --version', $bin)); |
54 | - if(!preg_match('!git version!', $r)) { |
|
54 | + if (!preg_match('!git version!', $r)) { |
|
55 | 55 | throw new ConfigException(sprintf('Git binary (%s) incorrect', $bin)); |
56 | 56 | } |
57 | 57 |