| Conditions | 3 |
| Paths | 3 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | public function validateAttribute($model, $attribute) |
||
| 27 | { |
||
| 28 | if (!$model instanceof Provider) { |
||
| 29 | throw new InvalidArgumentException(sprintf( |
||
| 30 | "Model must be an instance of %s, %s given.", |
||
| 31 | Provider::class, |
||
| 32 | get_class($model) |
||
| 33 | )); |
||
| 34 | } |
||
| 35 | |||
| 36 | if (!$model->getSettings()->validate()) { |
||
| 37 | $message = Craft::t( |
||
| 38 | 'patron', |
||
| 39 | 'Invalid settings.' |
||
| 40 | ); |
||
| 41 | $this->addError($model, $attribute, $message); |
||
| 42 | } |
||
| 43 | } |
||
| 44 | } |
||
| 45 |