/** * Determine what type of embed to use * Returns one of the following values: * 'entity' - URL represents and entity * 'image' - URL points to an image file * 'src' - URL points to a parseable resource/page * 'default' - URL has no meaningful meta tags * * @return string */ public function getType() { if ($this->getEntity()) { return self::TYPE_ENTITY; } else { if ($this->url->isValid() && $this->url->isReachable()) { if ($this->url->isImageFile()) { return self::TYPE_IMAGE; } else { if ($this->getMeta()) { return self::TYPE_SRC; } } } } return self::TYPE_DEFAULT; }
/** * @covers ::isValid * @dataProvider providerIsValid */ public function testIsValid($input, $output) { $this->object->setURL($input); $this->assertEquals($this->object->isValid(), $output); }