<?php

abstract class Content {

    protected $filePath;

    public function __construct (string $filePath) {
        $this->filePath = $filePath;
    }

    abstract public function getHtml (): string;

    abstract public function getCss (): string;

}


class Image extends Content {

    public function getCss (): string {
        return <<<IMG
		.content {
			width: 100%;
			border-style: dotted dashed solid double; 
			border-radius: 50px;
		}
IMG;
    }

    public function getHtml (): string {
        return "<img class='content' src='$this->filePath' />";
    }
}


class Video extends Content {

    public function getCss (): string {
        return <<<VID
		.content {
			width: 100%; 
		}
		video::-webkit-media-controls-start-playback-button {
            display: none;
		}
VID;
    }

    public function getHtml (): string {
        return "<video class='content' src='$this->filePath' autoplay muted loop></video>";
    }
}


abstract class Display {

    protected $content;

    public function __construct (Content $content) {
        $this->content = $content;
    }

    abstract public function render (): string;

}


class Standard extends Display {

    public function render (): string {

        $html = $this->content->getHtml();
        $css = $this->content->getCss();

        return <<<CONTENT
			$html;
			
			<style>
				$css	
			</style>
CONTENT;
    }
}


class Blurred extends Display {

    private $blurredRules = <<<CSS
		.content {
			filter: blur(5px);
		  	-webkit-filter: blur(5px);
		}
CSS;


public function render (): string 
{
        $html = $this->content->getHtml();
        $css = $this->content->getCss();

        return <<<CONTENT
			$html;
			
			<style>
				$css	
				$this->blurredRules
			</style>
CONTENT;
    }
}


$vid = new Video("demo.mp4");
$img = new Image("demo.png");

$displayVid = new Standard($vid);
$blurredDisplayVid = new Blurred($vid);

$displayImg = new Standard($img);
$blurredDisplayImg = new Blurred($img);

echo($displayVid->render() . PHP_EOL);
echo($blurredDisplayVid->render() . PHP_EOL);

echo($displayImg->render() . PHP_EOL);
echo($blurredDisplayImg->render() . PHP_EOL);
// USAGE