Is this a qualified OOP script in PHP?
Pinoniq has the right idea, which can be taken a bit further:

VideoFactory $vf = new VideoFactory();
Video $video = $vf-&gt;createVideo( "http://youtube.com/..." );
$video-&gt;setDimensions( 640, 480 );
$video-&gt;embed();


Here, the VideoFactory can parse a URL. The createVideo method would return a subclass of Video, which is a YouTubeVideo. However, the implementation need not be dependent on YouTube. This allows you to also write:

VideoFactory $vf = new VideoFactory();
Video $video = $vf-&gt;createVideo( "http://vimeo.com/..." );
$video-&gt;setDimensions( 640, 480 );
$video-&gt;embed();


You'll note that the only item that changed is the URL, but both video formats can be embedded.