Beispiel #1
0
 /**
  * Converts a value from its database representation to its PHP representation
  *
  * @param mixed            $value    The value to convert
  * @param AbstractPlatform $platform The currently used database platform
  *
  * @return mixed
  *
  * @throws ConversionException When the conversion fails
  */
 public function convertToPHPValue($value, AbstractPlatform $platform)
 {
     if (empty($value)) {
         return null;
     }
     if ($value instanceof Currency) {
         return $value;
     }
     try {
         $currency = Currency::fromValue($value);
     } catch (Exception $exception) {
         throw ConversionException::conversionFailed($value, static::TYPE_NAME);
     }
     return $currency;
 }
Beispiel #2
0
 /**
  * Checks whether other money has the same currency
  *
  * @param Money $other The other monetary value
  *
  * @return bool
  */
 public function isSameCurrency(Money $other) : bool
 {
     return $this->currency->equals($other->currency);
 }
Beispiel #3
0
 public function test_that_minor_returns_expected_value()
 {
     $currency = Currency::IQD();
     $this->assertSame(1000, $currency->minor());
 }