| Total Complexity | 4 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | class Annotation |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * Value property. Common among all derived classes. |
||
| 17 | * |
||
| 18 | * @var mixed |
||
| 19 | */ |
||
| 20 | public $value; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Constructor. |
||
| 24 | * |
||
| 25 | * @param array $data Key-value for properties to be defined in this class. |
||
| 26 | */ |
||
| 27 | public final function __construct(array $data) |
||
| 28 | { |
||
| 29 | foreach ($data as $key => $value) { |
||
| 30 | $this->$key = $value; |
||
| 31 | } |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Error handler for unknown property accessor in Annotation class. |
||
| 36 | * |
||
| 37 | * @param string $name Unknown property name. |
||
| 38 | * |
||
| 39 | * @throws \BadMethodCallException |
||
| 40 | */ |
||
| 41 | public function __get($name) |
||
| 42 | { |
||
| 43 | throw new \BadMethodCallException( |
||
| 44 | sprintf("Unknown property '%s' on annotation '%s'.", $name, get_class($this)) |
||
| 45 | ); |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Error handler for unknown property mutator in Annotation class. |
||
| 50 | * |
||
| 51 | * @param string $name Unknown property name. |
||
| 52 | * @param mixed $value Property value. |
||
| 53 | * |
||
| 54 | * @throws \BadMethodCallException |
||
| 55 | */ |
||
| 56 | public function __set($name, $value) |
||
| 60 | ); |
||
| 61 | } |
||
| 62 | } |
||
| 63 |