Conditions | 3 |
Paths | 3 |
Total Lines | 21 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 3.1406 |
Changes | 0 |
1 | <?php |
||
26 | 2 | public function getValue($property) |
|
27 | { |
||
28 | 2 | if (!$this->reflect->properties->contains($property)) |
|
|
|||
29 | { |
||
30 | throw new CannotReadPropertyException |
||
31 | ( |
||
32 | get_class($this->object), |
||
33 | $property |
||
34 | ); |
||
35 | } |
||
36 | 2 | elseif (!$this->reflect->properties[$property]->readable) |
|
37 | { |
||
38 | 1 | throw new PropertyNotReadableException |
|
39 | ( |
||
40 | 1 | get_class($this->object), |
|
41 | $property |
||
42 | ); |
||
43 | } |
||
44 | |||
45 | 1 | return parent::getValue($property); |
|
46 | } |
||
47 | } |
||
48 |
Since your code implements the magic setter
_set
, this function will be called for any write access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.