Code Duplication    Length = 22-22 lines in 2 locations

Translator/FallbackTranslator.php 2 locations

@@ 55-76 (lines=22) @@
52
    /**
53
     * {@inheritdoc}
54
     */
55
    public function trans($id, array $parameters = [], $domain = null, $locale = null)
56
    {
57
        $id = (string) $id;
58
        if (!$domain) {
59
            $domain = 'messages';
60
        }
61
62
        $catalogue = $this->getCatalogue($locale);
63
        if ($catalogue->defines($id, $domain)) {
64
            return $this->symfonyTranslator->trans($id, $parameters, $domain, $locale);
65
        }
66
67
        $locale = $catalogue->getLocale();
68
        if ($locale === $this->defaultLocale) {
69
            // we cant do anything...
70
            return $id;
71
        }
72
73
        $orgString = $this->symfonyTranslator->trans($id, $parameters, $domain, $this->defaultLocale);
74
75
        return $this->translateWithSubstitutedParameters($orgString, $locale, $parameters);
76
    }
77
78
    /**
79
     * {@inheritdoc}
@@ 81-102 (lines=22) @@
78
    /**
79
     * {@inheritdoc}
80
     */
81
    public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null)
82
    {
83
        $id = (string) $id;
84
        if (!$domain) {
85
            $domain = 'messages';
86
        }
87
88
        $catalogue = $this->getCatalogue($locale);
89
        if ($catalogue->defines($id, $domain)) {
90
            return $this->symfonyTranslator->transChoice($id, $number, $parameters, $domain, $locale);
91
        }
92
93
        $locale = $catalogue->getLocale();
94
        if ($locale === $this->defaultLocale) {
95
            // we cant do anything...
96
            return $id;
97
        }
98
99
        $orgString = $this->symfonyTranslator->transChoice($id, $number, $parameters, $domain, $this->defaultLocale);
100
101
        return $this->translateWithSubstitutedParameters($orgString, $locale, $parameters);
102
    }
103
104
    /**
105
     * {@inheritdoc}