public function apply()

in src/Facebook/InstantArticles/Transformer/Rules/CaptionCreditRule.php [47:74]


    public function apply($transformer, $caption, $node)
    {
        $cite = Cite::create();
        $caption->withCredit($cite);

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

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

        $transformer->transform($cite, $node);
        return $caption;
    }