| Conditions | 3 |
| Paths | 3 |
| Total Lines | 28 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | public function __get($key) |
||
| 21 | { |
||
| 22 | // When using mixed mapping, we will check |
||
| 23 | // for a class property corresponding to |
||
| 24 | // the attribute's key first. |
||
| 25 | // |
||
| 26 | // Note : this may raise issues as we may grant |
||
| 27 | // access to unwanted properties, like class dependencies. |
||
| 28 | // |
||
| 29 | // -> Solution would be to access the entityMap's $attributes, but we |
||
| 30 | // have to do this in a very efficient way. |
||
| 31 | // |
||
| 32 | // Manager::getEntityMap(get_class($this))->hasProperty() |
||
|
|
|||
| 33 | // |
||
| 34 | // We could do the casting to array / json the same way, and it would |
||
| 35 | |||
| 36 | |||
| 37 | if(property_exists($this, $key)) { |
||
| 38 | return $this->$key; |
||
| 39 | } |
||
| 40 | |||
| 41 | if(array_key_exists($key, $this->attributes)) |
||
| 42 | { |
||
| 43 | return $this->attributes[$key]; |
||
| 44 | } |
||
| 45 | |||
| 46 | return null; |
||
| 47 | } |
||
| 48 | |||
| 59 | } |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.