| Conditions | 1 |
| Paths | 1 |
| Total Lines | 67 |
| Code Lines | 64 |
| 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 |
||
| 59 | private function addResourcesSection(ArrayNodeDefinition $node) |
||
| 60 | { |
||
| 61 | $node |
||
| 62 | ->children() |
||
| 63 | ->arrayNode('resources') |
||
| 64 | ->useAttributeAsKey('name') |
||
| 65 | ->prototype('array') |
||
| 66 | ->children() |
||
| 67 | ->scalarNode('subject')->isRequired()->end() |
||
| 68 | ->arrayNode('attribute') |
||
| 69 | ->addDefaultsIfNotSet() |
||
| 70 | ->children() |
||
| 71 | ->variableNode('options')->end() |
||
| 72 | ->arrayNode('classes') |
||
| 73 | ->addDefaultsIfNotSet() |
||
| 74 | ->children() |
||
| 75 | ->scalarNode('model')->defaultValue(Attribute::class)->cannotBeEmpty()->end() |
||
| 76 | ->scalarNode('interface')->defaultValue(AttributeInterface::class)->cannotBeEmpty()->end() |
||
| 77 | ->scalarNode('controller')->cannotBeEmpty()->end() |
||
| 78 | ->scalarNode('repository')->cannotBeEmpty()->end() |
||
| 79 | ->scalarNode('factory')->defaultValue(TranslatableFactory::class)->end() |
||
| 80 | ->scalarNode('form')->cannotBeEmpty()->end() |
||
| 81 | ->end() |
||
| 82 | ->end() |
||
| 83 | ->arrayNode('translation') |
||
| 84 | ->addDefaultsIfNotSet() |
||
| 85 | ->children() |
||
| 86 | ->variableNode('options')->end() |
||
| 87 | ->arrayNode('classes') |
||
| 88 | ->addDefaultsIfNotSet() |
||
| 89 | ->children() |
||
| 90 | ->scalarNode('model')->defaultValue(AttributeTranslation::class)->cannotBeEmpty()->end() |
||
| 91 | ->scalarNode('interface')->defaultValue(AttributeTranslationInterface::class)->cannotBeEmpty()->end() |
||
| 92 | ->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end() |
||
| 93 | ->scalarNode('repository')->cannotBeEmpty()->end() |
||
| 94 | ->scalarNode('factory')->defaultValue(Factory::class)->end() |
||
| 95 | ->scalarNode('form')->cannotBeEmpty()->end() |
||
| 96 | ->end() |
||
| 97 | ->end() |
||
| 98 | ->end() |
||
| 99 | ->end() |
||
| 100 | ->end() |
||
| 101 | ->end() |
||
| 102 | ->arrayNode('attribute_value') |
||
| 103 | ->isRequired() |
||
| 104 | ->addDefaultsIfNotSet() |
||
| 105 | ->children() |
||
| 106 | ->variableNode('options')->end() |
||
| 107 | ->arrayNode('classes') |
||
| 108 | ->addDefaultsIfNotSet() |
||
| 109 | ->children() |
||
| 110 | ->scalarNode('model')->isRequired()->cannotBeEmpty()->end() |
||
| 111 | ->scalarNode('interface')->isRequired()->cannotBeEmpty()->end() |
||
| 112 | ->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end() |
||
| 113 | ->scalarNode('repository')->cannotBeEmpty()->end() |
||
| 114 | ->scalarNode('factory')->defaultValue(Factory::class)->end() |
||
| 115 | ->scalarNode('form')->cannotBeEmpty()->end() |
||
| 116 | ->end() |
||
| 117 | ->end() |
||
| 118 | ->end() |
||
| 119 | ->end() |
||
| 120 | ->end() |
||
| 121 | ->end() |
||
| 122 | ->end() |
||
| 123 | ->end() |
||
| 124 | ; |
||
| 125 | } |
||
| 126 | } |
||
| 127 |