| Conditions | 1 |
| Paths | 1 |
| Total Lines | 90 |
| Code Lines | 87 |
| 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 |
||
| 57 | private function addResourcesSection(ArrayNodeDefinition $node) |
||
| 58 | { |
||
| 59 | $node |
||
| 60 | ->children() |
||
| 61 | ->arrayNode('resources') |
||
| 62 | ->addDefaultsIfNotSet() |
||
| 63 | ->children() |
||
| 64 | ->arrayNode('api_user') |
||
| 65 | ->addDefaultsIfNotSet() |
||
| 66 | ->children() |
||
| 67 | ->variableNode('options')->end() |
||
| 68 | ->arrayNode('classes') |
||
| 69 | ->addDefaultsIfNotSet() |
||
| 70 | ->children() |
||
| 71 | ->scalarNode('model')->isRequired()->cannotBeEmpty()->end() |
||
| 72 | ->scalarNode('interface')->defaultValue(UserInterface::class)->cannotBeEmpty()->end() |
||
| 73 | ->end() |
||
| 74 | ->end() |
||
| 75 | ->end() |
||
| 76 | ->end() |
||
| 77 | ->arrayNode('api_client') |
||
| 78 | ->addDefaultsIfNotSet() |
||
| 79 | ->children() |
||
| 80 | ->variableNode('options')->end() |
||
| 81 | ->arrayNode('classes') |
||
| 82 | ->addDefaultsIfNotSet() |
||
| 83 | ->children() |
||
| 84 | ->scalarNode('model')->defaultValue(Client::class)->cannotBeEmpty()->end() |
||
| 85 | ->scalarNode('interface')->defaultValue(ClientInterface::class)->cannotBeEmpty()->end() |
||
| 86 | ->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end() |
||
| 87 | ->scalarNode('repository')->cannotBeEmpty()->end() |
||
| 88 | ->scalarNode('factory')->defaultValue(Factory::class)->cannotBeEmpty()->end() |
||
| 89 | ->scalarNode('form')->defaultValue(ClientType::class)->cannotBeEmpty()->end() |
||
| 90 | ->end() |
||
| 91 | ->end() |
||
| 92 | ->end() |
||
| 93 | ->end() |
||
| 94 | ->arrayNode('api_access_token') |
||
| 95 | ->addDefaultsIfNotSet() |
||
| 96 | ->children() |
||
| 97 | ->variableNode('options')->end() |
||
| 98 | ->arrayNode('classes') |
||
| 99 | ->addDefaultsIfNotSet() |
||
| 100 | ->children() |
||
| 101 | ->scalarNode('model')->defaultValue(AccessToken::class)->cannotBeEmpty()->end() |
||
| 102 | ->scalarNode('interface')->defaultValue(AccessTokenInterface::class)->cannotBeEmpty()->end() |
||
| 103 | ->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end() |
||
| 104 | ->scalarNode('repository')->cannotBeEmpty()->end() |
||
| 105 | ->scalarNode('factory')->defaultValue(Factory::class)->cannotBeEmpty()->end() |
||
| 106 | ->end() |
||
| 107 | ->end() |
||
| 108 | ->end() |
||
| 109 | ->end() |
||
| 110 | ->arrayNode('api_refresh_token') |
||
| 111 | ->addDefaultsIfNotSet() |
||
| 112 | ->children() |
||
| 113 | ->variableNode('options')->end() |
||
| 114 | ->arrayNode('classes') |
||
| 115 | ->addDefaultsIfNotSet() |
||
| 116 | ->children() |
||
| 117 | ->scalarNode('model')->defaultValue(RefreshToken::class)->cannotBeEmpty()->end() |
||
| 118 | ->scalarNode('interface')->defaultValue(RefreshTokenInterface::class)->cannotBeEmpty()->end() |
||
| 119 | ->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end() |
||
| 120 | ->scalarNode('repository')->cannotBeEmpty()->end() |
||
| 121 | ->scalarNode('factory')->defaultValue(Factory::class)->cannotBeEmpty()->end() |
||
| 122 | ->end() |
||
| 123 | ->end() |
||
| 124 | ->end() |
||
| 125 | ->end() |
||
| 126 | ->arrayNode('api_auth_code') |
||
| 127 | ->addDefaultsIfNotSet() |
||
| 128 | ->children() |
||
| 129 | ->variableNode('options')->end() |
||
| 130 | ->arrayNode('classes') |
||
| 131 | ->addDefaultsIfNotSet() |
||
| 132 | ->children() |
||
| 133 | ->scalarNode('model')->defaultValue(AuthCode::class)->cannotBeEmpty()->end() |
||
| 134 | ->scalarNode('interface')->defaultValue(AuthCodeInterface::class)->cannotBeEmpty()->end() |
||
| 135 | ->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end() |
||
| 136 | ->scalarNode('repository')->cannotBeEmpty()->end() |
||
| 137 | ->scalarNode('factory')->defaultValue(Factory::class)->cannotBeEmpty()->end() |
||
| 138 | ->end() |
||
| 139 | ->end() |
||
| 140 | ->end() |
||
| 141 | ->end() |
||
| 142 | ->end() |
||
| 143 | ->end() |
||
| 144 | ->end() |
||
| 145 | ; |
||
| 146 | } |
||
| 147 | } |
||
| 148 |