| Conditions | 1 |
| Paths | 1 |
| Total Lines | 71 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 2 |
| 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 |
||
| 20 | protected function execute(InputInterface $input, OutputInterface $output) |
||
| 21 | { |
||
| 22 | $output->writeln( |
||
| 23 | <<<'GQL' |
||
| 24 | query IntrospectionQuery { |
||
| 25 | __schema { |
||
| 26 | mutationType { name } |
||
| 27 | types { |
||
| 28 | ...FullType |
||
| 29 | } |
||
| 30 | } |
||
| 31 | } |
||
| 32 | |||
| 33 | fragment FullType on __Type { |
||
| 34 | kind |
||
| 35 | name |
||
| 36 | description |
||
| 37 | fields(includeDeprecated: true) { |
||
| 38 | name |
||
| 39 | description |
||
| 40 | args { |
||
| 41 | ...InputValue |
||
| 42 | } |
||
| 43 | } |
||
| 44 | inputFields { |
||
| 45 | ...InputValue |
||
| 46 | } |
||
| 47 | } |
||
| 48 | |||
| 49 | fragment InputValue on __InputValue { |
||
| 50 | name |
||
| 51 | description |
||
| 52 | type { ...TypeRef } |
||
| 53 | defaultValue |
||
| 54 | } |
||
| 55 | |||
| 56 | fragment TypeRef on __Type { |
||
| 57 | kind |
||
| 58 | name |
||
| 59 | ofType { |
||
| 60 | kind |
||
| 61 | name |
||
| 62 | ofType { |
||
| 63 | kind |
||
| 64 | name |
||
| 65 | ofType { |
||
| 66 | kind |
||
| 67 | name |
||
| 68 | ofType { |
||
| 69 | kind |
||
| 70 | name |
||
| 71 | ofType { |
||
| 72 | kind |
||
| 73 | name |
||
| 74 | ofType { |
||
| 75 | kind |
||
| 76 | name |
||
| 77 | ofType { |
||
| 78 | kind |
||
| 79 | name |
||
| 80 | } |
||
| 81 | } |
||
| 82 | } |
||
| 83 | } |
||
| 84 | } |
||
| 85 | } |
||
| 86 | } |
||
| 87 | } |
||
| 88 | GQL |
||
| 89 | ); |
||
| 90 | } |
||
| 91 | } |
||
| 92 |