| Conditions | 2 |
| Paths | 2 |
| Total Lines | 59 |
| Code Lines | 52 |
| 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 |
||
| 35 | protected function execute(InputInterface $input, OutputInterface $output): int |
||
| 36 | { |
||
| 37 | $this->promise |
||
| 38 | ->getDatabaseProvider() |
||
| 39 | ->database() |
||
| 40 | ->delete('post') |
||
| 41 | ->run(); |
||
| 42 | |||
| 43 | $this->promise |
||
| 44 | ->getDatabaseProvider() |
||
| 45 | ->database() |
||
| 46 | ->delete('post_tag') |
||
| 47 | ->run(); |
||
| 48 | |||
| 49 | $this->promise |
||
| 50 | ->getDatabaseProvider() |
||
| 51 | ->database() |
||
| 52 | ->delete('tag') |
||
| 53 | ->run(); |
||
| 54 | |||
| 55 | $this->promise |
||
| 56 | ->getDatabaseProvider() |
||
| 57 | ->database() |
||
| 58 | ->delete('user') |
||
| 59 | ->run(); |
||
| 60 | |||
| 61 | $this->promise |
||
| 62 | ->getDatabaseProvider() |
||
| 63 | ->database() |
||
| 64 | ->delete('comment') |
||
| 65 | ->run(); |
||
| 66 | |||
| 67 | return 0 === $this->promise |
||
| 68 | ->getORM() |
||
| 69 | ->getRepository(Post::class) |
||
| 70 | ->select() |
||
| 71 | ->count() + |
||
| 72 | $this->promise |
||
| 73 | ->getORM() |
||
| 74 | ->getRepository(PostTag::class) |
||
| 75 | ->select() |
||
| 76 | ->count() + |
||
| 77 | $this->promise |
||
| 78 | ->getORM() |
||
| 79 | ->getRepository(Tag::class) |
||
| 80 | ->select() |
||
| 81 | ->count() + |
||
| 82 | $this->promise |
||
| 83 | ->getORM() |
||
| 84 | ->getRepository(User::class) |
||
| 85 | ->select() |
||
| 86 | ->count() + |
||
| 87 | $this->promise |
||
| 88 | ->getORM() |
||
| 89 | ->getRepository(Comment::class) |
||
| 90 | ->select() |
||
| 91 | ->count() |
||
| 92 | ? ExitCode::OK |
||
| 93 | : ExitCode::UNSPECIFIED_ERROR; |
||
| 94 | } |
||
| 96 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths