| Total Complexity | 11 |
| Total Lines | 65 |
| Duplicated Lines | 0 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 7 | trait UserPasswordTrait |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var array{ user: string|null, password: string|null, } |
||
|
|
|||
| 11 | */ |
||
| 12 | private $authentication = ['user' => null, 'password' => null]; |
||
| 13 | |||
| 14 | public function getAuthentication(): array |
||
| 15 | { |
||
| 16 | return $this->authentication; |
||
| 17 | } |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @param array{ user?: string|null, password?: string|null, } $authentication |
||
| 21 | */ |
||
| 22 | private function setAuthentication(array $authentication): void |
||
| 23 | { |
||
| 24 | if (!empty($authentication)) { |
||
| 25 | $this->authentication['user'] = $authentication['user'] ?? null; |
||
| 26 | $this->authentication['password'] = $authentication['password'] ?? null; |
||
| 27 | } |
||
| 28 | } |
||
| 29 | |||
| 30 | public function getUser(): ?string |
||
| 31 | { |
||
| 32 | return $this->authentication['user'] ?? null; |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @return static |
||
| 37 | */ |
||
| 38 | public function withUser(?string $user) |
||
| 44 | } |
||
| 45 | |||
| 46 | public function getPassword(): ?string |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @return static |
||
| 53 | */ |
||
| 54 | public function withPassword(?string $password) |
||
| 60 | } |
||
| 61 | |||
| 62 | private function getUserInfoString(): string |
||
| 74 |