/** * Get an array of pages that have either pending comments or recently approved comments, with page IDs for keys * * @return array */ public function getPages() { $this->_load(); if (null === $this->_pages) { $pages = $this->_pageLoader->getByID($this->_pageIDs); $this->_pages = []; foreach ($pages as $page) { $this->_pages[$page->id] = $page; } } return $this->_pages; }
/** * @param $shopPageIDs * @throws \InvalidArgumentException */ private function _setShopPages($shopPageIDs) { if (empty($shopPageIDs)) { return; } if (!is_array($shopPageIDs)) { $shopPageIDs = [$shopPageIDs]; } foreach ($shopPageIDs as $id) { if (!is_int($id)) { throw new \InvalidArgumentException('Shop page IDs must all be integers'); } } $pages = (array) $this->_pageLoader->getByID($shopPageIDs); $shopPages = []; foreach ($pages as $page) { $shopPages[$page->id] = $page->title; } reset($shopPages); $this->_shopPages = $shopPages; }