public function apply($transformer, $list, $element) { $li = ListItem::create(); $list->addItem($li); $transformer->transform($li, $element); return $list; }
/** * Sets all items of the list as the array on the parameter * * @param string|[]ListItem[] $new_items The new items. Replaces all items from the list * * @return $this */ public function withItems($new_items) { Type::enforceArrayOf($new_items, [ListItem::getClassName(), Type::STRING]); $this->items = []; foreach ($new_items as $new_item) { $this->addItem($new_item); } return $this; }