in src/Facebook/InstantArticles/Transformer/Rules/AdRule.php [51:90]
public function apply($transformer, $instant_article, $node)
{
$ad = Ad::create();
// Builds the ad
$height = $this->getProperty(self::PROPERTY_AD_HEIGHT_URL, $node);
if ($height) {
$ad->withHeight($height);
}
$width = $this->getProperty(self::PROPERTY_AD_WIDTH_URL, $node);
if ($width) {
$ad->withWidth($width);
}
$url = $this->getProperty(self::PROPERTY_AD_URL, $node);
if ($url) {
$ad->withSource($url);
}
$embed_code = $this->getProperty(self::PROPERTY_AD_EMBED_URL, $node);
if ($embed_code) {
$ad->withHTML(Transformer::cloneNode($embed_code));
}
if ($url || $embed_code) {
$instant_article->addChild($ad);
} else {
$transformer->addWarning(
new InvalidSelector(
'embed code or url',
$instant_article,
$node,
$this
)
);
}
return $instant_article;
}