Completed
Pull Request — master (#16)
by Christophe
01:43
created

ExposingTranslator::getCatalogue()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 3.1406

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 12
ccs 6
cts 8
cp 0.75
rs 9.4285
cc 3
eloc 6
nc 4
nop 1
crap 3.1406
1
<?php
2
3
namespace Incenteev\TranslationCheckerBundle\Translator;
4
5
use Symfony\Bundle\FrameworkBundle\Translation\Translator;
6
7
/**
8
 * Class extending the translator to expose the catalogue loading.
9
 */
10
class ExposingTranslator extends Translator
11
{
12 2
    public function getCatalogue($locale = null)
13
    {
14 2
        if (null === $locale) {
15
            $locale = $this->getLocale();
16
        }
17
18 2
        if (!isset($this->catalogues[$locale])) {
19 2
            $this->loadCatalogue($locale);
20 2
        }
21
22 2
        return $this->catalogues[$locale];
23
    }
24
}
25