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