Is this a qualified OOP script in PHP? class Youtube
{
    private $url = null;
    private $id;

    public function __construct($url)
    {
        $this-&gt;url = $url;
        $this-&gt;parseUrl($url);
    }

    protected function parseUrl($url)
    {

        if (preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&amp;]v=)|youtu\.be/)([^"&amp;?/ ]{11})%i', $url, $match)) {
            $this-&gt;id = $match[1];
        }
        else
        {
            throw new exception('Cannot find an ID!');
        }

    }


    public function getVideo($width='560', $height='315')
    {
        $video = &lt;&lt;&lt;EOF
        &lt;iframe width="$width" height="$height" src="//www.youtube-nocookie.com/embed/$this-&gt;id" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;
EOF;

        return $video;
    }


}

$sistar = new Youtube('http://www.youtube.com/watch?v=JtVhwsACgTw');
print $sistar-&gt;getVideo();

$twoneone = new Youtube('http://www.youtube.com/watch?v=LUrUPzLm5SI');
print $twoneone-&gt;getVideo();


This is my first object-oriented script in PHP (I hope it's not too bad in general). I know I should do more validation and commenting within the code. Do you have any suggestions for improving the quality of the code?
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.