| Conditions | 4 |
| Paths | 3 |
| Total Lines | 12 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 34 | public function validateAttribute($model, $attribute) |
||
| 35 | { |
||
| 36 | /** @var Model $model */ |
||
| 37 | $value = $model->$attribute; |
||
| 38 | |||
| 39 | if (!empty($value) && \is_string($value)) { |
||
| 40 | $error = PluginTemplate::isStringTemplateValid($value, []); |
||
| 41 | if (!empty($error)) { |
||
| 42 | $model->addError($attribute, $error); |
||
| 43 | } |
||
| 44 | } else { |
||
| 45 | $model->addError($attribute, Craft::t('seomatic', 'Is not a string.')); |
||
| 46 | } |
||
| 49 |