File: D:/HostingSpaces/SBogers10/vanderkampen.komma.pro/app/KommaApp/Kms/Core/Entities/KmsEntity.php
<?php
/**
*
*
* @author Komma <info@komma.pro>
* @copyright (c) 2012-2016, Komma
*/
namespace App\KommaApp\Kms\Core\Entities;
abstract class KmsEntity
{
public $id;
public $name;
public $thumbnail;
public $thumbnail_text;
public $status;
function __construct(array $data = [], $id = null)
{
$this->fill($data, $id);
}
public function fill(array $data = [], $id = null)
{
$this->id = $id;
foreach($data as $key => $value)
{
if(property_exists($this, $key)){
$this->{$key} = $value;
}
}
}
public function setId($id)
{
$this->id = $id;
}
public function getId()
{
return $this->id;
}
public function getValue($key)
{
if(property_exists($this, $key))
{
return $this->{$key};
}
return null;
}
public function setValue($key, $value)
{
if(property_exists($this, $key))
{
return $this->{$key} = $value;
}
return null;
}
abstract public function getName();
public function getThumbnail()
{
if(isset($this->thumbnail) && $this->thumbnail != "")
{
return '<img src="'.$this->thumbnail.'"/>';
}
if(isset($this->thumbnail_text) && $this->thumbnail_text != "")
{
return trim($this->thumbnail_text);
}
return substr($this->getName(), 0, 1);
}
public function setStatus($status){
$this->status = $status;
}
public function getStatus(){
return null;
}
}