diff --git a/reference/objaggregation/functions/aggregate-methods-by-list.xml b/reference/objaggregation/functions/aggregate-methods-by-list.xml index 55f6dff4cc..574382cd72 100644 --- a/reference/objaggregation/functions/aggregate-methods-by-list.xml +++ b/reference/objaggregation/functions/aggregate-methods-by-list.xml @@ -1,6 +1,6 @@ - - + + aggregate_methods_by_list diff --git a/reference/objaggregation/functions/aggregate-methods-by-regexp.xml b/reference/objaggregation/functions/aggregate-methods-by-regexp.xml new file mode 100644 index 0000000000..88d45684f5 --- /dev/null +++ b/reference/objaggregation/functions/aggregate-methods-by-regexp.xml @@ -0,0 +1,70 @@ + + + + + aggregate_methods_by_regexp + + selective class methods aggregation to an object using a regular + expression + + + + Description + + voidaggregate_methods_by_regexp + objectobject + stringclass_name + stringregexp + booleanexclude + + + Aggregates methods from a class to + an existing object using a regular expresion to match method names. + The optional paramater + exclude is used to decide whether the regular + expression will select + the names of methods to include in the aggregation (i.e. + exclude is &false;, which is the default value), + or to exclude from the aggregation (exclude is + &true;). + + + The class constructor or methods + whose names start with an underscore character (_), which are + considered private to the aggregated class, are always + excluded. + + + See also + aggregate, + aggregate_info, + aggregate_methods, + aggregate_methods_by_list, + aggregate_properties, + aggregate_properties_by_list, + aggregate_properties_by_regexp, + deaggregate + + + + + diff --git a/reference/objaggregation/functions/aggregate-properties-by-list.xml b/reference/objaggregation/functions/aggregate-properties-by-list.xml new file mode 100644 index 0000000000..7e21122adf --- /dev/null +++ b/reference/objaggregation/functions/aggregate-properties-by-list.xml @@ -0,0 +1,67 @@ + + + + + aggregate_properties_by_list + + selective dynamic class properties aggregation to an object + + + + Description + + voidaggregate_properties_by_list + objectobject + stringclass_name + arrayproperties_list + booleanexclude + + + Aggregates properties from a class to + an existing object using a list of property names. The optional paramater + exclude is used to decide whether the list + contains the names of class properties to include in the aggregation (i.e. + exclude is &false;, which is the default value), + or to exclude from the aggregation (exclude is + &true;). + + + The properties + whose names start with an underscore character (_), which are + considered private to the aggregated class, are always + excluded. + + + See also + aggregate, + aggregate_methods, + aggregate_methods_by_list, + aggregate_methods_by_regexp, + aggregate_properties, + aggregate_properties_by_regexp, + aggregate_info, + deaggregate + + + + + diff --git a/reference/objaggregation/functions/aggregate-properties-by-regexp.xml b/reference/objaggregation/functions/aggregate-properties-by-regexp.xml new file mode 100644 index 0000000000..1800628b06 --- /dev/null +++ b/reference/objaggregation/functions/aggregate-properties-by-regexp.xml @@ -0,0 +1,70 @@ + + + + + aggregate_properties_by_regexp + + selective class properties aggregation to an object using a regular + expression + + + + Description + + voidaggregate_properties_by_regexp + objectobject + stringclass_name + stringregexp + booleanexclude + + + Aggregates properties from a class to + an existing object using a regular expresion to match their names. + The optional paramater + exclude is used to decide whether the regular + expression will select + the names of class properties to include in the aggregation (i.e. + exclude is &false;, which is the default value), + or to exclude from the aggregation (exclude is + &true;). + + + The properties + whose names start with an underscore character (_), which are + considered private to the aggregated class, are always + excluded. + + + See also + aggregate, + aggregate_methods, + aggregate_methods_by_list, + aggregate_methods_by_regexp, + aggregate_properties, + aggregate_properties_by_list, + aggregate_info, + deaggregate + + + + + diff --git a/reference/objaggregation/functions/aggregate-properties.xml b/reference/objaggregation/functions/aggregate-properties.xml new file mode 100644 index 0000000000..6857b68826 --- /dev/null +++ b/reference/objaggregation/functions/aggregate-properties.xml @@ -0,0 +1,56 @@ + + + + + aggregate_properties + + dynamic aggregation of class properties to an object + + + + Description + + voidaggregate_properties + objectobject + stringclass_name + + + Aggregates all properties defined in a class to + an existing object, except for properties + whose names start with an underscore character (_) which are + considered private to the aggregated class. + + + See also + aggregate, + aggregate_methods, + aggregate_methods_by_list, + aggregate_methods_by_regexp, + aggregate_properties_by_list, + aggregate_properties_by_regexp, + aggregate_info, + deaggregate + + + + + diff --git a/reference/objaggregation/functions/aggregation-info.xml b/reference/objaggregation/functions/aggregation-info.xml new file mode 100644 index 0000000000..57a07d6279 --- /dev/null +++ b/reference/objaggregation/functions/aggregation-info.xml @@ -0,0 +1,147 @@ + + + + + aggregation_info + + returns an associative array of the methods and properties from + each class that has been aggregated to the object. + + + + Description + + arrayaggregation_info + objectobject + + + Will return the aggretaion information for a particular object + as an associative array of arrays of methods and properties. The + key for the main array is the name of the aggregated class. + + + For example the code below + + Using <function>aggregation_info</function> + +vegetable = $vegetable; + } + + function slice_it($num_cuts) { + echo "Doing some simple slicing\n"; + for ($i=0; $i < $num_cuts; $i++) { + // do some slicing + } + } +} + +class Dicer { + var $vegetable; + var $rotation_angle = 90; // degrees + + function Dicer($vegetable) { + $this->vegetable = $vegetable; + } + + function dice_it($num_cuts) { + echo "Cutting in one direction\n"; + for ($i=0; $i < $num_cuts; $i++) { + // do some cutting + } + $this->rotate($this->rotation_angle); + echo "Cutting in a second direction\n"; + for ($i=0; $i < $num_cuts; $i++) { + // do some more cutting + } + } + + function rotate($deg) { + echo "Now rotating {$this->vegetable} {$deg} degrees\n"; + } + + function _secret_super_dicing($num_cuts) { + // so secret we cannot show you ;-) + } +} + +$obj = new Slicer('onion'); +aggregate($obj, 'Dicer'); +print_r(aggregate_info($obj)); +?> +]]> + + + + + Will produce the output + + + Array + ( + [methods] => Array + ( + [0] => dice_it + [1] => rotate + ) + + [properties] => Array + ( + [0] => rotation_angle + ) + + ) + +) +]]> + + + As you can see, all properties and methods of the + Dicer class have been aggregated + into our new object, with the exception of the class + constructor and the method _secret_super_dicing + + + See also + aggregate, + aggregate_methods, + aggregate_methods_by_list, + aggregate_methods_by_regexp, + aggregate_properties, + aggregate_properties_by_list, + aggregate_properties_by_regexp, + deaggregate + + + + + + diff --git a/reference/objaggregation/functions/deaggregate.xml b/reference/objaggregation/functions/deaggregate.xml new file mode 100644 index 0000000000..d830f06a42 --- /dev/null +++ b/reference/objaggregation/functions/deaggregate.xml @@ -0,0 +1,58 @@ + + + + + deaggregate + + removes the aggregated methods and properties from an object + + + + Description + + voidobject_aggregation + objectobject + stringclass_name + + + Removes the methods and properties from classes that were aggregated to + an object. + If the optional class_name parameters is passed, + only those methods and properties defined in that class are removed, + otherwise all aggregated methods and properties are eliminated. + + + See also + aggregate, + aggregate_methods, + aggregate_methods_by_list, + aggregate_methods_by_regexp, + aggregate_properties, + aggregate_properties_by_list, + aggregate_properties_by_regexp, + aggregate_info + + + + + +