@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function summaryStatistic(array $statistic); |
25 | 25 | |
26 | - public function makeAdvancedStatistic(array $files, array $metrics=[]); |
|
26 | + public function makeAdvancedStatistic(array $files, array $metrics = []); |
|
27 | 27 | |
28 | 28 | public function errorList():array; |
29 | 29 | |
@@ -33,5 +33,5 @@ discard block |
||
33 | 33 | * @param array $metrics |
34 | 34 | * @return array |
35 | 35 | */ |
36 | - public function makeCommonStatistic(array $files, array $metrics=[]):array; |
|
36 | + public function makeCommonStatistic(array $files, array $metrics = []):array; |
|
37 | 37 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @return array |
66 | 66 | * @see \insolita\codestat\CodeStatModule::$groupRules |
67 | 67 | */ |
68 | - public function makeAdvancedStatistic(array $files, array $metrics=[]):array |
|
68 | + public function makeAdvancedStatistic(array $files, array $metrics = []):array |
|
69 | 69 | { |
70 | 70 | foreach ($this->reflectionGenerator($this->classGenerator($files)) as $reflection) { |
71 | 71 | $this->groups->fill($reflection); |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | continue; |
77 | 77 | } |
78 | 78 | $result = (new Analyser())->countFiles($group->getFiles(), false); |
79 | - foreach ($result as $key =>$value){ |
|
80 | - if(!empty($metrics) && !in_array($key, $metrics, true)){ |
|
79 | + foreach ($result as $key =>$value) { |
|
80 | + if (!empty($metrics) && !in_array($key, $metrics, true)) { |
|
81 | 81 | continue; |
82 | 82 | } |
83 | 83 | $statistic[$group->getName()][] = ['Metric'=>$key, 'Value'=>$value]; |
@@ -93,12 +93,12 @@ discard block |
||
93 | 93 | * @param array $metrics |
94 | 94 | * @return array |
95 | 95 | */ |
96 | - public function makeCommonStatistic(array $files, array $metrics=[]):array |
|
96 | + public function makeCommonStatistic(array $files, array $metrics = []):array |
|
97 | 97 | { |
98 | 98 | $statistic = []; |
99 | 99 | $result = (new Analyser())->countFiles($files, false); |
100 | - foreach ($result as $key =>$value){ |
|
101 | - if(!empty($metrics) && !in_array($key, $metrics, true)){ |
|
100 | + foreach ($result as $key =>$value) { |
|
101 | + if (!empty($metrics) && !in_array($key, $metrics, true)) { |
|
102 | 102 | continue; |
103 | 103 | } |
104 | 104 | $statistic[] = ['Metric'=>$key, 'Value'=>$value]; |
@@ -54,13 +54,13 @@ discard block |
||
54 | 54 | $this->headline('YII-2 Code Statistic', 'lightYellow'); |
55 | 55 | $this->climate->table($summary); |
56 | 56 | |
57 | - if($showErrors !== true){ |
|
57 | + if ($showErrors !== true) { |
|
58 | 58 | return ExitCode::OK; |
59 | 59 | } |
60 | 60 | $this->headline('Failed for resolve', 'lightYellow'); |
61 | - if(!count($service->errorList())){ |
|
61 | + if (!count($service->errorList())) { |
|
62 | 62 | $this->climate->info('Errors not found'); |
63 | - }else{ |
|
63 | + } else { |
|
64 | 64 | $this->climate->table($service->errorList()); |
65 | 65 | } |
66 | 66 | return ExitCode::OK; |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | $statistic = $service->makeAdvancedStatistic($this->module->prepareFiles(), $this->module->metrics); |
78 | 78 | $this->headline('YII-2 Code Statistic', 'green'); |
79 | 79 | |
80 | - if($groupName !==null){ |
|
81 | - if(!isset($statistic[$groupName])){ |
|
82 | - $this->stderr('Undefined group '.$groupName); |
|
80 | + if ($groupName !== null) { |
|
81 | + if (!isset($statistic[$groupName])) { |
|
82 | + $this->stderr('Undefined group ' . $groupName); |
|
83 | 83 | return ExitCode::DATAERR; |
84 | 84 | } |
85 | 85 | $this->headline($groupName, 'lightYellow'); |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | return ExitCode::OK; |
88 | 88 | } |
89 | 89 | |
90 | - foreach ($statistic as $group =>$data){ |
|
90 | + foreach ($statistic as $group =>$data) { |
|
91 | 91 | $this->headline($group, 'lightYellow'); |
92 | 92 | $this->climate->table($data); |
93 | - if(!$this->confirm('Show next group?')){ |
|
93 | + if (!$this->confirm('Show next group?')) { |
|
94 | 94 | break; |
95 | 95 | } |
96 | 96 | } |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | { |
120 | 120 | $service = $this->module->statService; |
121 | 121 | $dir = \Yii::getAlias($dir); |
122 | - if(!is_dir($dir)){ |
|
123 | - $this->stderr('Directory not found by path '.$dir); |
|
122 | + if (!is_dir($dir)) { |
|
123 | + $this->stderr('Directory not found by path ' . $dir); |
|
124 | 124 | return ExitCode::UNSPECIFIED_ERROR; |
125 | 125 | } |
126 | 126 | $statistic = $service->makeCommonStatistic(FileHelper::findFiles($dir, [ |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | { |
143 | 143 | $service = $this->module->statService; |
144 | 144 | $filePath = \Yii::getAlias($filePath); |
145 | - if(!file_exists($filePath)){ |
|
146 | - $this->stderr('File not found by path '.$filePath); |
|
145 | + if (!file_exists($filePath)) { |
|
146 | + $this->stderr('File not found by path ' . $filePath); |
|
147 | 147 | return ExitCode::UNSPECIFIED_ERROR; |
148 | 148 | } |
149 | 149 | $statistic = $service->makeCommonStatistic([$filePath], $this->module->metrics); |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $value = $this->wrap($value, 'light_cyan'); |
177 | 177 | } |
178 | 178 | $key = $this->wrap($key, 'green'); |
179 | - $colorized[$i][$key] = (string)$value; |
|
179 | + $colorized[$i][$key] = (string) $value; |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 | return $colorized; |
@@ -86,7 +86,7 @@ |
||
86 | 86 | * List of phploc metrics showed for advanced, common, directory and file actions, by default all available metrics |
87 | 87 | * will be showed |
88 | 88 | * @var array |
89 | - */ |
|
89 | + */ |
|
90 | 90 | public $metrics = []; |
91 | 91 | |
92 | 92 | public function init() |