/**
  * @covers Kunstmaan\MediaBundle\Helper\RemoteSlide\RemoteSlideHelper::getMedia
  */
 public function testGetMedia()
 {
     $this->assertEquals(RemoteSlideHandler::CONTENT_TYPE, $this->object->getMedia()->getContentType());
 }
 /**
  * @param mixed $data
  *
  * @return Media
  */
 public function createNew($data)
 {
     $result = null;
     if (is_string($data)) {
         if (strpos($data, 'http') !== 0) {
             $data = 'http://' . $data;
         }
         $parsedUrl = parse_url($data);
         switch ($parsedUrl['host']) {
             case 'www.slideshare.net':
             case 'slideshare.net':
                 $result = new Media();
                 $slide = new RemoteSlideHelper($result);
                 $slide->setType('slideshare');
                 $json = json_decode(file_get_contents('http://www.slideshare.net/api/oembed/2?url=' . $data . '&format=json'));
                 $slide->setCode($json->{"slideshow_id"});
                 $result = $slide->getMedia();
                 $result->setName('SlideShare ' . $data);
                 break;
         }
     }
     return $result;
 }