Conditions | 3 |
Paths | 4 |
Total Lines | 90 |
Code Lines | 60 |
Lines | 0 |
Ratio | 0 % |
Changes | 6 | ||
Bugs | 0 | Features | 4 |
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 |
||
139 | public function testLoad(): void { |
||
140 | |||
141 | $obj = new WBWCoreExtension(); |
||
142 | |||
143 | $this->assertNull($obj->load($this->configs, $this->containerBuilder)); |
||
144 | |||
145 | // Commands |
||
146 | $this->assertInstanceOf(CopySkeletonCommand::class, $this->containerBuilder->get(CopySkeletonCommand::SERVICE_NAME)); |
||
147 | $this->assertInstanceOf(UnzipAssetsCommand::class, $this->containerBuilder->get(UnzipAssetsCommand::SERVICE_NAME)); |
||
148 | |||
149 | // Controllers |
||
150 | $this->assertInstanceOf(HostController::class, $this->containerBuilder->get(HostController::SERVICE_NAME)); |
||
151 | $this->assertInstanceOf(TwigController::class, $this->containerBuilder->get(TwigController::SERVICE_NAME)); |
||
152 | |||
153 | // Event listeners |
||
154 | $this->assertInstanceOf(KernelEventListener::class, $this->containerBuilder->get(KernelEventListener::SERVICE_NAME)); |
||
155 | $this->assertInstanceOf(NotificationEventListener::class, $this->containerBuilder->get(NotificationEventListener::SERVICE_NAME)); |
||
156 | $this->assertInstanceOf(ToastEventListener::class, $this->containerBuilder->get(ToastEventListener::SERVICE_NAME)); |
||
157 | |||
158 | try { |
||
159 | |||
160 | $this->containerBuilder->get(SecurityEventListener::SERVICE_NAME); |
||
161 | } catch (Throwable $ex) { |
||
162 | |||
163 | $this->assertInstanceOf(ServiceNotFoundException::class, $ex); |
||
164 | $this->assertStringContainsString(SecurityEventListener::SERVICE_NAME, $ex->getMessage()); |
||
165 | } |
||
166 | |||
167 | // Helpers |
||
168 | $this->assertInstanceOf(FormHelper::class, $this->containerBuilder->get(FormHelper::SERVICE_NAME)); |
||
169 | |||
170 | // Managers |
||
171 | $this->assertInstanceOf(ColorManager::class, $this->containerBuilder->get(ColorManager::SERVICE_NAME)); |
||
172 | $this->assertInstanceOf(JavascriptManager::class, $this->containerBuilder->get(JavascriptManager::SERVICE_NAME)); |
||
173 | $this->assertInstanceOf(QuoteManager::class, $this->containerBuilder->get(QuoteManager::SERVICE_NAME)); |
||
174 | $this->assertInstanceOf(StylesheetManager::class, $this->containerBuilder->get(StylesheetManager::SERVICE_NAME)); |
||
175 | $this->assertInstanceOf(ThemeManager::class, $this->containerBuilder->get(ThemeManager::SERVICE_NAME)); |
||
176 | |||
177 | // Providers |
||
178 | $this->assertInstanceOf(AmberColorProvider::class, $this->containerBuilder->get(AmberColorProvider::SERVICE_NAME)); |
||
179 | $this->assertInstanceOf(BlueColorProvider::class, $this->containerBuilder->get(BlueColorProvider::SERVICE_NAME)); |
||
180 | $this->assertInstanceOf(BlueGreyColorProvider::class, $this->containerBuilder->get(BlueGreyColorProvider::SERVICE_NAME)); |
||
181 | $this->assertInstanceOf(BrownColorProvider::class, $this->containerBuilder->get(BrownColorProvider::SERVICE_NAME)); |
||
182 | $this->assertInstanceOf(CyanColorProvider::class, $this->containerBuilder->get(CyanColorProvider::SERVICE_NAME)); |
||
183 | $this->assertInstanceOf(DeepOrangeColorProvider::class, $this->containerBuilder->get(DeepOrangeColorProvider::SERVICE_NAME)); |
||
184 | $this->assertInstanceOf(DeepPurpleColorProvider::class, $this->containerBuilder->get(DeepPurpleColorProvider::SERVICE_NAME)); |
||
185 | $this->assertInstanceOf(GreenColorProvider::class, $this->containerBuilder->get(GreenColorProvider::SERVICE_NAME)); |
||
186 | $this->assertInstanceOf(GreyColorProvider::class, $this->containerBuilder->get(GreyColorProvider::SERVICE_NAME)); |
||
187 | $this->assertInstanceOf(IndigoColorProvider::class, $this->containerBuilder->get(IndigoColorProvider::SERVICE_NAME)); |
||
188 | $this->assertInstanceOf(LightBlueColorProvider::class, $this->containerBuilder->get(LightBlueColorProvider::SERVICE_NAME)); |
||
189 | $this->assertInstanceOf(LightGreenColorProvider::class, $this->containerBuilder->get(LightGreenColorProvider::SERVICE_NAME)); |
||
190 | $this->assertInstanceOf(LimeColorProvider::class, $this->containerBuilder->get(LimeColorProvider::SERVICE_NAME)); |
||
191 | $this->assertInstanceOf(OrangeColorProvider::class, $this->containerBuilder->get(OrangeColorProvider::SERVICE_NAME)); |
||
192 | $this->assertInstanceOf(PinkColorProvider::class, $this->containerBuilder->get(PinkColorProvider::SERVICE_NAME)); |
||
193 | $this->assertInstanceOf(PurpleColorProvider::class, $this->containerBuilder->get(PurpleColorProvider::SERVICE_NAME)); |
||
194 | $this->assertInstanceOf(RedColorProvider::class, $this->containerBuilder->get(RedColorProvider::SERVICE_NAME)); |
||
195 | $this->assertInstanceOf(TealColorProvider::class, $this->containerBuilder->get(TealColorProvider::SERVICE_NAME)); |
||
196 | $this->assertInstanceOf(YellowColorProvider::class, $this->containerBuilder->get(YellowColorProvider::SERVICE_NAME)); |
||
197 | |||
198 | $this->assertInstanceOf(JavascriptProvider::class, $this->containerBuilder->get(JavascriptProvider::SERVICE_NAME)); |
||
199 | $this->assertInstanceOf(SyntaxHighlighterProvider::class, $this->containerBuilder->get(SyntaxHighlighterProvider::SERVICE_NAME)); |
||
200 | |||
201 | try { |
||
202 | |||
203 | $this->containerBuilder->get(WorldsWisdomQuoteProvider::SERVICE_NAME); |
||
204 | } catch (Throwable $ex) { |
||
205 | |||
206 | $this->assertInstanceOf(ServiceNotFoundException::class, $ex); |
||
207 | $this->assertStringContainsString(WorldsWisdomQuoteProvider::SERVICE_NAME, $ex->getMessage()); |
||
208 | } |
||
209 | |||
210 | // Services |
||
211 | $this->assertInstanceOf(RepositoryService::class, $this->containerBuilder->get(RepositoryService::SERVICE_NAME)); |
||
212 | $this->assertInstanceOf(StatementService::class, $this->containerBuilder->get(StatementService::SERVICE_NAME)); |
||
213 | $this->assertInstanceOf(SymfonyBCService::class, $this->containerBuilder->get(SymfonyBCService::SERVICE_NAME)); |
||
214 | $this->assertInstanceOf(TokenGeneratorService::class, $this->containerBuilder->get(TokenGeneratorService::SERVICE_NAME)); |
||
215 | |||
216 | // Twig extensions |
||
217 | $this->assertInstanceOf(AssetsTwigExtension::class, $this->containerBuilder->get(AssetsTwigExtension::SERVICE_NAME)); |
||
218 | $this->assertInstanceOf(ContainerTwigExtension::class, $this->containerBuilder->get(ContainerTwigExtension::SERVICE_NAME)); |
||
219 | $this->assertInstanceOf(QuoteTwigExtension::class, $this->containerBuilder->get(QuoteTwigExtension::SERVICE_NAME)); |
||
220 | $this->assertInstanceOf(StringTwigExtension::class, $this->containerBuilder->get(StringTwigExtension::SERVICE_NAME)); |
||
221 | |||
222 | // Assets Twig extensions |
||
223 | $this->assertInstanceOf(FontAwesomeTwigExtension::class, $this->containerBuilder->get(FontAwesomeTwigExtension::SERVICE_NAME)); |
||
224 | $this->assertInstanceOf(JQueryInputMaskTwigExtension::class, $this->containerBuilder->get(JQueryInputMaskTwigExtension::SERVICE_NAME)); |
||
225 | $this->assertInstanceOf(MaterialDesignColorPaletteTwigExtension::class, $this->containerBuilder->get(MaterialDesignColorPaletteTwigExtension::SERVICE_NAME)); |
||
226 | $this->assertInstanceOf(MaterialDesignIconicFontTwigExtension::class, $this->containerBuilder->get(MaterialDesignIconicFontTwigExtension::SERVICE_NAME)); |
||
227 | $this->assertInstanceOf(MeteoconsTwigExtension::class, $this->containerBuilder->get(MeteoconsTwigExtension::SERVICE_NAME)); |
||
228 | $this->assertInstanceOf(SyntaxHighlighterTwigExtension::class, $this->containerBuilder->get(SyntaxHighlighterTwigExtension::SERVICE_NAME)); |
||
229 | } |
||
267 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.