in src/Facebook/InstantArticles/Transformer/Rules/AuthorRule.php [51:89]
public function apply($transformer, $header, $node)
{
$author = Author::create();
// Builds the author
$url = $this->getProperty(self::PROPERTY_AUTHOR_URL, $node);
$name = $this->getProperty(self::PROPERTY_AUTHOR_NAME, $node);
$role_contribution = $this->getProperty(self::PROPERTY_AUTHOR_ROLE_CONTRIBUTION, $node);
$description = $this->getProperty(self::PROPERTY_AUTHOR_DESCRIPTION, $node);
if ($name) {
$author->withName($name);
$header->addAuthor($author);
} else {
$transformer->addWarning(
new InvalidSelector(
self::PROPERTY_AUTHOR_NAME,
$header,
$node,
$this
)
);
}
if ($role_contribution) {
$author->withRoleContribution($role_contribution);
}
if ($description) {
$author->withDescription($description);
}
if ($url) {
$author->withURL($url);
}
return $header;
}