Code Duplication    Length = 22-22 lines in 2 locations

src/Translator/FallbackTranslator.php 2 locations

@@ 44-65 (lines=22) @@
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function trans($id, array $parameters = array(), $domain = null, $locale = null)
45
    {
46
        $id = (string) $id;
47
        if (!$domain) {
48
            $domain = 'messages';
49
        }
50
51
        $catalogue = $this->getCatalogue($locale);
52
        if ($catalogue->defines($id, $domain)) {
53
            return $this->symfonyTranslator->trans($id, $parameters, $domain, $locale);
54
        }
55
56
        $locale = $catalogue->getLocale();
57
        if ($locale === $this->defaultLocale) {
58
            // we cant do anything...
59
            return $id;
60
        }
61
62
        $orgString = $this->symfonyTranslator->trans($id, $parameters, $domain, $this->defaultLocale);
63
64
        return $this->translateWithSubstitutedParameters($orgString, $locale, $parameters);
65
    }
66
67
    /**
68
     * {@inheritdoc}
@@ 70-91 (lines=22) @@
67
    /**
68
     * {@inheritdoc}
69
     */
70
    public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null)
71
    {
72
        $id = (string) $id;
73
        if (!$domain) {
74
            $domain = 'messages';
75
        }
76
77
        $catalogue = $this->getCatalogue($locale);
78
        if ($catalogue->defines($id, $domain)) {
79
            return $this->symfonyTranslator->transChoice($id, $number, $parameters, $domain, $locale);
80
        }
81
82
        $locale = $catalogue->getLocale();
83
        if ($locale === $this->defaultLocale) {
84
            // we cant do anything...
85
            return $id;
86
        }
87
88
        $orgString = $this->symfonyTranslator->transChoice($id, $number, $parameters, $domain, $this->defaultLocale);
89
90
        return $this->translateWithSubstitutedParameters($orgString, $locale, $parameters);
91
    }
92
93
    /**
94
     * {@inheritdoc}