| Conditions | 7 | 
| Paths | 10 | 
| Total Lines | 65 | 
| Code Lines | 43 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 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  | 
            ||
| 32 | protected function execute(InputInterface $input, OutputInterface $output)  | 
            ||
| 33 |     { | 
            ||
| 34 | $dir = __DIR__ . 'BenchmarkCommand.php/' .static::DIRECTORY;  | 
            ||
| 35 | $iterator = new \RecursiveIteratorIterator(  | 
            ||
| 36 | new \RecursiveDirectoryIterator(  | 
            ||
| 37 | $dir,  | 
            ||
| 38 | \RecursiveDirectoryIterator::SKIP_DOTS | \RecursiveDirectoryIterator::UNIX_PATHS  | 
            ||
| 39 | ), \RecursiveIteratorIterator::LEAVES_ONLY  | 
            ||
| 40 | );  | 
            ||
| 41 | |||
| 42 |         $formatter = $input->hasOption('formatter') | 
            ||
| 43 |             ? KeyLighter::get()->getFormatter($input->getOption('formatter')) | 
            ||
| 44 | : KeyLighter::get()->getDefaultFormatter();  | 
            ||
| 45 | |||
| 46 | $results = [];  | 
            ||
| 47 | |||
| 48 | /** @var \SplFileInfo $file */  | 
            ||
| 49 |         foreach ($iterator as $file) { | 
            ||
| 50 | $shortname = substr($file->getPathname(), strlen($dir));  | 
            ||
| 51 | |||
| 52 |             if (!fnmatch($input->getOption('include'), $shortname)) { | 
            ||
| 53 |                 $output->writeln(sprintf('Skipping file <info>%s</info>', $shortname), OutputInterface::VERBOSITY_VERBOSE); | 
            ||
| 54 | |||
| 55 | continue;  | 
            ||
| 56 | }  | 
            ||
| 57 | |||
| 58 | $language = Language::byFilename($file->getFilename());  | 
            ||
| 59 | $source = file_get_contents($file->getPathname());  | 
            ||
| 60 | |||
| 61 | $output->writeln(sprintf(  | 
            ||
| 62 | 'File: <info>%s</info> Size: <info>%s</info> Language: <info>%s</info>',  | 
            ||
| 63 | substr($file->getPathname(), strlen($dir)), $file->getSize(), get_class($language)  | 
            ||
| 64 | ), OutputInterface::VERBOSITY_VERBOSE);  | 
            ||
| 65 | |||
| 66 | // Dry run, to include all necessary files.  | 
            ||
| 67 | $this->benchmark($source, $language, $formatter);  | 
            ||
| 68 | |||
| 69 | $times = [];  | 
            ||
| 70 | $memory = [];  | 
            ||
| 71 |             for($i = $input->getOption('times'); $i > 0; $i--) { | 
            ||
| 72 | $result = $this->benchmark($source, $language, $formatter);  | 
            ||
| 73 | $times = array_merge_recursive($times, $result['times']);  | 
            ||
| 74 | $memory = array_merge_recursive($memory, $result['memory']);  | 
            ||
| 75 | |||
| 76 |                 if($input->getOption('geshi') && class_exists('GeSHi')) { | 
            ||
| 77 | $times['geshi'][] = $this->geshi($source, $file->getExtension());  | 
            ||
| 78 | }  | 
            ||
| 79 | }  | 
            ||
| 80 | |||
| 81 | $results[$shortname] = [  | 
            ||
| 82 | 'language' => get_class($language),  | 
            ||
| 83 | 'size' => $file->getSize(),  | 
            ||
| 84 | 'times' => $times,  | 
            ||
| 85 | 'memory' => $memory  | 
            ||
| 86 | ];  | 
            ||
| 87 | }  | 
            ||
| 88 | |||
| 89 | $this->output([  | 
            ||
| 90 | 'formatter' => get_class($formatter),  | 
            ||
| 91 | 'timestamp' => time(),  | 
            ||
| 92 | 'system' => php_uname(),  | 
            ||
| 93 |             'comment'   => $input->getOption('comment'), | 
            ||
| 94 | 'results' => $results  | 
            ||
| 95 | ], $input, $output);  | 
            ||
| 96 | }  | 
            ||
| 97 | |||
| 192 | 
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.