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
|
|
|
|