Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
16 / 16 |
| User | |
100.00% |
1 / 1 |
|
100.00% |
4 / 4 |
10 | |
100.00% |
16 / 16 |
| __construct($email, $password, $type) | |
100.00% |
1 / 1 |
7 | |
100.00% |
13 / 13 |
|||
| getEmail() | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| getPassword() | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| getType() | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| <?php | |
| namespace Tdd; | |
| class User | |
| { | |
| private $email; | |
| private $password; | |
| private $type; | |
| public function __construct($email, $password, $type) | |
| { | |
| if (!is_string($email) || empty($email)) | |
| { | |
| throw new \InvalidArgumentException('Invalid email!'); | |
| } | |
| if (!is_string($password) || empty($password)) | |
| { | |
| throw new \InvalidArgumentException('Invalid password!'); | |
| } | |
| if (!is_string($type) || empty($type)) | |
| { | |
| throw new \InvalidArgumentException('Invalid type!'); | |
| } | |
| $this->email = $email; | |
| $this->password = $password; | |
| $this->type = $type; | |
| } | |
| /** | |
| * @return string | |
| */ | |
| public function getEmail() | |
| { | |
| return $this->email; | |
| } | |
| /** | |
| * @return string | |
| */ | |
| public function getPassword() | |
| { | |
| return $this->password; | |
| } | |
| /** | |
| * @return string | |
| */ | |
| public function getType() | |
| { | |
| return $this->type; | |
| } | |
| } |