| 1 | <?php |
||
| 7 | class Password {
|
||
| 8 | |||
| 9 | protected $criterias = []; |
||
| 10 | |||
| 11 | protected $manager; |
||
| 12 | |||
| 13 | 27 | public function __construct() |
|
| 14 | {
|
||
| 15 | 27 | $this->manager = new Manager; |
|
| 16 | 27 | } |
|
| 17 | |||
| 18 | 26 | public function addCriteria(Contracts\Dictionary $dictionary, Contracts\Occurrence $occurrence) |
|
| 19 | {
|
||
| 20 | 26 | $this->addNamedCriteria(null, $dictionary, $occurrence); |
|
| 21 | 26 | } |
|
| 22 | |||
| 23 | 26 | public function addNamedCriteria($name, Contracts\Dictionary $dictionary, Contracts\Occurrence $occurrence) |
|
| 24 | {
|
||
| 25 | 26 | $buildCriteria = $this->manager->buildCriteria($name, $dictionary, $occurrence); |
|
| 26 | |||
| 27 | 26 | $this->criterias[] = $buildCriteria; |
|
| 28 | 26 | } |
|
| 29 | |||
| 30 | 5 | public function addFormat(Contracts\Format $format) |
|
| 38 | |||
| 39 | /** |
||
| 40 | * Génère un nouveau mot de passe depuis les critères |
||
| 41 | * |
||
| 42 | * @return string |
||
| 43 | */ |
||
| 44 | 13 | public function generate() |
|
| 48 | |||
| 49 | /** |
||
| 50 | * Evalue le mot de passe |
||
| 51 | * |
||
| 52 | * @return string |
||
| 53 | */ |
||
| 54 | 10 | public function score($value) |
|
| 58 | |||
| 59 | 4 | public function passed($value) |
|
| 63 | } |
||
| 64 |