| Conditions | 2 |
| Paths | 1 |
| Total Lines | 23 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 45 | public function getRules(): array |
||
| 46 | { |
||
| 47 | return [ |
||
| 48 | 'body.title' => [ |
||
| 49 | new Required(), |
||
| 50 | (new HasLength()) |
||
| 51 | ->min(5) |
||
| 52 | ->max(255), |
||
| 53 | ], |
||
| 54 | 'body.text' => [ |
||
| 55 | new Required(), |
||
| 56 | (new HasLength()) |
||
| 57 | ->min(5) |
||
| 58 | ->max(1000), |
||
| 59 | ], |
||
| 60 | 'body.status' => [ |
||
| 61 | new Required(), |
||
| 62 | static function ($value): Result { |
||
| 63 | $result = new Result(); |
||
| 64 | if (!PostStatus::isValid($value)) { |
||
| 65 | $result->addError('Incorrect status'); |
||
| 66 | } |
||
| 67 | return $result; |
||
| 68 | }, |
||
| 73 |