| Total Complexity | 4 | 
| Total Lines | 56 | 
| Duplicated Lines | 0 % | 
| Coverage | 100% | 
| Changes | 0 | ||
| 1 | <?php | ||
| 12 | class CredentialsManager | ||
| 13 | { | ||
| 14 | /** @var CredentialsValidator */ | ||
| 15 | private $validator; | ||
| 16 | |||
| 17 | /** @var string */ | ||
| 18 | private $subdomain; | ||
| 19 | |||
| 20 | /** @var string */ | ||
| 21 | private $login; | ||
| 22 | |||
| 23 | /** @var string */ | ||
| 24 | private $hash; | ||
| 25 | |||
| 26 | /** | ||
| 27 | * CredentialsManager constructor. | ||
| 28 | * | ||
| 29 | * @param string $domain | ||
| 30 | * @param string $login | ||
| 31 | * @param string $hash | ||
| 32 | */ | ||
| 33 | 7 | public function __construct($domain, $login, $hash) | |
| 34 |     { | ||
| 35 | 7 | $this->validator = new CredentialsValidator(); // Composition | |
| 36 | |||
| 37 | 7 | $this->validator->validateSubdomain($domain); | |
| 38 | 7 | $this->validator->validateLogin($login); | |
| 39 | 7 | $this->validator->validateHash($hash); | |
| 40 | |||
| 41 | 7 | $this->subdomain = $domain; | |
| 42 | 7 | $this->login = $login; | |
| 43 | 7 | $this->hash = $hash; | |
| 44 | 7 | } | |
| 45 | |||
| 46 | /** | ||
| 47 | * @return string | ||
| 48 | */ | ||
| 49 | 1 | public function getSubdomain() | |
| 50 |     { | ||
| 51 | 1 | return $this->subdomain; | |
| 52 | } | ||
| 53 | |||
| 54 | /** @return string */ | ||
| 55 | 1 | public function getLogin() | |
| 56 |     { | ||
| 57 | 1 | return $this->login; | |
| 58 | } | ||
| 59 | |||
| 60 | /** | ||
| 61 | * @return array | ||
| 62 | */ | ||
| 63 | 1 | public function getCredentials() | |
| 68 | ]; | ||
| 69 | } | ||
| 70 | } | ||
| 71 |