public function fetch($sourceName = null, \DateTime $date = null)
    {
        $rates = array();

        $filteredSourceNames = ($sourceName === null) ? array_map(function (SourceInterface $source) {
            return $source->getName();
        }, $this->sources->all()) : (array) $sourceName;

        foreach ($filteredSourceNames as $name) {

            $source = $this->sources->get($name);

            $filteredConfigurations = $this->configurations->all(array(
                'sourceName' => $name,
            ));

            /**
             * @var Configuration $configuration
             */
            foreach ($filteredConfigurations as $configuration) {
                $rates[] = $source->fetch($configuration->getCurrencyCode(), $configuration->getRateType(), $date);
            }
        }

        /**
         * @var ProcessorInterface $processor
         */
        foreach ($this->processors->all() as $processor) {
            $rates = $processor->process($this->baseCurrency, $this->configurations, $rates);
        }

        $this->repository->save($rates);

        return $rates;
    }
public function fetch($sourceName = null, \DateTime $date = null)
    {
        $rates = array();

        $filteredSourceNames = ($sourceName === null) ? array_map(function (SourceInterface $source) {
            return $source->getName();
        }, $this->sources->all()) : (array) $sourceName;

        foreach ($filteredSourceNames as $name) {

            $source = $this->sources->get($name);

            $filteredConfigurations = $this->configurations->all(array(
                'sourceName' => $name,
            ));

            /**
             * @var Configuration $configuration
             */
            foreach ($filteredConfigurations as $configuration) {
                $rates[] = $source->fetch($configuration->getCurrencyCode(), $configuration->getRateType(), $date);
            }
        }

        /**
         * @var ProcessorInterface $processor
         */
        foreach ($this->processors->all() as $processor) {
            $rates = $processor->process($this->baseCurrency, $this->configurations, $rates);
        }

        $this->repository->save($rates);

        return $rates;
    }
{@inheritdoc}