php-kilo/src/MagicProperties.php

20 lines
326 B
PHP

<?php declare(strict_types=1);
namespace Kilo;
trait MagicProperties {
abstract public function __get(string $name);
public function __set(string $name, $value)
{
if (property_exists($this, $name))
{
$this->$name = $value;
}
}
public function __isset(string $name): bool
{
return isset($this->$name);
}
}