| 1 | <?php |
||
| 17 | class AccessMagic implements \IContainer { |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var GlobalContainer $services |
||
| 21 | */ |
||
| 22 | protected $services; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Property values |
||
| 26 | * |
||
| 27 | * @var array |
||
| 28 | */ |
||
| 29 | protected $values = array(); |
||
| 30 | |||
| 31 | /** |
||
| 32 | * AccessMagic constructor. |
||
| 33 | * |
||
| 34 | * @param GlobalContainer|null $services |
||
| 35 | */ |
||
| 36 | public function __construct(GlobalContainer $services = null) { |
||
| 39 | |||
| 40 | |||
| 41 | /** |
||
| 42 | * Magic setter |
||
| 43 | * |
||
| 44 | * @param string $name |
||
| 45 | * @param mixed $value |
||
| 46 | */ |
||
| 47 | public function __set($name, $value) { |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Magic getter |
||
| 53 | * |
||
| 54 | * @param string $name |
||
| 55 | * |
||
| 56 | * @return mixed |
||
| 57 | */ |
||
| 58 | public function __get($name) { |
||
| 61 | |||
| 62 | /** |
||
| 63 | * Magic checker for property set |
||
| 64 | * |
||
| 65 | * @param string $name |
||
| 66 | * |
||
| 67 | * @return boolean |
||
| 68 | */ |
||
| 69 | public function __isset($name) { |
||
| 72 | |||
| 73 | /** |
||
| 74 | * Magic un-setter |
||
| 75 | * |
||
| 76 | * @param string $name |
||
| 77 | */ |
||
| 78 | public function __unset($name) { |
||
| 81 | |||
| 82 | /** |
||
| 83 | * Extracts values as array [$propertyName => $propertyValue] |
||
| 84 | * |
||
| 85 | * @return array |
||
| 86 | */ |
||
| 87 | public function asArray() { |
||
| 90 | |||
| 91 | /** |
||
| 92 | * Is container contains no data |
||
| 93 | * |
||
| 94 | * @return bool |
||
| 95 | */ |
||
| 96 | public function isEmpty() { |
||
| 99 | |||
| 100 | /** |
||
| 101 | * Clears container contents |
||
| 102 | */ |
||
| 103 | public function clear() { |
||
| 106 | |||
| 107 | } |
||
| 108 |