1 | <?php |
||
17 | trait CollectionTrait |
||
18 | { |
||
19 | use BaseTrait; |
||
20 | |||
21 | /** |
||
22 | * Returns property of item by name. |
||
23 | * @param mixed $name |
||
24 | * @return mixed |
||
25 | */ |
||
26 | public function get($name) |
||
30 | |||
31 | /** |
||
32 | * Sets an item. Silently resets if already exists. |
||
33 | * @param int|string $name |
||
34 | * @param mixed $value the element value |
||
35 | * @param string|array $where where to put, see [[setItem()]] |
||
36 | * @see setItem() |
||
37 | */ |
||
38 | 4 | public function set($name, $value, $where = '') |
|
42 | |||
43 | /** |
||
44 | * Adds an item. Does not touch if already exists. |
||
45 | * @param int|string $name item name |
||
46 | * @param array $value item value |
||
47 | * @param string|array $where where to put, see [[setItem()]] |
||
48 | * @return $this for chaining |
||
49 | * @see setItem() |
||
50 | */ |
||
51 | 4 | public function add($name, $value = null, $where = '') |
|
59 | |||
60 | /** |
||
61 | * Check collection has the item. |
||
62 | * @param string $name item name |
||
63 | * @return bool whether item exist |
||
64 | */ |
||
65 | 4 | public function has($name) |
|
69 | |||
70 | /** |
||
71 | * Delete an item. |
||
72 | * You can't create function `unset`. |
||
73 | * @param $name |
||
74 | */ |
||
75 | 2 | public function delete($name) |
|
79 | |||
80 | /** |
||
81 | * This method is overridden to support accessing items like properties. |
||
82 | * @param string $name item or property name |
||
83 | * @return mixed item of found or the named property value |
||
84 | */ |
||
85 | 1 | public function __get($name) |
|
89 | |||
90 | /** |
||
91 | * This method is overridden to support accessing items like properties. |
||
92 | * @param string $name item or property name |
||
93 | * @param string $value value to be set |
||
94 | * @return mixed item of found or the named property value |
||
95 | */ |
||
96 | 1 | public function __set($name, $value) |
|
100 | |||
101 | /** |
||
102 | * Checks if a property value is null. |
||
103 | * This method overrides the parent implementation by checking if the named item is loaded. |
||
104 | * @param string $name the property name or the event name |
||
105 | * @return bool whether the property value is null |
||
106 | */ |
||
107 | 1 | public function __isset($name) |
|
111 | |||
112 | /** |
||
113 | * Checks if a property value is null. |
||
114 | * This method overrides the parent implementation by checking if the named item is loaded. |
||
115 | * @param string $name the property name or the event name |
||
116 | * @return bool whether the property value is null |
||
117 | */ |
||
118 | public function __unset($name) |
||
122 | } |
||
123 |