@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | $score = (($note - $bad) / ($good - $bad)) * $this->limit; |
33 | 33 | $score = max(0, $score); |
34 | - $score = min ($this->limit, $score); |
|
34 | + $score = min($this->limit, $score); |
|
35 | 35 | return round($score, 2); |
36 | 36 | } |
37 | 37 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | $score = $this->limit - ($note - $good) / ($bad - $good) * $this->limit; |
47 | 47 | $score = max(0, $score); |
48 | - $score = min ($this->limit, $score); |
|
48 | + $score = min($this->limit, $score); |
|
49 | 49 | return round($score, 2); |
50 | 50 | } |
51 | 51 | } |
52 | 52 | \ No newline at end of file |
@@ -16,7 +16,7 @@ |
||
16 | 16 | * |
17 | 17 | * @author Jean-François Lépine <https://twitter.com/Halleck45> |
18 | 18 | */ |
19 | -class Result implements ScoreInterface{ |
|
19 | +class Result implements ScoreInterface { |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * @var array |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @author Jean-François Lépine <https://twitter.com/Halleck45> |
25 | 25 | */ |
26 | -class Scoring implements ScoringInterface{ |
|
26 | +class Scoring implements ScoringInterface { |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Maximal score |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | // score |
68 | 68 | $result = new Result; |
69 | - foreach($factors as $qualityFactor) { |
|
69 | + foreach ($factors as $qualityFactor) { |
|
70 | 70 | $score = $qualityFactor->calculate($collection, $groupedResults, $bound); |
71 | 71 | $result->push($qualityFactor->getName(), $score); |
72 | 72 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function aggregates(ResultCollection $results) { |
42 | 42 | $array = array(); |
43 | - foreach($results as $result) { |
|
43 | + foreach ($results as $result) { |
|
44 | 44 | $basename = dirname($result->getFilename()); |
45 | 45 | |
46 | 46 | // from 'folder1/folder2/file.php', we want an array with ('folder1', 'folder1/folder2') |
@@ -49,14 +49,14 @@ discard block |
||
49 | 49 | return $v; |
50 | 50 | }, array()); |
51 | 51 | |
52 | - if($this->depth) { |
|
52 | + if ($this->depth) { |
|
53 | 53 | array_splice($namespaces, $this->depth); |
54 | 54 | } |
55 | 55 | |
56 | 56 | // merge infos for each namespace in the DirectoryResultCollection |
57 | - foreach($namespaces as $namespace) { |
|
57 | + foreach ($namespaces as $namespace) { |
|
58 | 58 | |
59 | - if(!isset($array[$namespace])) { |
|
59 | + if (!isset($array[$namespace])) { |
|
60 | 60 | $array[$namespace] = new ResultCollection(); |
61 | 61 | } |
62 | 62 |
@@ -41,35 +41,35 @@ |
||
41 | 41 | */ |
42 | 42 | public function aggregates(ResultCollection $results) { |
43 | 43 | $array = new ResultCollection(); |
44 | - foreach($results as $result) { |
|
44 | + foreach ($results as $result) { |
|
45 | 45 | $basename = dirname($result->getFilename()); |
46 | 46 | |
47 | 47 | // from 'folder1/folder2/file.php', we want an array with ('folder1', 'folder2') |
48 | 48 | $namespaces = explode(DIRECTORY_SEPARATOR, $basename); |
49 | 49 | |
50 | - if($this->depth) { |
|
50 | + if ($this->depth) { |
|
51 | 51 | array_splice($namespaces, $this->depth); |
52 | 52 | } |
53 | 53 | |
54 | 54 | // merge infos for each namespace in the DirectoryResultCollection |
55 | 55 | $len = sizeof($namespaces, COUNT_NORMAL); |
56 | 56 | |
57 | - for($i = 0; $i < $len; $i++) { |
|
57 | + for ($i = 0; $i < $len; $i++) { |
|
58 | 58 | |
59 | 59 | $namespace = $namespaces[$i]; |
60 | - if(0 === strlen($namespace)) { |
|
60 | + if (0 === strlen($namespace)) { |
|
61 | 61 | $namespace = '.'; |
62 | 62 | } |
63 | 63 | |
64 | - if(0 === $i) { |
|
64 | + if (0 === $i) { |
|
65 | 65 | // root |
66 | - if(!isset($array[$namespace])) { |
|
66 | + if (!isset($array[$namespace])) { |
|
67 | 67 | $array[$namespace] = new ResultCollection(); |
68 | 68 | } |
69 | 69 | $parent = &$array[$namespace]; |
70 | 70 | } else { |
71 | 71 | // namespace |
72 | - if(!isset($parent[$namespace])) { |
|
72 | + if (!isset($parent[$namespace])) { |
|
73 | 73 | $parent[$namespace] = new ResultCollection(); // ResultRecursiveCollection -> has getOOP(), etc. |
74 | 74 | } |
75 | 75 | $parent = &$parent[$namespace]; |
@@ -28,12 +28,12 @@ |
||
28 | 28 | $arrayMerged = call_user_func_array('array_merge_recursive', $array); |
29 | 29 | |
30 | 30 | $min = $max = $average = $sum = array(); |
31 | - foreach($arrayMerged as $key => $values) { |
|
31 | + foreach ($arrayMerged as $key => $values) { |
|
32 | 32 | $values = (array) $values; |
33 | 33 | $max[$key] = max($values); |
34 | 34 | $min[$key] = min($values); |
35 | 35 | $sum[$key] = array_sum($values); |
36 | - $average[$key] = round($sum[$key] / count($values, COUNT_NORMAL),2); |
|
36 | + $average[$key] = round($sum[$key] / count($values, COUNT_NORMAL), 2); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | return new BoundsResult($min, $max, $average, $sum); |
@@ -52,10 +52,10 @@ |
||
52 | 52 | */ |
53 | 53 | public function __construct($min, $max, $average, $sum) |
54 | 54 | { |
55 | - $this->min = $min; |
|
56 | - $this->max = $max; |
|
57 | - $this->average = $average; |
|
58 | - $this->sum = $sum; |
|
55 | + $this->min = $min; |
|
56 | + $this->max = $max; |
|
57 | + $this->average = $average; |
|
58 | + $this->sum = $sum; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -110,7 +110,7 @@ |
||
110 | 110 | */ |
111 | 111 | public function get($type, $key) |
112 | 112 | { |
113 | - switch($type) { |
|
113 | + switch ($type) { |
|
114 | 114 | case 'max': |
115 | 115 | return $this->getMax($key); |
116 | 116 | case 'sum': |
@@ -53,7 +53,7 @@ |
||
53 | 53 | ; |
54 | 54 | |
55 | 55 | $config |
56 | - ->setRuleSet(new RuleSet( (array) $array['rules'])) |
|
56 | + ->setRuleSet(new RuleSet((array) $array['rules'])) |
|
57 | 57 | ->setFailureCondition($array['failure']) |
58 | 58 | ->setPath($path) |
59 | 59 | ->setLogging(new LoggingConfiguration($array['logging'])) |
@@ -43,7 +43,7 @@ |
||
43 | 43 | */ |
44 | 44 | public function load($filename) { |
45 | 45 | |
46 | - if(!\file_exists($filename) ||!\is_readable($filename)) { |
|
46 | + if (!\file_exists($filename) || !\is_readable($filename)) { |
|
47 | 47 | throw new \RuntimeException('configuration file is not accessible'); |
48 | 48 | } |
49 | 49 | $content = file_get_contents($filename); |