rfc:functional-elements

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
rfc:functional-elements [2008/03/16 14:10] – Typo lstrojnyrfc:functional-elements [2008/03/16 14:26] – Rewriting required functionality example lstrojny
Line 39: Line 39:
 </code> </code>
  
-==== Extracted functions ==== +==== Required functionality ==== 
-=== spl_iterator_element_call() === +Extracting the required functionality to leads to the following required additions: 
-<code php> +  * [[rfc:functional-elements:call-iterator|class CallIterator]]: a simple iterator which walks over a traversable list (including arraysand calls a specified method. The CallIterator might optionally gather the results 
-array|bool spl_iterator_element_call( +  * function is_traversable(): Returns true if a list is traversable (Iterator/IteratorAggregate/array) 
-    array|Iterator $iterator, +  * function iterate(): Walks over a traversable list and does nothing 
-    string|array $methods, +  * function iterator_true(): Walks over a traversable list and assumes every element to be true 
-    array $params = array(), +  * function iterator_false(): Walks over a traversable list and assumes every element to be false
-    bool $collect = true +
-) +
-</code>+
  
-Iterating over a list of objects, call method "testMethod" and get the list of results: 
-<code php> 
-$result = spl_iterator_element_call($list, 'testMethod'); 
-</code> 
- 
-Iterating over a list of objects, call methods "testMethod" (with param "test") and "otherTestMethod" (with param "other") and get the list of results: 
-<code php> 
-$result = spl_iterator_element_call($list, array('testMethod', 'otherTestMethod'), array('test', 'other')); 
-</code> 
- 
-Iterating over a list of objects, call method 'testMethod' (with param "test1" and "test2") and "otherTestMethod" (with param "other1" and "other2") and get the list of results: 
-<code php> 
-$result = spl_iterator_element_call($list, array('testMethod', 'otherTestMethod'), array(array('test1', 'test2'), array('other1', 'other2'))); 
-</code> 
- 
-=== spl_iterator_element_call_conditional() === 
-<code php> 
-array|mixed spl_iterator_element_call_conditional( 
-    array|Iterator $iterator, 
-    string|array $methods, 
-    string|array $conditions, 
-    array $params = array(), 
-    array $condition_params = array(), 
-    bool $collect = true, 
-    bool $finite = true 
-) 
-</code> 
rfc/functional-elements.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1