private function parsePage($pageId, $pageData) { $builder = RandomPageBuilder::Begin($pageId); foreach ($pageData as $key => $value) { switch ($key) { case 'ns': $builder->setNs($value); break; case 'title': $builder->setTitle($value); break; case 'contentmodel': $builder->setContentModel($value); break; case 'pagelanguage': $builder->setPageLanguage($value); break; case 'pagelanguagehtmlcode': $builder->setPageLanguageHtmlCode($value); break; case 'pagelanguagedir': $builder->setPageLanguageDir($value); break; case 'touched': $builder->setTouched($value); break; case 'lastrevid': $builder->setLastRevId($value); break; case 'length': $builder->setLength($value); break; case 'displaytitle': $builder->setDisplayTitle($value); break; default: break; } } return $builder->build(); }
/** * RandomPage constructor from builder */ public function __construct(RandomPageBuilder $b) { $this->id = $b->getId(); $this->ns = $b->getNs(); $this->title = $b->getTitle(); $this->contentModel = $b->getContentModel(); $this->pageLanguage = $b->getPageLanguage(); $this->pageLanguageHtmlCode = $b->getPageLanguageHtmlCode(); $this->pageLanguageDir = $b->getPageLanguageDir(); $this->touched = $b->getTouched(); $this->lastRevId = $b->getLastRevId(); $this->length = $b->getLength(); $this->displayTitle = $b->getDisplayTitle(); $this->fullUrl = $b->getFullUrl(); }