vendor/sulu/sulu/src/Sulu/Component/Content/Document/Extension/ExtensionContainer.php line 72

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of Sulu.
  4.  *
  5.  * (c) Sulu GmbH
  6.  *
  7.  * This source file is subject to the MIT license that is bundled
  8.  * with this source code in the file LICENSE.
  9.  */
  10. namespace Sulu\Component\Content\Document\Extension;
  11. /**
  12.  * Container for extension data.
  13.  *
  14.  * See documentation for ManagedExtensionContainer.
  15.  */
  16. class ExtensionContainer implements \ArrayAccess\Iterator
  17. {
  18.     /**
  19.      * @var array
  20.      */
  21.     protected $data;
  22.     public function __construct(array $data = [])
  23.     {
  24.         $this->data $data;
  25.     }
  26.     /**
  27.      * Return an array representation of the data.
  28.      *
  29.      * If this is an instance of ManagedExtensionContainer, then
  30.      * the data will represent the processed extension data.
  31.      *
  32.      * @return array
  33.      */
  34.     public function toArray()
  35.     {
  36.         return $this->data;
  37.     }
  38.     #[\ReturnTypeWillChange]
  39.     public function offsetExists($offset)
  40.     {
  41.         return isset($this->data[$offset]);
  42.     }
  43.     #[\ReturnTypeWillChange]
  44.     public function offsetGet($extensionName)
  45.     {
  46.         if (isset($this->data[$extensionName])) {
  47.             return $this->data[$extensionName];
  48.         }
  49.         return;
  50.     }
  51.     #[\ReturnTypeWillChange]
  52.     public function offsetSet($extensionName$data)
  53.     {
  54.         $this->data[$extensionName] = $data;
  55.     }
  56.     #[\ReturnTypeWillChange]
  57.     public function offsetUnset($extensionName)
  58.     {
  59.         unset($this->data[$extensionName]);
  60.     }
  61.     public function current()
  62.     {
  63.         return \current($this->data);
  64.     }
  65.     public function key()
  66.     {
  67.         return \key($this->data);
  68.     }
  69.     #[\ReturnTypeWillChange]
  70.     public function next()
  71.     {
  72.         return \next($this->data);
  73.     }
  74.     #[\ReturnTypeWillChange]
  75.     public function rewind()
  76.     {
  77.         return \reset($this->data);
  78.     }
  79.     #[\ReturnTypeWillChange]
  80.     public function valid()
  81.     {
  82.         return null !== isset($this->data);
  83.     }
  84. }