Checks that a value is a monetary amount.

@param string $check Value to check
@param string $symbolPosition Where symbol is located (left/right)
@return bool Success
193667
public static function money($check, $symbolPosition = 'left')
    {
        $money = '(?!0,?\d)(?:\d{1,3}(?:([, .])\d{3})?(?:\1\d{3})*|(?:\d+))((?!\1)[,.]\d{1,2})?';
        if ($symbolPosition === 'right') {
            $regex = '/^' . $money . '(?<!\x{00a2})\p{Sc}?$/u';
        } else {
            $regex = '/^(?!\x{00a2})\p{Sc}?' . $money . '$/u';
        }

        return static::_check($check, $regex);
    }
319572
private static function isValidCurrency($price)
    {
        //====================================================================//
        // Check Contents Available
        if (!isset($price["tax"])) {
            return false;
        }
        if (!isset($price["symbol"])) {
            return false;
        }
        if (!isset($price["code"])) {
            return false;
        }
        if (!isset($price["name"])) {
            return false;
        }

        return true;
    }
685858
public function getAmount(MoneyInterface $money = null, $currency = null)
    {
        if (null === $money) {
            return 0.0;
        }

        $reduced = $this->bank->reduce($money, $currency);

        return $reduced->getAmount();
    }
812569
public function equals(CurrencyPair $other)
    {
        return
            $this->baseCurrency->equals($other->baseCurrency)
            && $this->counterCurrency->equals($other->counterCurrency)
            && $this->conversionRatio === $other->conversionRatio
        ;
    }
301744
protected function validateNumericCodeCurrency()
    {
        $field = 'numeric_code';

        if ($this->isExcluded($field)) {
            return null;
        }

        $value = $this->getSubmitted($field);

        if ($this->isUpdating() && !isset($value)) {
            $this->unsetSubmitted($field);
            return null;
        }

        $label = $this->translation->text('Numeric code');

        if (empty($value)) {
            $this->setErrorRequired($field, $label);
            return false;
        }

        if (preg_match('/^[0-9]{3}$/', $value) !== 1) {
            $this->setErrorInvalid($field, $label);
            return false;
        }

        $updating = $this->getUpdating();

        if (isset($updating['numeric_code']) && $updating['numeric_code'] == $value) {
            return true;
        }

        foreach ($this->currency->getList() as $currency) {
            if ($currency['numeric_code'] == $value) {
                $this->setErrorExists($field, $label);
                return false;
            }
        }

        return true;
    }
257373
public void setCheckedImmediately(boolean checked){
        if(mChecked != checked) {
            mChecked = checked;
            if(mOnCheckedChangeListener != null)
                mOnCheckedChangeListener.onCheckedChanged(this, mChecked);
        }
        mThumbPosition = mChecked ? 1f : 0f;
        invalidate();
    }
441347
public static boolean isValid(final String value) {
        if (value == null) {
            return true;
        }
        if (value.length() == 0) {
            return false;
        }
        final int space = value.indexOf(' ');
        if (space == -1) {
            return false;
        }

        // Try converting amount
        final String amount = value.substring(0, space);
        if (!(amount.matches(DECIMAL) || amount.matches(INTEGER))) {
            return false;
        }

        // Try to convert code into a currency
        final String currencyCode = value.substring(space + 1);
        try {
            Currency.getInstance(currencyCode);
        } catch (RuntimeException ex) {
            return false;
        }

        return true;
    }
432084
public function getFormattedPrice($price, $symbol = 'EUR', $locale = 'de')
    {
        return $this->priceFormatter->format(
            (float) $price,
            null,
            $locale,
            $symbol,
            PriceFormatter::CURRENCY_LOCATION_SUFFIX
        );
    }
1024888
public function isGreater(Money $a, Money $b) : bool
    {
        return $this->compare($a, $b) > 0;
    }
496022
public function setCheck($check, $state)
    {
        if (array_key_exists($check, $this->meta->checks))
        {
            $this->meta->checks[$check] = $state;
        }
    }
1223918
public static function is($check)
    {
        switch ($check) {
            case 'secure':
                return empty($_SERVER['HTTPS']) === false && strcasecmp($_SERVER['HTTPS'], 'on') === 0;

            case 'xhr':
                return strcasecmp(self::header('X-Requested-With'), 'xmlhttprequest') === 0;

            case 'pjax':
                return strcasecmp(self::header('X-Pjax'), 'true') === 0;
        }

        return strcasecmp($_SERVER['REQUEST_METHOD'], $check) === 0;
    }
1176728
public function exactly(float $check, string $error = 'not exactly %d') : Real
    {
        return $this->pipe(
            self::predicate(
                function (float $value) use ($check) : bool {
                    return $value === $check;
                },
                sprintf($error, $check)
            )
        );
    }
1081500
function checkAmount( $amount )
    {
        $orderAmount = $this->order->attribute( 'total_inc_vat' );

        // To avoid floating errors, round the value down before checking.
        $shopINI = eZINI::instance( 'shop.ini' );
        $precisionValue = (int)$shopINI->variable( 'MathSettings', 'RoundingPrecision' );
        if ( round( $orderAmount, $precisionValue ) === round( $amount, $precisionValue ) )
        {
            return true;
        }

        $this->logger->writeTimedString( "Order amount ($orderAmount) and received amount ($amount) do not match.", 'checkAmount failed' );
        return false;
    }
495682
public function amount($money)
    {
        if (null === $money) {
            return;
        }

        if (is_string($money) || $money < 0) {
            throw new InvalidArgumentException('Money amount must be a positive number.');
        }

        if ($this->getMoneyFormat() === 'cents') {
            return number_format($money, 0, '', '');
        }

        return sprintf('%.2f', number_format($money, 2, '.', '') / 100);
    }
1131171
protected function setCustomValidity($key, $check = [])
    {
        $message = NULL;
        
        if( is_scalar($key) )
        {
            $message = $this->getValidationLangValue($key, $check);
        }
        else foreach( $key as $k => $c )
        {
            $message .= $this->getValidationLangValue($k, $c) . ' ';
        }

        return rtrim($message);
    }
581331
public static function validate($currency)
    {
        if (\array_search(\strtoupper($currency), \array_unique(self::$iso4217), true)) {
            return $currency;
        }

        return false;
    }
375044
public function equals(Money $other)
    {
        return $this->isSameCurrency($other) && $this->amount === $other->amount;
    }