public function apply($transformer, $header, $node) { $page_url = $this->getProperty(self::PROPERTY_SPONSOR_PAGE_URL, $node); if ($page_url && !Type::isTextEmpty($page_url)) { $sponsor = Sponsor::create(); $header->withSponsor($sponsor); $sponsor->withPageUrl($page_url); } return $header; }
/** * Sets the sponsor for this Article. * * @param Sponsor $sponsor The sponsor of article to be set. * * @return $this */ public function withSponsor($sponsor) { Type::enforce($sponsor, Sponsor::getClassName()); $this->sponsor = $sponsor; return $this; }