Code Duplication    Length = 26-27 lines in 2 locations

src/Kunstmaan/AdminBundle/Helper/DomainConfiguration.php 1 location

@@ 33-59 (lines=27) @@
30
    /**
31
     * @param ContainerInterface|string $multilanguage
32
     */
33
    public function __construct(/*ContainerInterface|RequestStack*/ $requestStack, $multilanguage = null, $defaultLocale = null, $requiredLocales = null)
34
    {
35
        if ($requestStack instanceof ContainerInterface) {
36
            @trigger_error('Container injection and the usage of the container is deprecated in KunstmaanNodeBundle 5.1 and will be removed in KunstmaanNodeBundle 6.0.', E_USER_DEPRECATED);
37
38
            $this->container = $requestStack;
39
            $this->multiLanguage = $this->container->getParameter('kunstmaan_admin.multi_language');
40
            $this->defaultLocale = $this->container->getParameter('kunstmaan_admin.default_locale');
41
            $this->requiredLocales = explode('|', $this->container->getParameter('kunstmaan_admin.required_locales'));
42
            $this->requestStack = $this->container->get('request_stack');
43
44
            return;
45
        }
46
47
        $this->requestStack = $requestStack;
48
        $this->multiLanguage = $multilanguage;
49
        $this->defaultLocale = $defaultLocale;
50
51
        $this->requiredLocales = explode('|', $requiredLocales);
52
    }
53
54
    /**
55
     * @return string
56
     */
57
    public function getHost()
58
    {
59
        $request = $this->getMasterRequest();
60
        $host = \is_null($request) ? '' : $request->getHost();
61
62
        return $host;

src/Kunstmaan/NodeBundle/Router/SlugRouter.php 1 location

@@ 68-93 (lines=26) @@
65
     *
66
     * @param ContainerInterface $container
67
     */
68
    public function __construct(
69
        /* DomainConfigurationInterface */ $domainConfiguration,
70
        RequestStack $requestStack = null,
71
        EntityManagerInterface $em = null,
72
        $adminKey = null
73
    ) {
74
        $this->slugPattern = "[a-zA-Z0-9\-_\/]*";
75
76
        if ($domainConfiguration instanceof ContainerInterface) {
77
            @trigger_error('Container injection and the usage of the container is deprecated in KunstmaanNodeBundle 5.1 and will be removed in KunstmaanNodeBundle 6.0.', E_USER_DEPRECATED);
78
79
            $this->container = $domainConfiguration;
80
            $this->domainConfiguration = $this->container->get('kunstmaan_admin.domain_configuration');
81
            $this->adminKey = $this->container->getParameter('kunstmaan_admin.admin_prefix');
82
            $this->requestStack = $this->container->get('request_stack');
83
            $this->em = $this->container->get('doctrine.orm.entity_manager');
84
85
            return;
86
        }
87
88
        $this->domainConfiguration = $domainConfiguration;
89
        $this->adminKey = $adminKey;
90
        $this->requestStack = $requestStack;
91
        $this->em = $em;
92
    }
93
94
    /**
95
     * Match given urls via the context to the routes we defined.
96
     * This functionality re-uses the default Symfony way of routing and its