| Conditions | 12 | 
| Paths | 20 | 
| Total Lines | 60 | 
| Code Lines | 36 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php  | 
            ||
| 33 | protected function execute(InputInterface $input, OutputInterface $output)  | 
            ||
| 34 |     { | 
            ||
| 35 |         $json = json_decode(file_get_contents($input->getArgument('input')[0]), true); | 
            ||
| 36 | |||
| 37 | $output->writeln(sprintf(  | 
            ||
| 38 | "Date: <info>%s</info> Formatter: <info>%s</info>, Comment: <info>%s</info>",  | 
            ||
| 39 |             date('d.m.Y H:i:s', $json['timestamp']), $json['formatter'], isset($json['comment']) ? $json['comment'] : 'none' | 
            ||
| 40 | ));  | 
            ||
| 41 | |||
| 42 | $table = new Table($output);  | 
            ||
| 43 | |||
| 44 |         $suffix = $input->getOption('relative') ? 'bytes/s' : 'ms'; | 
            ||
| 45 | $table->addRow(['set', "min [$suffix]", "avg [$suffix]", "max [$suffix]", "std dev [$suffix]"]);  | 
            ||
| 46 | |||
| 47 | $summary = [];  | 
            ||
| 48 |         foreach ($json['results'] as $file => $data) { | 
            ||
| 49 | $this->separator($file, $table);  | 
            ||
| 50 | |||
| 51 |             foreach ($data['times'] as $set => $times) { | 
            ||
| 52 |                 $result = array_map(function ($time) use ($data, $input) { | 
            ||
| 53 |                     return $input->getOption('relative') ? $data['size'] / $time : $time * 1000; | 
            ||
| 54 | }, $times);  | 
            ||
| 55 | |||
| 56 | $this->entry($result, $set, $table);  | 
            ||
| 57 | |||
| 58 | $summary[$set][] = array_sum($result) / count($result);  | 
            ||
| 59 | }  | 
            ||
| 60 | |||
| 61 |             if (!isset($data['memory'])) { | 
            ||
| 62 | continue;  | 
            ||
| 63 | }  | 
            ||
| 64 | |||
| 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; | 
            ||
| 68 |                     return $this->formatBytes($bytes, (bool)$input->getOption('relative')); | 
            ||
| 69 | }, $memory);  | 
            ||
| 70 | |||
| 71 | $this->entry($result, $set, $table);  | 
            ||
| 72 | }  | 
            ||
| 73 | }  | 
            ||
| 74 | |||
| 75 | //        if(!$input->hasParameterOption('--summary')) { | 
            ||
| 76 | $table->render();  | 
            ||
| 77 | // }  | 
            ||
| 78 | |||
| 79 |         $summary = array_filter($summary, function($key) use ($input) { | 
            ||
| 80 |             return fnmatch($input->getOption('summary') ?: '*', $key); | 
            ||
| 81 | }, ARRAY_FILTER_USE_KEY);  | 
            ||
| 82 | |||
| 83 |         $max = max(array_map('strlen', array_keys($summary))); | 
            ||
| 84 |         foreach($summary as $name => $set) { | 
            ||
| 85 | $output->writeln(sprintf(  | 
            ||
| 86 | "<comment>%s</comment> %s %s",  | 
            ||
| 87 | str_pad($name, $max, ' ', STR_PAD_LEFT),  | 
            ||
| 88 |                 $this->format($input->getOption('relative') ? array_sum($set) / count($set) : array_sum($set)), | 
            ||
| 89 | $suffix  | 
            ||
| 90 | ));  | 
            ||
| 91 | }  | 
            ||
| 92 | }  | 
            ||
| 93 | |||
| 160 | 
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.