From 282e5e195e9031c62fd4d38db896f1bdc6f690aa Mon Sep 17 00:00:00 2001 From: Juliette Date: Wed, 1 Jul 2009 13:29:56 +0000 Subject: [PATCH] Update ArrayObject skeleton docs git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@283261 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/spl/arrayobject/append.xml | 79 ++++++++++++++++++++-- reference/spl/arrayobject/construct.xml | 35 +++++++++- reference/spl/arrayobject/count.xml | 49 ++++++++++++-- reference/spl/arrayobject/offsetexists.xml | 35 ++++++++-- reference/spl/arrayobject/offsetget.xml | 35 ++++++++-- reference/spl/arrayobject/offsetset.xml | 67 ++++++++++++++++-- reference/spl/arrayobject/offsetunset.xml | 34 ++++++++-- 7 files changed, 302 insertions(+), 32 deletions(-) diff --git a/reference/spl/arrayobject/append.xml b/reference/spl/arrayobject/append.xml index 32a944ff88..5cea1eca51 100644 --- a/reference/spl/arrayobject/append.xml +++ b/reference/spl/arrayobject/append.xml @@ -1,5 +1,5 @@ - + ArrayObject::append @@ -9,15 +9,34 @@ &reftitle.description; voidArrayObject::append - mixednewval + mixedvalue - - &warn.undocumented.func; + + Appends a new value as the last element. + + + + This method cannot be called when the ArrayObject + was constructed from an object. + Use ArrayObject::offsetset instead. + + &reftitle.parameters; - &no.function.parameters; + + + + value + + + The value being appended. + + + + + @@ -27,6 +46,56 @@ + + &reftitle.examples; + + + <methodname>ArrayObject::append</methodname> example + +append('fourth'); +$arrayobj->append(array('five', 'six')); +var_dump($arrayobj); +?> +]]> + + &example.outputs; + + + string(5) "first" + [1]=> + string(6) "second" + [2]=> + string(5) "third" + [3]=> + string(6) "fourth" + [4]=> + array(2) { + [0]=> + string(4) "five" + [1]=> + string(3) "six" + } +} +]]> + + + + + + + &reftitle.seealso; + + + ArrayObject::offsetset + + + + + ArrayObject::__construct @@ -10,7 +10,9 @@ &reftitle.description; ArrayObject::__construct - mixedinput + mixedinput + intflags + stringiterator_class This constructs a new array object. @@ -26,7 +28,24 @@ The input parameter accepts an - array or another ArrayObject. + array or an Object. + + + + + flags + + + Flags to control the behaviour of the ArrayObject object. + + + + + iterator_class + + + Specify the class that will be used for iteration of the ArrayObject object. + ArrayIterator is the default class used. @@ -75,6 +94,16 @@ object(ArrayObject)#1 (3) { + + + &reftitle.seealso; + + + ArrayObject::setflags + + + + + ArrayObject::count - Get the number of elements in the Iterator + Get the number of public properties in the ArrayObject &reftitle.description; @@ -11,8 +11,9 @@ intArrayObject::count - - &warn.undocumented.func; + + Get the number of public properties in the ArrayObject. + @@ -23,10 +24,48 @@ &reftitle.returnvalues; - The number of elements in the Iterator. + The number of public properties in the ArrayObject. + + + When the ArrayObject is constructed from an array all properties are public. + + + + &reftitle.examples; + + + <methodname>ArrayObject::count</methodname> example + +count()); + +$arrayobj = new ArrayObject(array('first','second','third')); +var_dump($arrayobj->count()); +?> +]]> + + &example.outputs; + + + + + + + + ArrayObject::offsetExists - Returns whether the requested $index exists + Returns whether the requested index exists &reftitle.description; @@ -11,8 +11,6 @@ boolArrayObject::offsetExists mixedindex - - &warn.undocumented.func; @@ -34,7 +32,34 @@ &reftitle.returnvalues; - &true; if the requested $index exists, otherwise &false; + &true; if the requested index exists, otherwise &false; + + + + + &reftitle.examples; + + + <methodname>ArrayObject::offsetexists</methodname> example + +'e.g.')); +var_dump($arrayobj->offsetexists(1)); +var_dump($arrayobj->offsetexists('example')); +var_dump($arrayobj->offsetexists('notfound')); +?> +]]> + + &example.outputs; + + + + diff --git a/reference/spl/arrayobject/offsetget.xml b/reference/spl/arrayobject/offsetget.xml index 3c0685fd52..eae413a781 100644 --- a/reference/spl/arrayobject/offsetget.xml +++ b/reference/spl/arrayobject/offsetget.xml @@ -1,9 +1,9 @@ - + ArrayObject::offsetGet - Returns the value at the specified $index + Returns the value at the specified index &reftitle.description; @@ -11,8 +11,6 @@ mixedArrayObject::offsetGet mixedindex - - &warn.undocumented.func; @@ -34,7 +32,34 @@ &reftitle.returnvalues; - The value at the specified $index. + The value at the specified index or &false;. + + + + + &reftitle.examples; + + + <methodname>ArrayObject::offsetget</methodname> example + +'e.g.')); +var_dump($arrayobj->offsetget(1)); +var_dump($arrayobj->offsetget('example')); +var_dump($arrayobj->offsetexists('notfound')); +?> +]]> + + &example.outputs; + + + + diff --git a/reference/spl/arrayobject/offsetset.xml b/reference/spl/arrayobject/offsetset.xml index 06b3895a38..965158de2e 100644 --- a/reference/spl/arrayobject/offsetset.xml +++ b/reference/spl/arrayobject/offsetset.xml @@ -1,9 +1,9 @@ - + ArrayObject::offsetSet - Sets the value at the specified $index to $newval + Sets the value at the specified index to newval &reftitle.description; @@ -13,8 +13,6 @@ mixednewval - &warn.undocumented.func; - Sets the value at the specified index to newval. @@ -51,6 +49,67 @@ + + &reftitle.examples; + + + <methodname>ArrayObject::offsetset</methodname> example + +offsetset(4, 'four'); +$arrayobj->offsetset('group', array('g1', 'g2')); +var_dump($arrayobj); + +$arrayobj = new ArrayObject(array('zero','one')); +$arrayobj->offsetset(null, 'last'); +var_dump($arrayobj); +?> +]]> + + &example.outputs; + + + string(11) "prop:public" + [4]=> + string(4) "four" + ["group"]=> + array(2) { + [0]=> + string(2) "g1" + [1]=> + string(2) "g2" + } +} +object(ArrayObject)#3 (3) { + [0]=> + string(4) "zero" + [1]=> + string(3) "one" + [2]=> + string(4) "last" +} +]]> + + + + + + + &reftitle.seealso; + + + ArrayObject::append + + + + + ArrayObject::offsetUnset - Unsets the value at the specified $index + Unsets the value at the specified index &reftitle.description; @@ -11,9 +11,6 @@ voidArrayObject::offsetUnset mixedindex - - &warn.undocumented.func; - Unsets the value at the specified index. @@ -42,6 +39,33 @@ + + &reftitle.examples; + + + <methodname>ArrayObject::offsetunset</methodname> example + +'zero',2=>'two')); +$arrayobj->offsetunset(2); +var_dump($arrayobj); +?> +]]> + + &example.outputs; + + + string(4) "zero" +} +]]> + + + + +