| Conditions | 11 | 
| Paths | 1024 | 
| Total Lines | 63 | 
| Code Lines | 41 | 
| 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  | 
            ||
| 52 | protected function execute(InputInterface $input, OutputInterface $output)  | 
            ||
| 53 |     { | 
            ||
| 54 | $config = [];  | 
            ||
| 55 | $options = [];  | 
            ||
| 56 | $messageOpt = '';  | 
            ||
| 57 | |||
| 58 |         if ($input->getOption('baseurl')) { | 
            ||
| 59 |             $config['baseurl'] = $input->getOption('baseurl'); | 
            ||
| 60 | }  | 
            ||
| 61 |         if ($input->getOption('output')) { | 
            ||
| 62 |             $config['output']['dir'] = $input->getOption('output'); | 
            ||
| 63 | $this->fs->dumpFile(  | 
            ||
| 64 | Util::joinFile($this->getPath(), self::TMP_DIR, 'output'),  | 
            ||
| 65 |                 (string) $input->getOption('output') | 
            ||
| 66 | );  | 
            ||
| 67 | }  | 
            ||
| 68 |         if ($input->getOption('postprocess') === null) { | 
            ||
| 69 | $config['postprocess']['enabled'] = true;  | 
            ||
| 70 | }  | 
            ||
| 71 |         if ($input->getOption('postprocess') == 'no') { | 
            ||
| 72 | $config['postprocess']['enabled'] = false;  | 
            ||
| 73 | }  | 
            ||
| 74 |         if ($input->getOption('clear-cache')) { | 
            ||
| 75 | $config['cache']['enabled'] = false;  | 
            ||
| 76 | }  | 
            ||
| 77 | |||
| 78 | $builder = $this->getBuilder($config);  | 
            ||
| 79 | |||
| 80 |         if ($input->getOption('drafts')) { | 
            ||
| 81 | $options['drafts'] = true;  | 
            ||
| 82 | $messageOpt .= ' with drafts';  | 
            ||
| 83 | }  | 
            ||
| 84 |         if ($input->getOption('dry-run')) { | 
            ||
| 85 | $options['dry-run'] = true;  | 
            ||
| 86 | $messageOpt .= ' (dry-run)';  | 
            ||
| 87 | }  | 
            ||
| 88 |         if ($input->getOption('page')) { | 
            ||
| 89 |             $options['page'] = $input->getOption('page'); | 
            ||
| 90 | }  | 
            ||
| 91 | |||
| 92 |         $output->writeln(\sprintf('Building website%s...', $messageOpt)); | 
            ||
| 93 | $output->writeln(  | 
            ||
| 94 |             sprintf('<comment>Path: %s</comment>', $this->getPath()), | 
            ||
| 95 | OutputInterface::VERBOSITY_VERBOSE  | 
            ||
| 96 | );  | 
            ||
| 97 |         if (!empty($this->getConfigFiles())) { | 
            ||
| 98 | $output->writeln(  | 
            ||
| 99 |                 sprintf('<comment>Config: %s</comment>', implode(', ', $this->getConfigFiles())), | 
            ||
| 100 | OutputInterface::VERBOSITY_VERBOSE  | 
            ||
| 101 | );  | 
            ||
| 102 | }  | 
            ||
| 103 |         if ((bool) $this->builder->getConfig()->get('cache.enabled')) { | 
            ||
| 104 | $output->writeln(  | 
            ||
| 105 |                 sprintf('<comment>Cache: %s</comment>', $this->builder->getConfig()->getCachePath()), | 
            ||
| 106 | OutputInterface::VERBOSITY_VERBOSE  | 
            ||
| 107 | );  | 
            ||
| 108 | }  | 
            ||
| 109 | |||
| 110 | $builder->build($options);  | 
            ||
| 111 | $this->fs->dumpFile(Util::joinFile($this->getPath(), self::TMP_DIR, 'changes.flag'), time());  | 
            ||
| 112 |         $output->writeln('Done! 🎉'); | 
            ||
| 113 | |||
| 114 | return 0;  | 
            ||
| 115 | }  | 
            ||
| 117 |