I18nRoute::__construct()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 9.6666
c 0
b 0
f 0
cc 3
eloc 5
nc 3
nop 1
crap 3
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
}