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

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