Conditions | 4 |
Paths | 4 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 4 |
Changes | 5 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
24 | 4 | public function localized($language = null, $abridge = true) |
|
25 | { |
||
26 | 4 | if (!$language) |
|
27 | 4 | $language = Yii::$app->language; |
|
28 | |||
29 | 4 | if (!isset($this->with['translations'])) { |
|
30 | 4 | $this->with(['translation' => function ($query) use ($language, $abridge) { |
|
31 | 3 | $query->where([$this->languageField => $abridge ? substr($language, 0, 2) : $language]); |
|
32 | 4 | }]); |
|
33 | 4 | } |
|
34 | |||
35 | 4 | return $this; |
|
36 | } |
||
37 | |||
56 |