| Conditions | 3 |
| Paths | 3 |
| Total Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 55 | public function __get($key) |
||
| 56 | { |
||
| 57 | // If there's a getter method, call it. |
||
| 58 | $method = 'get' . ucfirst($key); |
||
| 59 | if (method_exists($this, $method)) { |
||
| 60 | return $this->$method(); |
||
| 61 | } |
||
| 62 | |||
| 63 | $this->init(); |
||
| 64 | |||
| 65 | // If the property is defined in our data object, return it. |
||
| 66 | if (isset($this->data->{$key})) { |
||
| 67 | return $this->data->{$key}; |
||
| 68 | } |
||
| 69 | |||
| 70 | return null; |
||
| 71 | } |
||
| 72 | } |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.