| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * Copyright 2014 SURFnet bv | 
            
                                                                                                            
                            
            
                                    
            
            
                | 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\StepupMiddlewareClient\Identity\Dto; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | use Assert; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | use Surfnet\StepupMiddlewareClient\Dto\HttpQuery; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | final class RaSecondFactorSearchQuery implements HttpQuery | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |     const STATUS_UNVERIFIED = 'unverified'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |     const STATUS_VERIFIED = 'verified'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |     const STATUS_VETTED = 'vetted'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |     const STATUS_REVOKED = 'revoked'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |      * @var string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |     private $actorInstitution; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |      * @var string|null | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |     private $name; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |      * @var string|null | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |     private $type; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |      * @var string|null The second factor type's ID (eg. Yubikey public ID) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |     private $secondFactorId; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |      * @var string|null | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |     private $email; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |      * @var string|null One of the STATUS_* constants. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |     private $status; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |      * @var string|null | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |     private $institution; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |      * @var string|null | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |     private $orderBy; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |      * @var string|null | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |     private $orderDirection; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |      * @var int | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |     private $pageNumber; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |      * @var string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |     private $actorId; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |      * @param string $institution | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |      * @param int $pageNumber | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |      * @param  string $actorId | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 91 |  | View Code Duplication |     public function __construct($institution, $pageNumber, $actorId) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |         $this->assertNonEmptyString($institution, 'institution'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |         Assert\that($pageNumber) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |             ->integer('Page number must be an integer') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |             ->min(1, 'Page number must be greater than or equal to 1'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |         $this->actorInstitution = $institution; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |         $this->actorId = $actorId; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |         $this->pageNumber = $pageNumber; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |      * @param string $actorInstitution | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |      * @return VerifiedSecondFactorSearchQuery | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |     public function setActorId($actorId) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |         $this->assertNonEmptyString($actorId, 'actorId'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |         $this->actorId = $actorId; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |         return $this; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |      * @return null|string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |     public function getName() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |         return $this->name; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |      * @param null|string $name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |     public function setName($name) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |         $this->assertNonEmptyString($name, 'name'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |         $this->name = $name; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |      * @return null|string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |     public function getType() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |         return $this->type; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |      * @param null|string $type | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |     public function setType($type) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |         $this->assertNonEmptyString($type, 'type'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |         $this->type = $type; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |      * @return null|string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |     public function getSecondFactorId() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |         return $this->secondFactorId; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |      * @param null|string $secondFactorId | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |     public function setSecondFactorId($secondFactorId) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |         $this->assertNonEmptyString($secondFactorId, 'secondFactorId'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |         $this->secondFactorId = $secondFactorId; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |      * @return null|string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |     public function getEmail() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |         return $this->email; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |      * @param null|string $email | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |     public function setEmail($email) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |         $this->assertNonEmptyString($email, 'email'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |         $this->email = $email; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |      * @return null|string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |     public function getStatus() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |         return $this->status; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |      * @param string $status | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 199 |  | View Code Duplication |     public function setStatus($status) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |         Assert\that($status)->choice( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |             [self::STATUS_UNVERIFIED, self::STATUS_VERIFIED, self::STATUS_VETTED, self::STATUS_REVOKED, ''], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |             'Invalid second factor status, must be one of the STATUS constants' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |         $this->status = $status ?: null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |      * @return null|string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |     public function getInstitution() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |         return $this->institution; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |      * @param null|string $institution | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  |     public function setInstitution($institution) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  |         $this->institution = $institution; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  |      * @param string $orderBy | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  |     public function setOrderBy($orderBy) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  |         $this->assertNonEmptyString($orderBy, 'orderBy'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  |         $this->orderBy = $orderBy; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  |      * @param string|null $orderDirection | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 238 |  | View Code Duplication |     public function setOrderDirection($orderDirection) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  |         Assert\that($orderDirection)->choice( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  |             ['asc', 'desc', '', null], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  |             "Invalid order direction, must be one of 'asc', 'desc'" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  |         $this->orderDirection = $orderDirection ?: null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 247 |  |  |  | 
            
                                                                        
                            
            
                                                                    
                                                                                                        
            
            
                | 248 |  | View Code Duplication |     private function assertNonEmptyString($value, $name) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 249 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 250 |  |  |         $message = sprintf( | 
            
                                                                        
                            
            
                                    
            
            
                | 251 |  |  |             '"%s" must be a non-empty string, "%s" given', | 
            
                                                                        
                            
            
                                    
            
            
                | 252 |  |  |             $name, | 
            
                                                                        
                            
            
                                    
            
            
                | 253 |  |  |             (is_object($value) ? get_class($value) : gettype($value)) | 
            
                                                                        
                            
            
                                    
            
            
                | 254 |  |  |         ); | 
            
                                                                        
                            
            
                                    
            
            
                | 255 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 256 |  |  |         Assert\that($value)->string($message)->notEmpty($message); | 
            
                                                                        
                            
            
                                    
            
            
                | 257 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  |      * Return the Http Query string as should be used, MUST include the '?' prefix. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  |      * @return string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  |      */ | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 264 |  | View Code Duplication |     public function toHttpQuery() | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  |         return '?' . http_build_query( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  |             array_filter( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  |                 [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  |                     'actorInstitution' => $this->actorInstitution, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  |                     'actorId'          => $this->actorId, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  |                     'name'             => $this->name, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  |                     'type'             => $this->type, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  |                     'secondFactorId'   => $this->secondFactorId, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  |                     'email'            => $this->email, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  |                     'status'           => $this->status, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  |                     'institution'      => $this->institution, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 |  |  |                     'orderBy'          => $this->orderBy, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  |                     'orderDirection'   => $this->orderDirection, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  |                     'p'                => $this->pageNumber, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  |                 ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  |                 function ($value) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  |                     return !is_null($value); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  |             ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 287 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 288 |  |  |  | 
            
                        
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.