| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <?php
- /*
- * This file is part of Alchemy\BinaryDriver.
- *
- * (c) Alchemy <info@alchemy.fr>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
- namespace Alchemy\BinaryDriver;
- class Configuration implements ConfigurationInterface
- {
- private $data;
- public function __construct(array $data = array())
- {
- $this->data = $data;
- }
- /**
- * {@inheritdoc}
- */
- public function getIterator()
- {
- return new \ArrayIterator($this->data);
- }
- /**
- * {@inheritdoc}
- */
- public function get($key, $default = null)
- {
- return isset($this->data[$key]) ? $this->data[$key] : $default;
- }
- /**
- * {@inheritdoc}
- */
- public function set($key, $value)
- {
- $this->data[$key] = $value;
- return $this;
- }
- /**
- * {@inheritdoc}
- */
- public function has($key)
- {
- return array_key_exists($key, $this->data);
- }
- /**
- * {@inheritdoc}
- */
- public function remove($key)
- {
- $value = $this->get($key);
- unset($this->data[$key]);
- return $value;
- }
- /**
- * {@inheritdoc}
- */
- public function all()
- {
- return $this->data;
- }
- /**
- * {@inheritdoc}
- */
- public function offsetExists($offset)
- {
- return $this->has($offset);
- }
- /**
- * {@inheritdoc}
- */
- public function offsetGet($offset)
- {
- return $this->get($offset);
- }
- /**
- * {@inheritdoc}
- */
- public function offsetSet($offset, $value)
- {
- $this->set($offset, $value);
- }
- /**
- * {@inheritdoc}
- */
- public function offsetUnset($offset)
- {
- $this->remove($offset);
- }
- }
|