| @@ 41-55 (lines=15) @@ | ||
| 38 | return isset($this->localeArr[$locale]) ? $this->localeArr[$locale] : $locale; |
|
| 39 | } |
|
| 40 | ||
| 41 | public function __get($property) |
|
| 42 | { |
|
| 43 | if (!method_exists($this, 'get'.ucfirst($property))) { |
|
| 44 | $locale = Sludio::getDefaultLocale(); |
|
| 45 | } else { |
|
| 46 | $locale = strtolower(substr($property, -2)); |
|
| 47 | $property = substr($property, 0, -2); |
|
| 48 | } |
|
| 49 | ||
| 50 | if (in_array($locale, array_keys($this->localeArr))) { |
|
| 51 | return $this->getVariableByLocale($property, $this->localeArr[$locale]); |
|
| 52 | } |
|
| 53 | ||
| 54 | return $this->{$property}; |
|
| 55 | } |
|
| 56 | ||
| 57 | public function __set($property, $value) |
|
| 58 | { |
|
| @@ 57-67 (lines=11) @@ | ||
| 54 | return $this->{$property}; |
|
| 55 | } |
|
| 56 | ||
| 57 | public function __set($property, $value) |
|
| 58 | { |
|
| 59 | $locale = strtolower(substr($property, -2)); |
|
| 60 | if (in_array($locale, array_keys($this->localeArr))) { |
|
| 61 | $property = substr($property, 0, -2); |
|
| 62 | Sludio::updateTranslations(get_class($this), $this->localeArr[$locale], $property, $value, $this->getId()); |
|
| 63 | } |
|
| 64 | $this->{$property} = $value; |
|
| 65 | ||
| 66 | return $this; |
|
| 67 | } |
|
| 68 | ||
| 69 | protected function getTranslations() |
|
| 70 | { |
|