public function apply()

in src/Facebook/InstantArticles/Transformer/Rules/CaptionRule.php [69:115]


    public function apply($transformer, $container_of_caption, $node)
    {
        $caption = Caption::create();
        $container_of_caption->withCaption($caption);

        if ($this->getProperty(Caption::POSITION_BELOW, $node)) {
            $caption->withPosition(Caption::POSITION_BELOW);
        }
        if ($this->getProperty(Caption::POSITION_CENTER, $node)) {
            $caption->withPosition(Caption::POSITION_CENTER);
        }
        if ($this->getProperty(Caption::POSITION_ABOVE, $node)) {
            $caption->withPosition(Caption::POSITION_ABOVE);
        }

        if ($this->getProperty(Caption::ALIGN_LEFT, $node)) {
            $caption->withTextAlignment(Caption::ALIGN_LEFT);
        }
        if ($this->getProperty(Caption::ALIGN_CENTER, $node)) {
            $caption->withTextAlignment(Caption::ALIGN_CENTER);
        }
        if ($this->getProperty(Caption::ALIGN_RIGHT, $node)) {
            $caption->withTextAlignment(Caption::ALIGN_RIGHT);
        }

        if ($this->getProperty(Caption::SIZE_SMALL, $node)) {
            $caption->withFontsize(Caption::SIZE_SMALL);
        }
        if ($this->getProperty(Caption::SIZE_MEDIUM, $node)) {
            $caption->withFontsize(Caption::SIZE_MEDIUM);
        }
        if ($this->getProperty(Caption::SIZE_LARGE, $node)) {
            $caption->withFontsize(Caption::SIZE_LARGE);
        }
        if ($this->getProperty(Caption::SIZE_XLARGE, $node)) {
            $caption->withFontsize(Caption::SIZE_XLARGE);
        }

        $text_default = $this->getProperty(self::PROPERTY_DEFAULT, $node);
        if ($text_default) {
            $caption->withTitle($text_default);
        } else {
            $transformer->transform($caption, $node);
        }

        return $container_of_caption;
    }