| Total Complexity | 4 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | class WithLanguageSettingsModel extends WithSurveyModel implements Translatable |
||
| 17 | { |
||
| 18 | |||
| 19 | /** @var string */ |
||
| 20 | public static $settingsClass; |
||
| 21 | |||
| 22 | /** @var Language */ |
||
| 23 | public $language; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * {@inheritdoc} |
||
| 27 | */ |
||
| 28 | public function init() |
||
| 29 | { |
||
| 30 | parent::init(); |
||
| 31 | if (empty($this->language)) { |
||
| 32 | $this->language = $this->survey->language; |
||
| 33 | } |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @return \yii\db\ActiveQuery |
||
| 38 | */ |
||
| 39 | public function getLanguageSettings() { |
||
| 40 | return $this->hasMany(self::$settingsClass); |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @return \yii\db\ActiveQuery |
||
| 45 | * @throws \yii\base\NotSupportedException |
||
| 46 | */ |
||
| 47 | public function getTexts() |
||
| 51 | } |
||
| 52 | |||
| 53 | } |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: