public function __construct($header) { $links = explode(',', $header); foreach ($links as $link) { list($url, $rel) = explode(';', $link); $page = new Page($url, $rel); if ($page->isFirst()) { $this->first = $page; } else { if ($page->isNext()) { $this->next = $page; } else { if ($page->isPrev()) { $this->prev = $page; } else { if ($page->isLast()) { $this->last = $page; } } } } } }