rfc:functional-elements
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionNext revisionBoth sides next revision | ||
rfc:functional-elements [2008/03/06 02:00] – Initial creation. Introduction, current use cases lstrojny | rfc:functional-elements [2008/03/06 02:28] – Adding work in progress notice lstrojny | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | This RFC is still work in progress | ||
+ | ---- | ||
====== Functional elements for object lists ====== | ====== Functional elements for object lists ====== | ||
==== Abstract ==== | ==== Abstract ==== | ||
A common pattern in PHP is iterating through a list of objects and executing certain methods of the function. This is especially common when it comes to 1: | A common pattern in PHP is iterating through a list of objects and executing certain methods of the function. This is especially common when it comes to 1: | ||
- | ==== Current | + | ==== Current |
=== UC-1 === | === UC-1 === | ||
<code php> | <code php> | ||
foreach ($list as $element) { | foreach ($list as $element) { | ||
$element-> | $element-> | ||
+ | array $params = array(), | ||
+ | array $condition_params = array(), | ||
+ | bool $collect = true, | ||
+ | bool $finite = true | ||
} | } | ||
</ | </ | ||
Line 36: | Line 42: | ||
} | } | ||
} | } | ||
+ | </ | ||
+ | |||
+ | ==== Extracted functions ==== | ||
+ | === spl_iterator_element_call() === | ||
+ | <code php> | ||
+ | array|bool spl_iterator_element_call( | ||
+ | array|Iterator $iterator, | ||
+ | string|array $methods, | ||
+ | array $params = array(), | ||
+ | bool $collect = true | ||
+ | ) | ||
+ | </ | ||
+ | |||
+ | Iterating over a list of objects, call method " | ||
+ | <code php> | ||
+ | $result = spl_iterator_element_call($list, | ||
+ | </ | ||
+ | |||
+ | Iterating over a list of objects, call methods " | ||
+ | <code php> | ||
+ | $result = spl_iterator_element_call($list, | ||
+ | </ | ||
+ | |||
+ | Iterating over a list of objects, call method ' | ||
+ | <code php> | ||
+ | $result = spl_iterator_element_call($list, | ||
+ | </ | ||
+ | |||
+ | === 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 | ||
+ | ) | ||
</ | </ |
rfc/functional-elements.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1