|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Copyright 2015 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 OpenConext\ProfileBundle\Service; |
|
20
|
|
|
|
|
21
|
|
|
use OpenConext\Profile\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 array |
|
33
|
|
|
*/ |
|
34
|
|
|
private $helpUrls; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* @var array |
|
38
|
|
|
*/ |
|
39
|
|
|
private $platformUrls; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @var array |
|
43
|
|
|
*/ |
|
44
|
|
|
private $termsOfServiceUrls; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* @var array |
|
48
|
|
|
*/ |
|
49
|
|
|
private $profileExplanationImageUrls; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @var array |
|
53
|
|
|
*/ |
|
54
|
|
|
private $attributeInformationUrls; |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* @param TranslatorInterface $translator |
|
58
|
|
|
* @param array $locales |
|
59
|
|
|
* @param array $helpUrls |
|
60
|
|
|
* @param array $platformUrls |
|
61
|
|
|
* @param array $termsOfServiceUrls |
|
62
|
|
|
* @param array $profileExplanationImageUrls |
|
63
|
|
|
* @param array $attributeInformationUrls |
|
64
|
|
|
*/ |
|
65
|
|
|
public function __construct( |
|
66
|
|
|
TranslatorInterface $translator, |
|
67
|
|
|
array $locales, |
|
68
|
|
|
array $helpUrls, |
|
69
|
|
|
array $platformUrls, |
|
70
|
|
|
array $termsOfServiceUrls, |
|
71
|
|
|
array $profileExplanationImageUrls, |
|
72
|
|
|
array $attributeInformationUrls |
|
73
|
|
|
) { |
|
74
|
|
|
Assert::keysArePresent($helpUrls, $locales); |
|
75
|
|
|
Assert::keysArePresent($platformUrls, $locales); |
|
76
|
|
|
Assert::keysArePresent($termsOfServiceUrls, $locales); |
|
77
|
|
|
Assert::keysArePresent($profileExplanationImageUrls, $locales); |
|
78
|
|
|
Assert::keysArePresent($attributeInformationUrls, $locales); |
|
79
|
|
|
|
|
80
|
|
|
$this->translator = $translator; |
|
81
|
|
|
$this->helpUrls = $helpUrls; |
|
82
|
|
|
$this->platformUrls = $platformUrls; |
|
83
|
|
|
$this->termsOfServiceUrls = $termsOfServiceUrls; |
|
84
|
|
|
$this->profileExplanationImageUrls = $profileExplanationImageUrls; |
|
85
|
|
|
$this->attributeInformationUrls = $attributeInformationUrls; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* @return string |
|
90
|
|
|
*/ |
|
91
|
|
|
public function getHelpUrl() |
|
92
|
|
|
{ |
|
93
|
|
|
return $this->helpUrls[$this->translator->getLocale()]; |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* @return string |
|
98
|
|
|
*/ |
|
99
|
|
|
public function getPlatformUrl() |
|
100
|
|
|
{ |
|
101
|
|
|
return $this->platformUrls[$this->translator->getLocale()]; |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* @return string |
|
106
|
|
|
*/ |
|
107
|
|
|
public function getTermsOfServiceUrl() |
|
108
|
|
|
{ |
|
109
|
|
|
return $this->termsOfServiceUrls[$this->translator->getLocale()]; |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
/** |
|
113
|
|
|
* @return string |
|
114
|
|
|
*/ |
|
115
|
|
|
public function getProfileExplanationImage() |
|
116
|
|
|
{ |
|
117
|
|
|
return $this->profileExplanationImageUrls[$this->translator->getLocale()]; |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
/** |
|
121
|
|
|
* @return string |
|
122
|
|
|
*/ |
|
123
|
|
|
public function getAttributeInformationUrl() |
|
124
|
|
|
{ |
|
125
|
|
|
return $this->attributeInformationUrls[$this->translator->getLocale()]; |
|
126
|
|
|
} |
|
127
|
|
|
} |
|
128
|
|
|
|