wip
This commit is contained in:
@@ -297,12 +297,31 @@ function view_loan_order_permission_id(): int
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an anonymous class that acts as a dynamic object.
|
||||
*
|
||||
* @param mixed ...$arguments Key-value pairs passed as an associative array.
|
||||
* @return object Anonymous class instance with dynamic properties.
|
||||
*/
|
||||
function emptyClass(...$arguments): object
|
||||
{
|
||||
/**
|
||||
* @var array<string, mixed> $arguments
|
||||
*/
|
||||
return new class($arguments)
|
||||
{
|
||||
/**
|
||||
* Internal data storage.
|
||||
*
|
||||
* @var array<string, mixed>
|
||||
*/
|
||||
private array $data = [];
|
||||
|
||||
/**
|
||||
* Constructor that sets properties.
|
||||
*
|
||||
* @param array<string, mixed> $props
|
||||
*/
|
||||
public function __construct(array $props)
|
||||
{
|
||||
foreach ($props as $key => $value) {
|
||||
@@ -310,17 +329,36 @@ function emptyClass(...$arguments): object
|
||||
}
|
||||
}
|
||||
|
||||
public function __get($key)
|
||||
/**
|
||||
* Magic getter.
|
||||
*
|
||||
* @param string $key
|
||||
* @return mixed|null
|
||||
*/
|
||||
public function __get(string $key): mixed
|
||||
{
|
||||
return $this->data[$key] ?? null;
|
||||
}
|
||||
|
||||
public function __set($key, $value)
|
||||
/**
|
||||
* Magic setter.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
*/
|
||||
public function __set(string $key, mixed $value): void
|
||||
{
|
||||
$this->data[$key] = $value;
|
||||
}
|
||||
|
||||
public function __isset($key): bool
|
||||
/**
|
||||
* Magic isset.
|
||||
*
|
||||
* @param string $key
|
||||
* @return bool
|
||||
*/
|
||||
public function __isset(string $key): bool
|
||||
{
|
||||
return isset($this->data[$key]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user