for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace MediaMonks\SonataMediaBundle\Provider;
use MediaMonks\SonataMediaBundle\Exception\InvalidProviderUrlException;
class VimeoProvider extends AbstractOembedProvider implements ProviderInterface, EmbeddableProviderInterface
{
const URL_OEMBED = 'https://vimeo.com/api/oembed.json?url=http://vimeo.com/%s';
/**
* @param $value
* @return string
* @throws \Exception
*/
public function parseProviderReference($value): string
if (strpos($value, 'vimeo.com')) {
$urlParts = explode('/', parse_url($value, PHP_URL_PATH));
foreach ($urlParts as $urlPart) {
if (ctype_digit($urlPart)) {
return $urlPart;
}
throw new InvalidProviderUrlException('Vimeo');
return $value;
* @param string $id
public function getOembedUrl($id): string
return sprintf(self::URL_OEMBED, $id);
public function getIcon(): string
return 'fa fa-vimeo';
public function getName(): string
return 'vimeo';
public function getType(): string
return AbstractProvider::TYPE_VIDEO;