HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers47/leden.ehbocranendonck.nl/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;
    }
}