| Total Complexity | 8 |
| Total Lines | 46 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class ValidStateRule implements Rule |
||
| 8 | { |
||
| 9 | /** @var string|\Spatie\ModelStates\State */ |
||
| 10 | private $abstractStateClass; |
||
| 11 | |||
| 12 | /** @var bool */ |
||
| 13 | private $nullable; |
||
| 14 | |||
| 15 | public static function make(string $abstractStateClass): ValidStateRule |
||
| 16 | { |
||
| 17 | return new self($abstractStateClass); |
||
| 18 | } |
||
| 19 | |||
| 20 | public function __construct(string $abstractStateClass) |
||
| 23 | } |
||
| 24 | |||
| 25 | public function nullable(): ValidStateRule |
||
| 26 | { |
||
| 27 | $this->nullable = true; |
||
| 28 | |||
| 29 | return $this; |
||
| 30 | } |
||
| 31 | |||
| 32 | public function required(): ValidStateRule |
||
| 33 | { |
||
| 34 | $this->nullable = false; |
||
| 35 | |||
| 36 | return $this; |
||
| 37 | } |
||
| 38 | |||
| 39 | public function passes($attribute, $value): bool |
||
| 48 | } |
||
| 49 | |||
| 50 | public function message(): string |
||
| 53 | } |
||
| 54 | } |
||
| 55 |