public function save(array $rates)
    {
        /**
         * @var RateInterface $rate
         */
        foreach ($rates as $rate) {
            $this->rates[$this->getRateKey($rate->getCurrencyCode(), $rate->getDate(), $rate->getRateType(), $rate->getSourceName())] = $rate;
        }

        usort($this->rates, function (RateInterface $rate1, RateInterface $rate2) {
            return ($rate1->getDate() > $rate2->getDate()) ? -1 : 1;
        });

        $data = '';

        /**
         * @var RateInterface $rate
         */
        foreach ($this->rates as $rate) {
            $data .= $this->toJson($rate)."\n";
        }

        file_put_contents($this->pathToFile, $data, LOCK_EX);

        $this->load();
    }
public function save(array $rates)
    {
        /**
         * @var RateInterface $rate
         */
        foreach ($rates as $rate) {
            $this->rates[$this->getRateKey($rate->getCurrencyCode(), $rate->getDate(), $rate->getRateType(), $rate->getSourceName())] = $rate;
        }

        usort($this->rates, function (RateInterface $rate1, RateInterface $rate2) {
            return ($rate1->getDate() > $rate2->getDate()) ? -1 : 1;
        });

        $data = '';

        /**
         * @var RateInterface $rate
         */
        foreach ($this->rates as $rate) {
            $data .= $this->toJson($rate)."\n";
        }

        file_put_contents($this->pathToFile, $data, LOCK_EX);

        $this->load();
    }
{@inheritdoc}