You are here

public function Price::equals in Price 2.0.x

Same name and namespace in other branches
  1. 8 src/Price.php \Drupal\price\Price::equals()
  2. 3.x src/Price.php \Drupal\price\Price::equals()
  3. 2.x src/Price.php \Drupal\price\Price::equals()
  4. 3.0.x src/Price.php \Drupal\price\Price::equals()

Gets whether the current price is equivalent to the given price.

Parameters

\Drupal\price\Price $price: The price.

Return value

bool TRUE if the prices are equal, FALSE otherwise.

2 calls to Price::equals()
Price::greaterThanOrEqual in src/Price.php
Gets whether the current price is greater than or equal to the given price.
Price::lessThanOrEqual in src/Price.php
Gets whether the current price is lesser than or equal to the given price.

File

src/Price.php, line 226

Class

Price
Provides a value object for monetary values.

Namespace

Drupal\price

Code

public function equals(Price $price) : bool {
  return $this
    ->compareTo($price) == 0;
}