Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
5 / 5 |
| PasswordValidator | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
5 / 5 |
| __construct($minLength, $maxLength) | |
100.00% |
1 / 1 |
1 | |
100.00% |
3 / 3 |
|||
| isValid($password) | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| <?php | |
| /** | |
| * Created by PhpStorm. | |
| * User: frnc | |
| * Date: 2014.07.29. | |
| * Time: 18:04 | |
| */ | |
| namespace Tdd; | |
| class PasswordValidator implements IValidator { | |
| private $maxLength; | |
| private $minLength; | |
| function __construct($minLength, $maxLength) | |
| { | |
| $this->minLength = $minLength; | |
| $this->maxLength = $maxLength; | |
| } | |
| public function isValid($password) | |
| { | |
| $pattern = '/^.{' . $this->minLength . ',' . $this->maxLength . '}$/'; | |
| return (bool)preg_match($pattern, $password); | |
| } | |
| } |