Conditions | 1 |
Paths | 1 |
Total Lines | 74 |
Code Lines | 71 |
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 |
||
58 | private function addResourcesSection(ArrayNodeDefinition $node) |
||
59 | { |
||
60 | $node |
||
61 | ->children() |
||
62 | ->arrayNode('resources') |
||
63 | ->addDefaultsIfNotSet() |
||
64 | ->children() |
||
65 | ->arrayNode('taxon') |
||
66 | ->addDefaultsIfNotSet() |
||
67 | ->children() |
||
68 | ->variableNode('options')->end() |
||
69 | ->arrayNode('classes') |
||
70 | ->addDefaultsIfNotSet() |
||
71 | ->children() |
||
72 | ->scalarNode('model')->defaultValue(Taxon::class)->cannotBeEmpty()->end() |
||
73 | ->scalarNode('interface')->defaultValue(TaxonInterface::class)->cannotBeEmpty()->end() |
||
74 | ->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end() |
||
75 | ->scalarNode('repository')->cannotBeEmpty()->end() |
||
76 | ->scalarNode('factory')->defaultValue(TranslatableFactory::class)->end() |
||
77 | ->arrayNode('form') |
||
78 | ->addDefaultsIfNotSet() |
||
79 | ->children() |
||
80 | ->scalarNode('default')->defaultValue(TaxonType::class)->cannotBeEmpty()->end() |
||
81 | ->end() |
||
82 | ->end() |
||
83 | ->end() |
||
84 | ->end() |
||
85 | ->arrayNode('validation_groups') |
||
86 | ->addDefaultsIfNotSet() |
||
87 | ->children() |
||
88 | ->arrayNode('default') |
||
89 | ->prototype('scalar')->end() |
||
90 | ->defaultValue(['sylius']) |
||
91 | ->end() |
||
92 | ->end() |
||
93 | ->end() |
||
94 | ->arrayNode('translation') |
||
95 | ->addDefaultsIfNotSet() |
||
96 | ->children() |
||
97 | ->variableNode('options')->end() |
||
98 | ->arrayNode('classes') |
||
99 | ->addDefaultsIfNotSet() |
||
100 | ->children() |
||
101 | ->scalarNode('model')->defaultValue(TaxonTranslation::class)->cannotBeEmpty()->end() |
||
102 | ->scalarNode('interface')->defaultValue(TaxonTranslationInterface::class)->cannotBeEmpty()->end() |
||
103 | ->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end() |
||
104 | ->scalarNode('repository')->cannotBeEmpty()->end() |
||
105 | ->scalarNode('factory')->defaultValue(Factory::class)->end() |
||
106 | ->arrayNode('form') |
||
107 | ->addDefaultsIfNotSet() |
||
108 | ->children() |
||
109 | ->scalarNode('default')->defaultValue(TaxonTranslationType::class)->cannotBeEmpty()->end() |
||
110 | ->end() |
||
111 | ->end() |
||
112 | ->end() |
||
113 | ->end() |
||
114 | ->arrayNode('validation_groups') |
||
115 | ->addDefaultsIfNotSet() |
||
116 | ->children() |
||
117 | ->arrayNode('default') |
||
118 | ->prototype('scalar')->end() |
||
119 | ->defaultValue(['sylius']) |
||
120 | ->end() |
||
121 | ->end() |
||
122 | ->end() |
||
123 | ->end() |
||
124 | ->end() |
||
125 | ->end() |
||
126 | ->end() |
||
127 | ->end() |
||
128 | ->end() |
||
129 | ->end() |
||
130 | ; |
||
131 | } |
||
132 | } |
||
133 |