Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
23 | public function validate(mixed $value, object $rule, ValidationContext $context): Result |
||
24 | { |
||
25 | if (!$rule instanceof TableExistsRule) { |
||
26 | throw new UnexpectedRuleException(TableExistsRule::class, $rule); |
||
27 | } |
||
28 | |||
29 | $result = new Result(); |
||
30 | |||
31 | $tableSchema = $this->connection->getTableSchema($value); |
||
32 | |||
33 | if ($tableSchema === null) { |
||
34 | $result->addError(sprintf('Table "%s" does not exist.', $value)); |
||
35 | return $result; |
||
36 | } |
||
37 | |||
38 | return $result; |
||
39 | } |
||
41 |