Gather all setting for a specific exchange

@param string $targetExchange
The name of the exchange to gather setting for.

@return array $settings
The exchange settings in the format needed for a RabbitMQ connection.
189167
public function exchangeSettings($targetExchange)
  {

    $settings = null;
    if (isset($this->configSettings['configFile']->rabbit->exchanges)) {
      foreach ($this->configSettings['configFile']->rabbit->exchanges as $exchange => $exchangeSettings) {
        if ($exchange == $targetExchange) {
          $settings = $exchangeSettings;
        }
      }
    } else {
      echo 'Error - No exchange settings found.', PHP_EOL;
    }

    // Trap exchange not found
    if ($settings == null) {
      echo 'MB_Configuration->exchangeSettings(): Error - ' . $targetExchange . ' not found in config settings.';
      exit;
    }

    return $settings;
  }
365567
public function getExchange($name, $connection)
    {
        if (!isset($this->exchanges[$connection][$name])) {
            if (!isset($this->exchanges[$connection])) {
                $this->exchanges[$connection] = array();
            }

            $exchange = new \AMQPExchange(
                $this->getChannel($connection)
            );
            $exchange->setName($name);

            $this->exchanges[$connection][$name] = $exchange;
        }

        return $this->exchanges[$connection][$name];
    }
1288893
public function getItems($offset, $limit) {
		$this->select->limit($limit, $offset);
		
		return $this->datagate->fetchAll($this->select);
	}
125396
private function getMappedSettings(array $settings, $fromIndex, $toIndex)
    {
        $mappedSettings = ['sourceOrder' => [], 'sources' => []];

        if (isset($settings['sourceOrder'])) {
            foreach ($settings['sourceOrder'] as $row) {
                if ('key' == $row[0]) {
                    $row[1] = $this->getSource('', $row[1], $fromIndex, $toIndex);
                }
                $mappedSettings['sourceOrder'][] = $row;
            }
        }

        if (isset($settings['sources'])) {
            foreach ($settings['sources'] as $source => $sourceSettings) {
                $mappedSource = $this->getSource('', $source, $fromIndex, $toIndex);
                $mappedSettings['sources'][$mappedSource] = [
                  'tableAttributes' => $this->getSources('', $sourceSettings['tableAttributes'], $fromIndex, $toIndex),
                ];
            }
        }

        return $mappedSettings;
    }
584034
public function setExchangeOptions(array $exchangeOptions)
    {
        $this->exchangeOptions = $exchangeOptions;

        if (!array_key_exists('publish_attributes', $this->exchangeOptions)) {
            $this->exchangeOptions['publish_attributes'] = [];
        }

        if (!array_key_exists('routing_keys', $this->exchangeOptions)) {
            $this->exchangeOptions['routing_keys'] = [];
        }

        return $this;
    }
1084906
protected function doProcess(Exchange $exchange, SerializableArray $processingContext)
    {
        $itinerary = $exchange->getItinerary();

        if ($itinerary->getProcessorIdsCount() > 0) {
            $exchangeBackup = clone $exchange;

            // Take the next processor
            $processorId = $itinerary->shiftProcessorId();
            if (!$this->container->has($processorId)) {
                throw new \RuntimeException("Processor with $processorId not found in container.");
            }
            $processor = $this->container->get($processorId);
            if (!$processor instanceof ProcessorInterface) {
                throw new \RuntimeException('Processors must implement ProcessorInterface.');
            }

            // Prepend this processor
            $itinerary->unShiftProcessorId($this->getId());

            try {
                $processor->process($exchange);
            } catch (ProcessingException $exception) {
                $originalException = $exception->getOriginalException();

                // We try to catch the exception
                foreach ($this->catches as $catch) {
                    if ($this->evaluator->evaluateWithExchange($catch->getCondition(), $exchange, $originalException)) {
                        $exchange->setIn($exchangeBackup->getIn());
                        $exchange->setOut(null);
                        $exchange->setItinerary($catch->getItinerary());
                        if ($this->finallyItinerary) {
                            $exchange->getItinerary()->append($this->finallyItinerary);
                        }

                        return;
                    }
                }

                // If it's not catch, we just let go, if the exchange is retried, we will come to this processor again
                throw $originalException;
            }
        } elseif ($this->finallyItinerary) {
            $exchange->getItinerary()->prepend($this->finallyItinerary);
        }
    }
510923
private function produceExchangeInstance($exchangeName)
    {
        if (isset($this->declaredExchangeInstances[$exchangeName])) {
            return $this->declaredExchangeInstances[$exchangeName];
        }

        if (isset($this->usedExchangeInstances[$exchangeName])) {
            return $this->usedExchangeInstances[$exchangeName];
        }

        $this->ensureChannel();
        $exchange = new AMQPExchange($this->channel);
        $exchange->setName($exchangeName);
        $this->usedExchangeInstances[$exchangeName] = $exchange;
        return $exchange;
    }
156250
public static function getSetting( string $name, $defaultValue = null )
	{
		return self::isSettingSet($name)
			? self::$settings[$name]
			: $defaultValue;
	}
719779
public static function filterConfig(array $config, $target = 'PHP')
	{
		$filteredConfig = [];
		foreach ($config as $name => $value)
		{
			if ($value instanceof FilterableConfigValue)
			{
				$value = $value->filterConfig($target);
				if (!isset($value))
				{
					continue;
				}
			}
			if (is_array($value))
			{
				$value = self::filterConfig($value, $target);
			}
			$filteredConfig[$name] = $value;
		}

		return $filteredConfig;
	}
29468
protected function createQueueAndBind(RabbitMqOptionTransfer $queueOption, $exchangeQueueName)
    {
        $this->queueEstablishmentHelper->createQueue($this->channel, $queueOption);

        if ($queueOption->getRoutingKeys() === null) {
            return;
        }

        foreach ($queueOption->getRoutingKeys() as $routingKey) {
            $this->bindQueues($queueOption->getQueueName(), $exchangeQueueName, $routingKey);
        }
    }
864590
public Reflecter<T> setExchanges(Map<String, String> exchangeMap) {
		exchangeProps.putAll(checkNotNull(exchangeMap));
		return this;
	}
782639
public function getTargetProperties($targetObject, $sourceObject): array
    {
        // We use the property accessor defined on the config, because the one
        // in this mapping's Options might have been overridden to be the
        // object crate implementation.
        $propertyAccessor = $this->autoMapperConfig->getOptions()->getPropertyAccessor();
        if (!$this->options->isObjectCrate($this->destinationClassName)) {
            $properties = $propertyAccessor->getPropertyNames($targetObject);
            return array_values($properties);
        }

        $sourceProperties = $propertyAccessor->getPropertyNames($sourceObject);
        $sourceProperties = array_values($sourceProperties);
        if (!$this->options->shouldConvertName()) {
            return $sourceProperties;
        }

        $nameConverter = function (string $sourceProperty): string {
            return NameConverter::convert(
                $this->options->getSourceMemberNamingConvention(),
                $this->options->getDestinationMemberNamingConvention(),
                $sourceProperty
            );
        };

        return array_map($nameConverter, $sourceProperties);
    }
1181995
public function exchangeBind($destination, $source, $routingKey = '', $nowait = false, $arguments = [])
    {
        return $this->getClient()->exchangeBind($this->getChannelId(), $destination, $source, $routingKey, $nowait, $arguments);
    }
1138357
public function offsetGet($offset)
    {
        if (!array_key_exists($offset, $this->_values)) {
            throw new ClientException('Invalid option ' . $offset);
        }

        return $this->_values[$offset];
    }
1075463
public function getSettings()
    {
        $settings = new Settings();
        $requestUrl = $this->getRequestUrl();
        $settings->setFetchUrl($requestUrl);
        $settings->setPrefix(sha1($requestUrl));
        $settings->setEmailPreview(isset($_REQUEST['emailPreview']) ? $_REQUEST['emailPreview'] === 'true' : false);
        $settings->setPhonePreview(isset($_REQUEST['telPreview']) ? $_REQUEST['telPreview'] === 'true' : false);
        return $settings;
    }
288896
private function populateSettings(array $settings, ?string $owner = null): array
    {
        $objects = [];

        foreach ($settings as $setting) {
            $objects[] = $object = new Setting();
            $object->setOwner($owner);
            $object->setSection($setting->getSection()->getName());
            $object->setKey($setting->getKey());
            $object->setValue($setting->getValue());
        }

        return $objects;
    }
1099075
public function setOptions(array $options)
    {
        if (isset($options['exchange'])) {
            $this->exchange = $options['exchange'];
        }
        if (isset($options['exchange'])) {
            if (!is_string($options['exchange'])) {
                throw new \UnexpectedValueException('exchange value is not a string, a string is required');
            }
            $this->exchange = $options['exchange'];
            unset($options['exchange']);
        }
        if (isset($options['queue'])) {
            if (isset($options['queue']['arguments'])) {
                $this->queueOptions = $options['queue'];
            }
            unset($options['queue']);
        }
        if (isset($options['connection'])) {
            $uri = parse_url($options['connection']);
            unset($options['connection']);
            if (isset($uri['scheme']) && $uri['scheme'] === 'redis') {
                $uri['scheme'] = $uri['scheme'] == 'unix' ? : 'tcp';
            }
            if (isset($uri['path'])) {
                $uri['database'] = trim($uri['path'], '/');
                $options['connection']['database'] = isset($uri['databsae']) ? $uri['database'] : null;
            }
            $options['connection']['host'] = $uri['host'];
            $options['connection']['port'] = isset($uri['port']) ? $uri['port'] : 6379;
            $options['connection']['login'] = isset($uri['username']) ? $uri['username'] : null;
            $options['connection']['password'] = isset($uri['pass']) ? $uri['pass'] : null;
            $uri = null;
            $this->options['connection'] = $options['connection'];
        }
        return $this;
    }