1 | <?php |
||
15 | class StorageArray |
||
16 | { |
||
17 | |||
18 | /** |
||
19 | * List of supported fields. |
||
20 | * |
||
21 | * @var array |
||
22 | */ |
||
23 | protected $fields = array(); |
||
24 | |||
25 | /** |
||
26 | * Sets the incoming values. |
||
27 | * |
||
28 | * @param array $fields Set values list |
||
29 | * @param bool $isReinitialize Reinitialization flag. |
||
30 | */ |
||
31 | 6 | public function __construct($fields = array(), $isReinitialize = false) |
|
42 | |||
43 | /** |
||
44 | * Call processing methods Set and Get. |
||
45 | * |
||
46 | * @param string $name Name. |
||
47 | * @param mixed $values Value. |
||
48 | * |
||
49 | * @return mixed |
||
50 | * |
||
51 | * @throws UndefinedMethodException |
||
52 | */ |
||
53 | 4 | public function __call($name, $values) |
|
62 | |||
63 | /** |
||
64 | * Initialization of supported fields. |
||
65 | * Returns the current object. |
||
66 | * |
||
67 | * @param array $fields List of supported fields. |
||
68 | * |
||
69 | * @return self |
||
70 | */ |
||
71 | 4 | private function initFields(array $fields) |
|
76 | |||
77 | /** |
||
78 | * Sets values in the storage. |
||
79 | * Returns the current object. |
||
80 | * |
||
81 | * @param string $name Name. |
||
82 | * @param mixed $values Value. |
||
83 | * |
||
84 | * @return self |
||
85 | */ |
||
86 | 1 | private function set($name, $values) |
|
91 | |||
92 | /** |
||
93 | * Gets the values from the storage. |
||
94 | * |
||
95 | * @param string $name Name |
||
96 | * |
||
97 | * @return mixed |
||
98 | */ |
||
99 | 1 | private function get($name) |
|
103 | |||
104 | /** |
||
105 | * Returns the storage as an array. |
||
106 | * |
||
107 | * @return array |
||
108 | */ |
||
109 | 6 | public function toArray() |
|
113 | } |
||
114 |