Conditions | 5 |
Paths | 6 |
Total Lines | 22 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 7.4572 |
Changes | 9 | ||
Bugs | 2 | Features | 2 |
1 | <?php |
||
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 | |||
56 |