src/Model/Common/OwnerConfig.php line 7
<?php
namespace App\Model\Common;
use ArrayAccess;
class OwnerConfig implements ArrayAccess
{
public const REPOSITORY_SINGLE = 'single';
public const REPOSITORY_FORUM_THREADS = 'forum_threads';
private $key;
/**
* @var array
*/
private $config;
public function __construct($key, array $config)
{
$this->key = $key;
$this->config = $config;
}
public function getCaption()
{
return $this->config['caption'];
}
public function getClass()
{
return $this->config['class'];
}
public function getRepositorySingle()
{
return $this->getRepository(self::REPOSITORY_SINGLE);
}
public function getRepository($method)
{
return $this->config['repository'][$method];
}
public function getRouteName()
{
return $this->config['route']['name'];
}
public function getRouteParams()
{
return $this->config['route']['params'];
}
public function getId()
{
return $this->config['identity'];
}
public function getAdminListRepositoryMethod()
{
return $this->getRepository('admin_list');
}
public function getRender()
{
return $this->config['render'];
}
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->config[] = $value;
} else {
$this->config[$offset] = $value;
}
}
public function offsetExists($offset): bool
{
return isset($this->config[$offset]);
}
public function offsetUnset($offset): void
{
unset($this->config[$offset]);
}
public function offsetGet($offset)
{
return isset($this->config[$offset]) ? $this->config[$offset] : null;
}
}