| 1 | <?php | ||
| 14 | trait Translatable | ||
| 15 | { | ||
| 16 | |||
| 17 | /** | ||
| 18 | * @param string | ||
| 19 | * @return mixed | ||
| 20 | */ | ||
| 21 | 2 | public function &__get($name) // "&" intentionally due to compatibility with Nette\Object | |
| 22 | 	{ | ||
| 23 | 2 | $prefix = 'get'; | |
| 24 | 2 | 		if (preg_match('/^(is|has|should)/i', $name)) { | |
| 25 | $prefix = ''; | ||
| 26 | } | ||
| 27 | |||
| 28 | 2 | $methodName = $prefix . ucfirst($name); | |
| 29 | |||
| 30 | 2 | 		if (property_exists($this, $name) === FALSE && method_exists($this, $methodName) === FALSE) { | |
| 31 | 2 | $value = $this->proxyCurrentLocaleTranslation($methodName); | |
| 32 | // variable $value intentionally, due to & compatibility | ||
| 33 | 2 | return $value; | |
| 34 | } | ||
| 35 | |||
| 36 | 		if (method_exists($this, $methodName)) { | ||
| 37 | $value = $this->$methodName(); | ||
| 38 | return $value; | ||
| 39 | } | ||
| 40 | |||
| 41 | return $this->$name; | ||
| 42 | } | ||
| 43 | |||
| 44 | |||
| 45 | /** | ||
| 46 | * @param string | ||
| 47 | * @param array | ||
| 48 | * @return mixed | ||
| 49 | */ | ||
| 50 | 6 | public function __call($method, $arguments) | |
| 54 | |||
| 55 | } | ||
| 56 |