Completed
Push — master ( d04d77...9ba770 )
by Christophe
13s
created

ExposingTranslator::getCatalogue()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3.0416

Importance

Changes 2
Bugs 0 Features 0
Metric Value
dl 0
loc 12
ccs 5
cts 6
cp 0.8333
rs 9.4285
c 2
b 0
f 0
cc 3
eloc 6
nc 4
nop 1
crap 3.0416
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
        }
21
22 2
        return $this->catalogues[$locale];
23
    }
24
}
25