Completed
Push — master ( e1f5ea...1fc073 )
by Frank
02:44
created

I18nRoute::setHost()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

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