src/Eccube/Common/EccubeConfig.php line 18

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of EC-CUBE
  4.  *
  5.  * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  6.  *
  7.  * http://www.ec-cube.co.jp/
  8.  *
  9.  * For the full copyright and license information, please view the LICENSE
  10.  * file that was distributed with this source code.
  11.  */
  12. namespace Eccube\Common;
  13. use Symfony\Component\DependencyInjection\ContainerInterface;
  14. class EccubeConfig implements \ArrayAccess
  15. {
  16.     /**
  17.      * @var ContainerInterface
  18.      */
  19.     protected $container;
  20.     public function __construct(ContainerInterface $container)
  21.     {
  22.         $this->container $container;
  23.     }
  24.     /**
  25.      * @param $key
  26.      *
  27.      * @return mixed
  28.      */
  29.     public function get($key)
  30.     {
  31.         return $this->container->getParameter($key);
  32.     }
  33.     /**
  34.      * @param $key
  35.      *
  36.      * @return bool
  37.      */
  38.     public function has($key)
  39.     {
  40.         return $this->container->hasParameter($key);
  41.     }
  42.     /**
  43.      * @param $key
  44.      * @param $value
  45.      */
  46.     public function set($key$value)
  47.     {
  48.         $this->container->setParameter($key$value);
  49.     }
  50.     /**
  51.      * @param mixed $offset
  52.      *
  53.      * @return bool
  54.      */
  55.     #[\ReturnTypeWillChange]
  56.     public function offsetExists($offset)
  57.     {
  58.         return $this->has($offset);
  59.     }
  60.     /**
  61.      * @param mixed $offset
  62.      *
  63.      * @return mixed
  64.      */
  65.     #[\ReturnTypeWillChange]
  66.     public function offsetGet($offset)
  67.     {
  68.         return $this->get($offset);
  69.     }
  70.     /**
  71.      * @param mixed $offset
  72.      * @param mixed $value
  73.      */
  74.     #[\ReturnTypeWillChange]
  75.     public function offsetSet($offset$value)
  76.     {
  77.         $this->set($offset$value);
  78.     }
  79.     /**
  80.      * @param mixed $offset
  81.      *
  82.      * @throws \Exception
  83.      */
  84.     #[\ReturnTypeWillChange]
  85.     public function offsetUnset($offset)
  86.     {
  87.         throw new \Exception();
  88.     }
  89. }