These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kunstmaan\RedirectBundle\DependencyInjection\Compiler; |
||
4 | |||
5 | use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; |
||
6 | use Symfony\Component\DependencyInjection\ContainerBuilder; |
||
7 | |||
8 | /** |
||
9 | * @internal |
||
10 | */ |
||
11 | View Code Duplication | final class DeprecateClassParametersPass implements CompilerPassInterface |
|
0 ignored issues
–
show
|
|||
12 | { |
||
13 | public function process(ContainerBuilder $container) |
||
14 | { |
||
15 | $expectedValues = [ |
||
16 | 'kunstmaan_redirect.menu.adaptor.class' => \Kunstmaan\RedirectBundle\Helper\Menu\RedirectMenuAdaptor::class, |
||
17 | 'kunstmaan_redirect.redirect_repository.class' => \Kunstmaan\RedirectBundle\Repository\RedirectRepository::class, |
||
18 | ]; |
||
19 | |||
20 | foreach ($expectedValues as $parameter => $expectedValue) { |
||
21 | if (false === $container->hasParameter($parameter)) { |
||
22 | continue; |
||
23 | } |
||
24 | |||
25 | $currentValue = $container->getParameter($parameter); |
||
26 | if ($currentValue !== $expectedValue) { |
||
27 | @trigger_error(sprintf('Using the "%s" parameter to change the class of the service definition is deprecated in KunstmaanRedirectBundle 5.2 and will be removed in KunstmaanRedirectBundle 6.0. Use service decoration or a service alias instead.', $parameter), E_USER_DEPRECATED); |
||
28 | } |
||
29 | } |
||
30 | } |
||
31 | } |
||
32 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.