@@ -16,9 +16,7 @@ |
||
16 | 16 | namespace Kadet\Highlighter\bin\Commands\Benchmark; |
17 | 17 | |
18 | 18 | |
19 | -use Kadet\Highlighter\Formatter\FormatterInterface; |
|
20 | 19 | use Kadet\Highlighter\KeyLighter; |
21 | -use Kadet\Highlighter\Language\Language; |
|
22 | 20 | use Symfony\Component\Console\Command\Command; |
23 | 21 | use Symfony\Component\Console\Helper\Table; |
24 | 22 | use Symfony\Component\Console\Helper\TableCell; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $this->separator($file, $table); |
50 | 50 | |
51 | 51 | foreach ($data['times'] as $set => $times) { |
52 | - $result = array_map(function ($time) use ($data, $input) { |
|
52 | + $result = array_map(function($time) use ($data, $input) { |
|
53 | 53 | return $input->getOption('relative') ? $data['size'] / $time : $time * 1000; |
54 | 54 | }, $times); |
55 | 55 | |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | foreach ($data['memory'] as $set => $memory) { |
66 | - $result = array_map(function ($memory) use ($data, $input) { |
|
67 | - $bytes = $input->getOption('relative') ? $memory/$data['size'] : $memory; |
|
66 | + $result = array_map(function($memory) use ($data, $input) { |
|
67 | + $bytes = $input->getOption('relative') ? $memory / $data['size'] : $memory; |
|
68 | 68 | return $this->formatBytes($bytes, (bool)$input->getOption('relative')); |
69 | 69 | }, $memory); |
70 | 70 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | }, ARRAY_FILTER_USE_KEY); |
82 | 82 | |
83 | 83 | $max = max(array_map('strlen', array_keys($summary))); |
84 | - foreach($summary as $name => $set) { |
|
84 | + foreach ($summary as $name => $set) { |
|
85 | 85 | $output->writeln(sprintf( |
86 | 86 | "<comment>%s</comment> %s %s", |
87 | 87 | str_pad($name, $max, ' ', STR_PAD_LEFT), |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | { |
131 | 131 | $mean = array_sum($result) / count($result); |
132 | 132 | |
133 | - return sqrt(array_sum(array_map(function ($result) use ($mean) { |
|
133 | + return sqrt(array_sum(array_map(function($result) use ($mean) { |
|
134 | 134 | return pow($result - $mean, 2); |
135 | 135 | }, $result)) / count($result)); |
136 | 136 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | $bytes /= (1 << (10 * $pow)); |
146 | 146 | |
147 | - return $this->format($bytes);//.$units[$pow].($relative ? '/byte' : ''); |
|
147 | + return $this->format($bytes); //.$units[$pow].($relative ? '/byte' : ''); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | protected function configure() |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | protected function execute(InputInterface $input, OutputInterface $output) |
33 | 33 | { |
34 | - $dir = __DIR__ . 'BenchmarkCommand.php/' .static::DIRECTORY; |
|
34 | + $dir = __DIR__.'BenchmarkCommand.php/'.static::DIRECTORY; |
|
35 | 35 | $iterator = new \RecursiveIteratorIterator( |
36 | 36 | new \RecursiveDirectoryIterator( |
37 | 37 | $dir, |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | |
69 | 69 | $times = []; |
70 | 70 | $memory = []; |
71 | - for($i = $input->getOption('times'); $i > 0; $i--) { |
|
71 | + for ($i = $input->getOption('times'); $i > 0; $i--) { |
|
72 | 72 | $result = $this->benchmark($source, $language, $formatter); |
73 | 73 | $times = array_merge_recursive($times, $result['times']); |
74 | 74 | $memory = array_merge_recursive($memory, $result['memory']); |
75 | 75 | |
76 | - if($input->getOption('geshi') && class_exists('GeSHi')) { |
|
76 | + if ($input->getOption('geshi') && class_exists('GeSHi')) { |
|
77 | 77 | $times['geshi'][] = $this->geshi($source, $file->getExtension()); |
78 | 78 | } |
79 | 79 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | { |
173 | 173 | $result = json_encode($results, $input->getOption('pretty') ? JSON_PRETTY_PRINT : 0); |
174 | 174 | |
175 | - if($input->hasArgument('output')) { |
|
175 | + if ($input->hasArgument('output')) { |
|
176 | 176 | file_put_contents($input->getArgument('output'), $result); |
177 | 177 | } else { |
178 | 178 | $output->write($result); |