public function apply($transformer, $list, $element) { $li = ListItem::create(); $list->addItem($li); $transformer->transform($li, $element); return $list; }
/** * Adds a new item to the List * * @param string|ListItem $new_item The new item that will be pushed to the end of the list * * @return $this */ public function addItem($new_item) { Type::enforce($new_item, [ListItem::getClassName(), Type::STRING]); if (Type::is($new_item, Type::STRING)) { $new_item = ListItem::create()->appendText($new_item); } $this->items[] = $new_item; return $this; }