for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Component\Currency\Model;
use Sylius\Component\Resource\Model\TimestampableTrait;
use Webmozart\Assert\Assert;
/**
* @author Jan Góralski <[email protected]>
class ExchangeRate implements ExchangeRateInterface
{
use TimestampableTrait;
* @var mixed
protected $id;
* @var float
protected $ratio;
* @var CurrencyInterface
protected $sourceCurrency;
protected $targetCurrency;
public function __construct()
$this->createdAt = new \DateTime();
}
* {@inheritdoc}
public function getId()
return $this->id;
public function getRatio()
return $this->ratio;
* @throws \InvalidArgumentException
public function setRatio($ratio)
Assert::nullOrFloat($ratio);
$this->ratio = $ratio;
public function getSourceCurrency()
return $this->sourceCurrency;
public function setSourceCurrency(CurrencyInterface $currency)
$this->sourceCurrency = $currency;
public function getTargetCurrency()
return $this->targetCurrency;
public function setTargetCurrency(CurrencyInterface $currency)
$this->targetCurrency = $currency;