php-kilo/src/Traits/MagicProperties.php

20 lines
351 B
PHP
Raw Normal View History

2019-10-24 16:57:27 -04:00
<?php declare(strict_types=1);
2019-11-19 15:57:51 -05:00
namespace Aviat\Kilo\Traits;
2019-10-24 16:57:27 -04:00
trait MagicProperties {
abstract public function __get(string $name);
2021-03-04 12:03:51 -05:00
public function __set(string $name, mixed $value): void
2019-10-24 16:57:27 -04:00
{
if (property_exists($this, $name))
{
$this->$name = $value;
}
}
public function __isset(string $name): bool
{
return isset($this->$name);
}
}