Minor changes
This commit is contained in:
parent
05cc358eea
commit
e9d033044c
27 changed files with 949 additions and 94 deletions
57
src/RTEX/Objects/Engine/Configuration.php
Normal file
57
src/RTEX/Objects/Engine/Configuration.php
Normal file
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
/** @noinspection PhpMissingFieldTypeInspection */
|
||||
|
||||
namespace RTEX\Objects\Engine;
|
||||
|
||||
use RTEX\Objects\Engine\Configuration\RedisHook;
|
||||
|
||||
class Configuration
|
||||
{
|
||||
/**
|
||||
* The redis hook configuration
|
||||
*
|
||||
* @var RedisHook
|
||||
*/
|
||||
private $RedisHook;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->RedisHook = new RedisHook();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the redis hook configuration
|
||||
*
|
||||
* @return RedisHook
|
||||
*/
|
||||
public function getRedisHook(): RedisHook
|
||||
{
|
||||
return $this->RedisHook;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array representation of the configuration
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'redis_hook' => $this->RedisHook->toArray()
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a configuration object from an array
|
||||
*
|
||||
* @param array $data
|
||||
* @return static
|
||||
*/
|
||||
public static function fromArray(array $data): self
|
||||
{
|
||||
$instance = new self();
|
||||
$instance->RedisHook = RedisHook::fromArray(($data['redis_hook'] ?? []));
|
||||
return $instance;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue