for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Sioen\JsonToHtml;
final class IframeConverter implements Converter
{
public function toHtml(array $data)
// youtube video's
$source = $data['source'];
$remoteId = $data['remote_id'];
if ($source == 'youtube') {
$html = '<iframe src="//www.youtube.com/embed/' . $remoteId . '?rel=0" ';
$html .= 'frameborder="0" allowfullscreen></iframe>' . "\n";
return $html;
}
// vimeo videos
if ($source == 'vimeo') {
$html = '<iframe src="//player.vimeo.com/video/' . $remoteId;
$html .= '?title=0&byline=0" frameborder="0"></iframe>' . "\n";
// fallback
return '';
public function matches($type)
return $type === 'video';