I18nRoute::getLocales()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace FrankDeJonge\SymfonyI18nRouting\Routing\Annotation;
4
5
use Symfony\Component\Routing\Annotation\Route;
6
use function is_array;
7
8
/**
9
 * I18nRoute annotation.
10
 *
11
 * @Annotation
12
 * @Target({"CLASS", "METHOD"})
13
 */
14
class I18nRoute extends Route
15
{
16
    private $locales = [];
17
18 56
    public function __construct(array $data)
19
    {
20 56
        if (isset($data['value'])) {
21 32
            $data[is_array($data['value']) ? 'locales' : 'path'] = $data['value'];
22 32
            unset($data['value']);
23
        }
24
25 56
        parent::__construct($data);
26 54
    }
27
28 34
    public function getLocales()
29
    {
30 34
        return $this->locales;
31
    }
32
33 20
    public function setLocales(array $locales)
34
    {
35 20
        $this->locales = $locales;
36
    }
37
}