Eno\ListElement » items

items() → array
items($options) → array
items($loader) → array
items($loader, $options) → array

Retrieve the items of the list, optionally passing them through a loader function.

- pink
- peach
php$list = Parser::parse($input)->element('colors');

$list->items();  // returns ['pink', 'peach']
$list->items(function($value) { return "{$value}!!"; });  // returns ['pink!!', 'peach!!']



A function returning the transformed/validated value or throwing an error. (The function is applied to each list item on its own and its argument signature is dynamic, you can either use ($value) or ($name, $value))



Whether to return the elements (as Field) instead of the values of the list items. (defaults to false)


Whether empty list items (- in the document, mapping to null) are disallowed (defaults to true)


Whether to return an array of arrays of the form [ 'element' => ..., 'value' => ... ] instead of just the values (defaults to false)

Return value

The (optionally transformed/validated) items of this list as an array.