Conditions | 3 |
Paths | 4 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php |
||
28 | protected function resolveField(string $field): FieldInterface |
||
29 | { |
||
30 | $field = is_numeric($field) ? |
||
31 | Craft::$app->getFields()->getFieldbyId($field) : |
||
32 | Craft::$app->getFields()->getFieldByHandle($field); |
||
33 | |||
34 | if (!$field instanceof FieldInterface) { |
||
35 | throw new HttpException(400, sprintf( |
||
36 | "Field must be an instance of '%s', '%s' given.", |
||
37 | FieldInterface::class, |
||
38 | get_class($field) |
||
39 | )); |
||
40 | } |
||
41 | |||
42 | return $field; |
||
43 | } |
||
44 | |||
59 |