| Conditions | 12 |
| Paths | 2048 |
| Total Lines | 51 |
| Code Lines | 25 |
| 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 |
||
| 21 | protected function execute(InputInterface $input, OutputInterface $output): int |
||
| 22 | { |
||
| 23 | $base_path = getRootPath(); |
||
| 24 | |||
| 25 | if (!file_exists($base_path . PathHelper::PATHS)) { |
||
| 26 | mkdir($base_path . PathHelper::PATHS); |
||
| 27 | } |
||
| 28 | |||
| 29 | if (!file_exists($base_path . PathHelper::COMPONENTS)) { |
||
| 30 | mkdir($base_path . PathHelper::COMPONENTS); |
||
| 31 | } |
||
| 32 | |||
| 33 | if (!file_exists($base_path . PathHelper::SCHEMAS)) { |
||
| 34 | mkdir($base_path . PathHelper::SCHEMAS); |
||
| 35 | } |
||
| 36 | |||
| 37 | if (!file_exists($base_path . PathHelper::RESPONSES)) { |
||
| 38 | mkdir($base_path . PathHelper::RESPONSES); |
||
| 39 | } |
||
| 40 | |||
| 41 | if (!file_exists($base_path . PathHelper::PARAMETERS)) { |
||
| 42 | mkdir($base_path . PathHelper::PARAMETERS); |
||
| 43 | } |
||
| 44 | |||
| 45 | if (!file_exists($base_path . PathHelper::EXAMPLES)) { |
||
| 46 | mkdir($base_path . PathHelper::EXAMPLES); |
||
| 47 | } |
||
| 48 | |||
| 49 | if (!file_exists($base_path . PathHelper::REQUEST_BODIES)) { |
||
| 50 | mkdir($base_path . PathHelper::REQUEST_BODIES); |
||
| 51 | } |
||
| 52 | |||
| 53 | if (!file_exists($base_path . PathHelper::HEADERS)) { |
||
| 54 | mkdir($base_path . PathHelper::HEADERS); |
||
| 55 | } |
||
| 56 | |||
| 57 | if (!file_exists($base_path . PathHelper::SECURITY_SCHEMES)) { |
||
| 58 | mkdir($base_path . PathHelper::SECURITY_SCHEMES); |
||
| 59 | } |
||
| 60 | |||
| 61 | if (!file_exists($base_path . PathHelper::LINKS)) { |
||
| 62 | mkdir($base_path . PathHelper::LINKS); |
||
| 63 | } |
||
| 64 | |||
| 65 | if (!file_exists($base_path . PathHelper::CALLBACKS)) { |
||
| 66 | mkdir($base_path . PathHelper::CALLBACKS); |
||
| 67 | } |
||
| 68 | |||
| 69 | echo 'scaffolded' . PHP_EOL; |
||
| 70 | |||
| 71 | return 0; |
||
| 72 | } |
||
| 74 |