/** * factory method, create either Item or List object from title * * @author ADi * @param Title $title * @return TopListBase */ public static function newFromTitle(Title $title) { $object = null; if ($title->getNamespace() == NS_TOPLIST) { if (!$title->isSubpage()) { $object = TopList::newFromTitle($title); } else { $object = TopListItem::newFromTitle($title); } } return $object; }
/** * @author ADi */ public function removeItems() { foreach ($this->mTitle->getSubpages() as $subpageTitle) { $item = TopListItem::newFromTitle($subpageTitle); $item->remove(); } }