Completed
Push — master ( 879208...eebc00 )
by A.
02:22
created

GlobalViewParameters   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 39
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A getSupportUrl() 0 4 1
1
<?php
2
3
/**
4
 * Copyright 2016 SURFnet B.V.
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 *     http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
18
19
namespace Surfnet\StepupSelfService\SelfServiceBundle\Service;
20
21
use Surfnet\StepupSelfService\SelfServiceBundle\Assert;
22
use Symfony\Component\Translation\TranslatorInterface;
23
24
final class GlobalViewParameters
25
{
26
    /**
27
     * @var TranslatorInterface
28
     */
29
    private $translator;
30
31
    /**
32
     * @var string[]
33
     */
34
    private $locales;
35
36
    /**
37
     * @var string[]
38
     */
39
    private $supportUrl;
40
41
    /**
42
     * @param TranslatorInterface $translator
43
     * @param array $locales
44
     * @param array $supportUrl
45
     */
46
    public function __construct(TranslatorInterface $translator, array $locales, array $supportUrl)
47
    {
48
        Assert::keysAre($supportUrl, $locales);
49
50
        $this->translator = $translator;
51
        $this->locales = $locales;
52
        $this->supportUrl = $supportUrl;
53
    }
54
55
    /**
56
     * @return string
57
     */
58
    public function getSupportUrl()
59
    {
60
        return $this->supportUrl[$this->translator->getLocale()];
61
    }
62
}
63