2020 */
2121
2222/**
23- * Provides array access and property overload interface for Doctrine subclasses
23+ * Provides array access and property overload interface for Doctrine subclasses.
2424 *
25- * @package Doctrine
26- * @subpackage Access
2725 * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
28- * @link www.doctrine-project.org
26+ *
27+ * @see www.doctrine-project.org
2928 * @since 1.0
29+ *
3030 * @version $Revision: 7490 $
31+ *
3132 * @author Konsta Vesterinen <[email protected] > 3233 */
3334abstract class Doctrine_Access extends Doctrine_Locator_Injectable implements ArrayAccess
3435{
3536 /**
36- * Set an entire aray to the data
37+ * Set an entire aray to the data.
38+ *
39+ * @param array $array An array of key => value pairs
3740 *
38- * @param array $array An array of key => value pairs
39- * @return Doctrine_Access
41+ * @return Doctrine_Access
4042 */
4143 public function setArray (array $ array )
4244 {
@@ -48,48 +50,43 @@ public function setArray(array $array)
4850 }
4951
5052 /**
51- * Set key and value to data
53+ * Set key and value to data.
5254 *
5355 * @see set, offsetSet
54- * @param $name
55- * @param $value
56- * @return void
5756 */
5857 public function __set ($ name , $ value )
5958 {
6059 $ this ->set ($ name , $ value );
6160 }
6261
6362 /**
64- * Get key from data
63+ * Get key from data.
6564 *
6665 * @see get, offsetGet
67- * @param mixed $name
68- * @return mixed
6966 */
7067 public function __get ($ name )
7168 {
7269 return $ this ->get ($ name );
7370 }
7471
7572 /**
76- * Check if key exists in data
73+ * Check if key exists in data.
7774 *
78- * @param string $name
79- * @return boolean whether or not this object contains $name
75+ * @param string $name
76+ *
77+ * @return bool whether or not this object contains $name
8078 */
8179 public function __isset ($ name )
8280 {
8381 return $ this ->contains ($ name );
8482 }
8583
8684 /**
87- * Remove key from data
85+ * Remove key from data.
8886 *
89- * @param string $name
90- * @return void
87+ * @param string $name
9188 */
92- #[\ ReturnTypeWillChange]
89+ #[ReturnTypeWillChange]
9390 public function __unset ($ name )
9491 {
9592 return $ this ->remove ($ name );
@@ -98,16 +95,13 @@ public function __unset($name)
9895 /**
9996 * @return bool
10097 */
101- #[\ ReturnTypeWillChange]
98+ #[ReturnTypeWillChange]
10299 public function offsetExists ($ offset )
103100 {
104101 return $ this ->contains ($ offset );
105102 }
106103
107- /**
108- * @return mixed
109- */
110- #[\ReturnTypeWillChange]
104+ #[ReturnTypeWillChange]
111105 public function offsetGet ($ offset )
112106 {
113107 // array notation with no index was causing 'undefined variable: $offset' notices in php7,
@@ -116,84 +110,78 @@ public function offsetGet($offset)
116110 if (!isset ($ offset )) {
117111 return $ this ->get (null );
118112 }
113+
119114 return $ this ->get ($ offset );
120115 }
121116
122- /**
123- * @return void
124- */
125- #[\ReturnTypeWillChange]
117+ #[ReturnTypeWillChange]
126118 public function offsetSet ($ offset , $ value )
127119 {
128- if ( ! isset ($ offset )) {
120+ if (! isset ($ offset )) {
129121 $ this ->add ($ value );
130122 } else {
131123 $ this ->set ($ offset , $ value );
132124 }
133125 }
134126
135- /**
136- * @return void
137- */
138- #[\ReturnTypeWillChange]
127+ #[ReturnTypeWillChange]
139128 public function offsetUnset ($ offset )
140129 {
141130 $ this ->remove ($ offset );
142131 }
143132
144133 /**
145- * Remove the element with the specified offset
134+ * Remove the element with the specified offset.
146135 *
147136 * @param mixed $offset The offset to remove
137+ *
148138 * @return bool True if removed otherwise false
149139 */
150140 public function remove ($ offset )
151141 {
152- throw new Doctrine_Exception ('Remove is not supported for ' . get_class ($ this ));
142+ throw new Doctrine_Exception ('Remove is not supported for ' . get_class ($ this ));
153143 }
154144
155145 /**
156- * Return the element with the specified offset
146+ * Return the element with the specified offset.
157147 *
158- * @param mixed $offset The offset to return
159- * @return mixed
148+ * @param mixed $offset The offset to return
160149 */
161150 public function get ($ offset )
162151 {
163- throw new Doctrine_Exception ('Get is not supported for ' . get_class ($ this ));
152+ throw new Doctrine_Exception ('Get is not supported for ' . get_class ($ this ));
164153 }
165154
166155 /**
167- * Set the offset to the value
156+ * Set the offset to the value.
168157 *
169158 * @param mixed $offset The offset to set
170- * @param mixed $value The value to set the offset to
171- *
159+ * @param mixed $value The value to set the offset to
172160 */
173161 public function set ($ offset , $ value )
174162 {
175- throw new Doctrine_Exception ('Set is not supported for ' . get_class ($ this ));
163+ throw new Doctrine_Exception ('Set is not supported for ' . get_class ($ this ));
176164 }
177165
178166 /**
179- * Check if the specified offset exists
167+ * Check if the specified offset exists.
180168 *
181169 * @param mixed $offset The offset to check
182- * @return boolean True if exists otherwise false
170+ *
171+ * @return bool True if exists otherwise false
183172 */
184173 public function contains ($ offset )
185174 {
186- throw new Doctrine_Exception ('Contains is not supported for ' . get_class ($ this ));
175+ throw new Doctrine_Exception ('Contains is not supported for ' . get_class ($ this ));
187176 }
188177
189178 /**
190- * Add the value
179+ * Add the value.
191180 *
192181 * @param mixed $value The value to add
193- * @return void
194182 */
195183 public function add ($ value )
196184 {
197- throw new Doctrine_Exception ('Add is not supported for ' . get_class ($ this ));
185+ throw new Doctrine_Exception ('Add is not supported for ' . get_class ($ this ));
198186 }
199187}
0 commit comments