| Conditions | 6 |
| Paths | 6 |
| Total Lines | 18 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 42 |
| Changes | 0 | ||
| 1 | <?php |
||
| 48 | protected function getTranslation(array $translationData, $default = '') |
||
| 49 | { |
||
| 50 | // undefined locale |
||
| 51 | if (empty($translationData)) { |
||
| 52 | return $default; |
||
| 53 | } |
||
| 54 | |||
| 55 | // current locale matched |
||
| 56 | if ($this->locale && isset($translationData[$this->locale])) { |
||
| 57 | return $translationData[$this->locale]; |
||
| 58 | } |
||
| 59 | |||
| 60 | // default locale matched |
||
| 61 | return $this->defaultLocale && isset($translationData[$this->defaultLocale]) ? |
||
| 62 | $translationData[$this->defaultLocale] : |
||
| 63 | $default |
||
| 64 | ; |
||
| 65 | } |
||
| 66 | } |
||
| 67 |