Conditions | 1 |
Paths | 1 |
Total Lines | 112 |
Code Lines | 110 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 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 |
||
69 | private function addResourcesSection(ArrayNodeDefinition $node) |
||
70 | { |
||
71 | $node |
||
72 | ->children() |
||
73 | ->arrayNode('resources') |
||
74 | ->addDefaultsIfNotSet() |
||
75 | ->children() |
||
76 | ->arrayNode('article') |
||
77 | ->addDefaultsIfNotSet() |
||
78 | ->children() |
||
79 | ->variableNode('options')->end() |
||
80 | ->arrayNode('classes') |
||
81 | ->addDefaultsIfNotSet() |
||
82 | ->children() |
||
83 | ->scalarNode('model')->defaultValue(Article::class)->cannotBeEmpty()->end() |
||
84 | ->scalarNode('interface')->defaultValue(ArticleInterface::class)->cannotBeEmpty()->end() |
||
85 | ->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end() |
||
86 | ->scalarNode('repository')->defaultValue(ArticleRepository::class)->cannotBeEmpty()->end() |
||
87 | ->scalarNode('factory')->defaultValue(TranslatableFactory::class)->end() |
||
88 | ->scalarNode('form')->defaultValue(ArticleType::class)->cannotBeEmpty()->end() |
||
89 | ->end() |
||
90 | ->end() |
||
91 | ->arrayNode('translation') |
||
92 | ->addDefaultsIfNotSet() |
||
93 | ->children() |
||
94 | ->variableNode('options')->end() |
||
95 | ->arrayNode('classes') |
||
96 | ->addDefaultsIfNotSet() |
||
97 | ->children() |
||
98 | ->scalarNode('model')->defaultValue(ArticleTranslation::class)->cannotBeEmpty()->end() |
||
99 | ->scalarNode('interface')->defaultValue(ArticleTranslationInterface::class)->cannotBeEmpty()->end() |
||
100 | ->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end() |
||
101 | ->scalarNode('repository')->cannotBeEmpty()->end() |
||
102 | ->scalarNode('factory')->defaultValue(Factory::class)->end() |
||
103 | ->scalarNode('form')->defaultValue(ArticleTranslationType::class)->cannotBeEmpty()->end() |
||
104 | ->end() |
||
105 | ->end() |
||
106 | ->end() |
||
107 | ->end() |
||
108 | ->end() |
||
109 | ->end() |
||
110 | ->arrayNode('article_category') |
||
111 | ->addDefaultsIfNotSet() |
||
112 | ->children() |
||
113 | ->variableNode('options')->end() |
||
114 | ->arrayNode('classes') |
||
115 | ->addDefaultsIfNotSet() |
||
116 | ->children() |
||
117 | ->scalarNode('model')->defaultValue(ArticleCategory::class)->cannotBeEmpty()->end() |
||
118 | ->scalarNode('interface')->defaultValue(ArticleCategoryInterface::class)->cannotBeEmpty()->end() |
||
119 | ->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end() |
||
120 | ->scalarNode('repository')->defaultValue(ArticleCategoryRepository::class)->cannotBeEmpty()->end() |
||
121 | ->scalarNode('factory')->defaultValue(TranslatableFactory::class)->end() |
||
122 | ->scalarNode('form')->defaultValue(ArticleCategoryType::class)->cannotBeEmpty()->end() |
||
123 | ->end() |
||
124 | ->end() |
||
125 | ->arrayNode('translation') |
||
126 | ->addDefaultsIfNotSet() |
||
127 | ->children() |
||
128 | ->variableNode('options')->end() |
||
129 | ->arrayNode('classes') |
||
130 | ->addDefaultsIfNotSet() |
||
131 | ->children() |
||
132 | ->scalarNode('model')->defaultValue(ArticleCategoryTranslation::class)->cannotBeEmpty()->end() |
||
133 | ->scalarNode('interface')->defaultValue(ArticleCategoryTranslationInterface::class)->cannotBeEmpty()->end() |
||
134 | ->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end() |
||
135 | ->scalarNode('repository')->cannotBeEmpty()->end() |
||
136 | ->scalarNode('factory')->defaultValue(Factory::class)->end() |
||
137 | ->scalarNode('form')->defaultValue(ArticleCategoryTranslationType::class)->cannotBeEmpty()->end() |
||
138 | ->end() |
||
139 | ->end() |
||
140 | ->end() |
||
141 | ->end() |
||
142 | ->end() |
||
143 | ->end() |
||
144 | ->arrayNode('article_comment') |
||
145 | ->addDefaultsIfNotSet() |
||
146 | ->children() |
||
147 | ->variableNode('options')->end() |
||
148 | ->arrayNode('classes') |
||
149 | ->addDefaultsIfNotSet() |
||
150 | ->children() |
||
151 | ->scalarNode('model')->defaultValue(ArticleComment::class)->cannotBeEmpty()->end() |
||
152 | ->scalarNode('interface')->defaultValue(ArticleCommentInterface::class)->cannotBeEmpty()->end() |
||
153 | ->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end() |
||
154 | ->scalarNode('repository')->cannotBeEmpty()->end() |
||
155 | ->scalarNode('factory')->defaultValue(ArticleCommentFactory::class)->end() |
||
156 | ->scalarNode('form')->defaultValue(ArticleCommentType::class)->cannotBeEmpty()->end() |
||
157 | ->end() |
||
158 | ->end() |
||
159 | ->end() |
||
160 | ->end() |
||
161 | ->arrayNode('article_image') |
||
162 | ->addDefaultsIfNotSet() |
||
163 | ->children() |
||
164 | ->variableNode('options')->end() |
||
165 | ->arrayNode('classes') |
||
166 | ->addDefaultsIfNotSet() |
||
167 | ->children() |
||
168 | ->scalarNode('model')->defaultValue(ArticleImage::class)->cannotBeEmpty()->end() |
||
169 | ->scalarNode('interface')->defaultValue(ArticleImageInterface::class)->cannotBeEmpty()->end() |
||
170 | ->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end() |
||
171 | ->scalarNode('repository')->cannotBeEmpty()->end() |
||
172 | ->scalarNode('factory')->defaultValue(Factory::class)->end() |
||
173 | ->scalarNode('form')->defaultValue(ArticleImageType::class)->cannotBeEmpty()->end() |
||
174 | ->end() |
||
175 | ->end() |
||
176 | ->end() |
||
177 | ->end() |
||
178 | ->end() |
||
179 | ->end() |
||
180 | ->end() |
||
181 | ; |
||
184 |