| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 | 
							- <?php
 
- /**
 
-  * Copyright © Magento, Inc. All rights reserved.
 
-  * See COPYING.txt for license details.
 
-  */
 
- namespace Magento\Framework\MessageQueue\Topology\Config\ExchangeConfigItem;
 
- use Magento\Framework\MessageQueue\Topology\Config\Data;
 
- use Magento\Framework\MessageQueue\Topology\Config\ExchangeConfigItem;
 
- use Magento\Framework\MessageQueue\Topology\Config\ExchangeConfigItemFactory;
 
- /**
 
-  * Exchange config data iterator.
 
-  */
 
- class Iterator implements \Iterator, \ArrayAccess
 
- {
 
-     /**
 
-      * Exchange config.
 
-      *
 
-      * @var ExchangeConfigItem
 
-      */
 
-     private $object;
 
-     /**
 
-      * Config data.
 
-      *
 
-      * @var array
 
-      */
 
-     private $data;
 
-     /**
 
-      * Initialize dependencies.
 
-      *
 
-      * @param Data $configData
 
-      * @param ExchangeConfigItemFactory $itemFactory
 
-      */
 
-     public function __construct(Data $configData, ExchangeConfigItemFactory $itemFactory)
 
-     {
 
-         $this->data = $configData->get();
 
-         $this->object = $itemFactory->create();
 
-         $this->rewind();
 
-     }
 
-     /**
 
-      * Get current item.
 
-      *
 
-      * @return ExchangeConfigItem
 
-      */
 
-     public function current()
 
-     {
 
-         return $this->object;
 
-     }
 
-     /**
 
-      * {@inheritdoc}
 
-      */
 
-     public function next()
 
-     {
 
-         next($this->data);
 
-         if (current($this->data)) {
 
-             $this->initObject(current($this->data));
 
-         }
 
-     }
 
-     /**
 
-      * Initialize object.
 
-      *
 
-      * @param array $data
 
-      * @return void
 
-      */
 
-     private function initObject(array $data)
 
-     {
 
-         $this->object->setData($data);
 
-     }
 
-     /**
 
-      * {@inheritdoc}
 
-      */
 
-     public function key()
 
-     {
 
-         key($this->data);
 
-     }
 
-     /**
 
-      * {@inheritdoc}
 
-      */
 
-     public function valid()
 
-     {
 
-         return (bool)current($this->data);
 
-     }
 
-     /**
 
-      * {@inheritdoc}
 
-      */
 
-     public function rewind()
 
-     {
 
-         reset($this->data);
 
-         if (current($this->data)) {
 
-             $this->initObject(current($this->data));
 
-         }
 
-     }
 
-     /**
 
-      * {@inheritdoc}
 
-      */
 
-     public function offsetExists($offset)
 
-     {
 
-         return array_key_exists($offset, $this->data);
 
-     }
 
-     /**
 
-      * {@inheritdoc}
 
-      */
 
-     public function offsetGet($offset)
 
-     {
 
-         if (!$this->offsetExists($offset)) {
 
-             return null;
 
-         }
 
-         $item = clone $this->object;
 
-         $item->setData($this->data[$offset]);
 
-         return $item;
 
-     }
 
-     /**
 
-      * {@inheritdoc}
 
-      */
 
-     public function offsetSet($offset, $value)
 
-     {
 
-         $this->data[$offset] = $value;
 
-     }
 
-     /**
 
-      * {@inheritdoc}
 
-      */
 
-     public function offsetUnset($offset)
 
-     {
 
-         unset($this->data[$offset]);
 
-     }
 
- }
 
 
  |