Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| TokenLogin | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| validate | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Cosray\Validation; |
| 6 | |
| 7 | use Celemas\Sire\Contract\Validator; |
| 8 | use Celemas\Sire\Result; |
| 9 | use Celemas\Sire\Shape; |
| 10 | use Override; |
| 11 | |
| 12 | final class TokenLogin implements Validator |
| 13 | { |
| 14 | private Shape $shape; |
| 15 | |
| 16 | public function __construct() |
| 17 | { |
| 18 | $this->shape = new Shape(); |
| 19 | $this->shape->add('token', 'string')->rules('required', 'maxlen:512')->label(_('One-time token')); |
| 20 | } |
| 21 | |
| 22 | #[Override] |
| 23 | public function validate(array $data): Result |
| 24 | { |
| 25 | return $this->shape->validate($data); |
| 26 | } |
| 27 | } |