Source of file ArrayConfig.php
Size: 1,496 Bytes - Last Modified: 2021-12-24T06:50:57+00:00
/var/www/docs.ssmods.com/process/src/src/Configs/ArrayConfig.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 | <?php namespace Heyday\CacheInclude\Configs; class ArrayConfig implements ConfigInterface { /** * @var array */ protected $config; /** * @param array|void $config */ public function __construct(array $config = []) { $this->config = $config; } /** * @param array $config */ public function setConfig(array $config) { if (is_array($config)) { $this->config = $config; } } /** * @param mixed $id * @param mixed $value * @throws \Exception */ public function offsetSet($id, $value) { throw new \Exception('Configs are immutable'); } /** * @param mixed $id * @return mixed * @throws \InvalidArgumentException */ public function offsetGet($id) { if (!array_key_exists($id, $this->config)) { throw new \InvalidArgumentException(sprintf('Config "%s" is not defined.', $id)); } return $this->config[$id]; } /** * @param mixed $id * @return bool */ public function offsetExists($id) { return isset($this->config[$id]); } /** * @param mixed $id * @throws \Exception */ public function offsetUnset($id) { throw new \Exception('Configs are immutable'); } /** * @return \ArrayIterator */ public function getIterator() { return new \ArrayIterator($this->config); } } |