31 lines
551 B
PHP
31 lines
551 B
PHP
<?php
|
|
|
|
class Media implements MediaInterface{
|
|
private $type;
|
|
public $id;
|
|
public $details;
|
|
|
|
public function __construct($mediaType){
|
|
if(array_key_exists($mediaType, Media::$MEDIA_TYPES)){
|
|
$this->type = $mediaType;
|
|
}
|
|
else{
|
|
throw new MediaException("Invalid media type for Media; mediatype '".$mediaType."'");
|
|
}
|
|
}
|
|
|
|
abstract public function asText();
|
|
|
|
public function renderMedia(){
|
|
echo $this->asText();
|
|
}
|
|
|
|
public function getType(){
|
|
return $this->type;
|
|
}
|
|
|
|
public function getTitle(){
|
|
return $this->details;
|
|
}
|
|
}
|
|
?>
|