Sonata\Component\Currency\Currency::equals PHP Method

equals() public method

public equals ( $currency )
    public function equals($currency)
    {
        if (!$currency instanceof CurrencyInterface) {
            return false;
        }
        return $this->getLabel() === $currency->getLabel();
    }

Usage Example

Exemplo n.º 1
0
 public function testEquals()
 {
     $currency = new Currency();
     $currency->setLabel('EUR');
     $this->assertFalse($currency->equals(null));
     $this->assertFalse($currency->equals(new Currency()));
     $this->assertTrue($currency->equals($currency));
 }