1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Copyright 2019 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\StepupRa\RaBundle\Value; |
20
|
|
|
|
21
|
|
|
use Surfnet\StepupRa\RaBundle\Assert; |
22
|
|
|
|
23
|
|
|
class RoleAtInstitution |
24
|
|
|
{ |
25
|
|
|
/** |
26
|
|
|
* @var string |
27
|
|
|
*/ |
28
|
|
|
private $role; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @var string |
32
|
|
|
*/ |
33
|
|
|
private $institution; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @param string $role |
37
|
|
|
*/ |
38
|
|
|
public function setRole($role) |
39
|
|
|
{ |
40
|
|
|
Assert::nullOrString($role, 'Role must be null or a string value'); |
41
|
|
|
$this->role = $role; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @param string $institution |
46
|
|
|
*/ |
47
|
|
|
public function setInstitution($institution) |
48
|
|
|
{ |
49
|
|
|
Assert::nullOrString($institution, 'Institution must be null or a string value'); |
50
|
|
|
$this->institution = $institution; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @return bool |
55
|
|
|
*/ |
56
|
|
|
public function hasRole() |
57
|
|
|
{ |
58
|
|
|
return !is_null($this->role); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @return bool |
63
|
|
|
*/ |
64
|
|
|
public function hasInstitution() |
65
|
|
|
{ |
66
|
|
|
return !is_null($this->institution); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @return string |
71
|
|
|
*/ |
72
|
|
|
public function getRole() |
73
|
|
|
{ |
74
|
|
|
return $this->role; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @return string |
79
|
|
|
*/ |
80
|
|
|
public function getInstitution() |
81
|
|
|
{ |
82
|
|
|
return $this->institution; |
83
|
|
|
} |
84
|
|
|
} |
85
|
|
|
|