Conditions | 5 |
Paths | 6 |
Total Lines | 22 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
23 | 2 | public function &__get($name) // "&" intentionally due to compatibility with Nette\Object |
|
24 | { |
||
25 | 2 | $prefix = 'get'; |
|
26 | 2 | if (preg_match('/^(is|has|should)/i', $name)) { |
|
27 | $prefix = ''; |
||
28 | } |
||
29 | |||
30 | 2 | $methodName = $prefix . ucfirst($name); |
|
31 | |||
32 | 2 | if (property_exists($this, $name) === FALSE && method_exists($this, $methodName) === FALSE) { |
|
33 | 2 | $value = $this->proxyCurrentLocaleTranslation($methodName); |
|
34 | // variable $value intentionally, due to & compatibility |
||
35 | 2 | return $value; |
|
36 | } |
||
37 | |||
38 | if (method_exists($this, $methodName)) { |
||
39 | $value = $this->$methodName(); |
||
40 | return $value; |
||
41 | } |
||
42 | |||
43 | return $this->$name; |
||
44 | } |
||
45 | |||
58 |