<?php
namespace PHPFUI\MySQLSlowQuery;
abstract class BaseObject
{
protected array $fields = [];
abstract public function __construct(array $parameters = []);
public function __get(string $field)
{
if (! \array_key_exists($field, $this->fields))
{
throw new Exception\Get("{$field} is not a valid field for " . static::class);
}
return $this->fields[$field];
}
public function __set(string $field, mixed $value)
{
if (! \array_key_exists($field, $this->fields))
{
throw new Exception\Set("{$field} is not a valid field for " . static::class);
}
$this->fields[$field] = $value;
}
public function asArray() : array
{
return $this->fields;
}
}