예제 #1
0
 public function apply($transformer, $instant_article, $node)
 {
     $video = Video::create();
     // Builds the image
     $url = $this->getProperty(self::PROPERTY_VIDEO_URL, $node);
     if ($url) {
         $video->withURL($url);
         $instant_article->addChild($video);
     } else {
         $transformer->addWarning(new InvalidSelector(self::PROPERTY_VIDEO_URL, $instant_article, $node, $this));
     }
     $video_type = $this->getProperty(self::PROPERTY_VIDEO_TYPE, $node);
     if ($video_type) {
         $video->withContentType($video_type);
     }
     if ($this->getProperty(Video::ASPECT_FIT, $node)) {
         $video->withPresentation(Video::ASPECT_FIT);
     } elseif ($this->getProperty(Video::ASPECT_FIT_ONLY, $node)) {
         $video->withPresentation(Video::ASPECT_FIT_ONLY);
     } elseif ($this->getProperty(Video::FULLSCREEN, $node)) {
         $video->withPresentation(Video::FULLSCREEN);
     } elseif ($this->getProperty(Video::NON_INTERACTIVE, $node)) {
         $video->withPresentation(Video::NON_INTERACTIVE);
     }
     if ($this->getProperty(self::PROPERTY_CONTROLS, $node)) {
         $video->enableControls();
     }
     if ($this->getProperty(self::PROPERTY_PLAYBACK_MODE, $node)) {
         $video->disableAutoplay();
     }
     if ($this->getProperty(self::PROPERTY_LIKE, $node)) {
         $video->enableLike();
     }
     if ($this->getProperty(self::PROPERTY_COMMENTS, $node)) {
         $video->enableComments();
     }
     $suppress_warnings = $transformer->suppress_warnings;
     $transformer->suppress_warnings = true;
     $transformer->transform($video, $node);
     $transformer->suppress_warnings = $suppress_warnings;
     return $instant_article;
 }
예제 #2
0
 public function testIsWithinFalseObj()
 {
     $image = Image::create();
     $video = Video::create();
     $anotherImg = Image::create();
     $result = Type::isWithin($image, [$anotherImg, $video, 'z']);
     $this->assertFalse($result);
 }