Formats an amount in html, adding classes given the status.

@param float $amount
@param int $status
One of the Status_... constants.

@return string
An html string representing the amount and its status.
6443
private function getFormattedAmount($amount, $status)
    {
        $currency = '€';
        $sign = $amount < 0.0 ? '-' : '';
        /** @noinspection CallableParameterUseCaseInTypeContextInspection */
        $amount = abs($amount);
        $statusClass = $this->getStatusClass($status);
        $statusMessage = $this->getAmountStatusTitle($status);
        $this->setStatus($status, $statusMessage);
        if (!empty($statusMessage)) {
            $statusMessage = " title=\"$statusMessage\"";
        }

        $result = '';
        $result .= '<span class="sign">' . $sign . '</span>';
        $result .= '<span class="currency">' . $currency . '</span>';
        $result .= number_format($amount, 2, ',', '.');
        // Prevents warning "There should be a space between attribute ...
        $wrapperBegin = "<span class=\"amount notice-$statusClass\"" . $statusMessage . '>';
        $result = $wrapperBegin . $result . '</span>';
        return $result;
    }
206643
public function renderPage($data, $status = 200)
    {
        // get view class
        $view = $this->di->get("view");
        // creates the views with viewify function
        array_key_exists("views", $data) && $this->viewify($data["views"]);

        $data["stylesheets"] = ["css/style.css"];
        $data["javascripts"] = ["js/index.js"];

        // Add layout, render it, add to response and send.
        $view->add("wrappedApp", $data, "wrappedApp");
        $body = $view->renderBuffered("wrappedApp");
        $this->di->get("response")->setBody($body)
                                  ->send($status);
        exit;
    }
587667
public function toWords($amount, $currency, $options = null)
    {
        $dictionary = new PolishDictionary();
        $numberToTripletsConverter = new NumberToTripletsConverter();
        $tripletTransformer = new PolishTripletTransformer($dictionary);
        $nounGenderInflector = new PolishNounGenderInflector();
        $exponentInflector = new PolishExponentInflector($nounGenderInflector);

        $numberTransformer = (new NumberTransformerBuilder())
            ->withDictionary($dictionary)
            ->withWordsSeparatedBy(' ')
            ->transformNumbersBySplittingIntoTriplets($numberToTripletsConverter, $tripletTransformer)
            ->inflectExponentByNumbers($exponentInflector)
            ->build();

        $decimal = (int) ($amount / 100);
        $fraction = $amount % 100;

        if ($fraction === 0) {
            $fraction = null;
        }

        $currency = strtoupper($currency);

        if (!array_key_exists($currency, PolishDictionary::$currencyNames)) {
            throw new NumberToWordsException(
                sprintf('Currency "%s" is not available for "%s" language', $currency, get_class($this))
            );
        }

        $currencyNames = PolishDictionary::$currencyNames[$currency];

        $words = [];

        $words[] = $numberTransformer->toWords($decimal);
        $words[] = $nounGenderInflector->inflectNounByNumber(
            $decimal,
            $currencyNames[0][0],
            $currencyNames[0][1],
            $currencyNames[0][2]
        );

        if (null !== $fraction) {
            $words[] = $numberTransformer->toWords($fraction);
            $words[] = $nounGenderInflector->inflectNounByNumber(
                $fraction,
                $currencyNames[1][0],
                $currencyNames[1][1],
                $currencyNames[1][2]
            );
        }

        return implode(' ', $words);
    }
731239
public static function amountToExponent($amount, $iso)
    {
        $iso = strtoupper($iso);

        if (array_key_exists($iso, self::$iso4217)) {
            $exp = intval(self::$iso4217[$iso]['exponent']);

            if ($exp > 0) {
                return bcmul($amount, pow(10, $exp), 0);
            }
        }

        return strval($amount);
    }
1271351
public static function adsToClicks($amount): int
    {
        $amountAsString = (string)$amount;
        if (strpos($amountAsString, '.') !== false) {
            $ar = explode('.', $amountAsString);
            $ar[1] = str_pad($ar[1], 11, '0');
            $amountAsString = implode($ar);
        } else {
            $amountAsString = $amountAsString . '00000000000';
        }
        return (int)$amountAsString;
    }
1317494
public function formatAmount(int $amount, string $currencyCode = null, string $localeCode = null): string
    {
        return $this->helper->formatAmount($amount, $currencyCode ?? $this->baseCurrency, $localeCode ?? $this->localeContext->getLocaleCode());
    }
491394
public function status(StatusRequest $statusRequest)
    {
      // Extract SimplePay user from request
      $user = $statusRequest->getUser();
      $transaction = $statusRequest->getTransaction();

      // Create request
      $request = new StdClass();
      $request->User = new StdClass();
      $request->User->Uuid = $user->getUuid()->getValue();
      $request->User->Hash = $user->getHash();

      $request->Transaction = new StdClass();
      $request->Transaction->Uuid = $transaction->getValue();

      // Send request
      $response = $this->getSoapClient()->status($request);

      $uuid = new Uuid($response->Transaction->Uuid);
      $status = $response->Transaction->Status;

      // Create Transaction
      $transaction = new Transaction($uuid, $status);

      $reference = $response->Payment->Reference;
      $amount = $response->Payment->Amount;
      $currency = $response->Payment->Currency;

      // Create Payment
      $payment = new Payment($reference, $amount, $currency);

      if(isset($response->Payment->Description))
        $payment->setDescription($response->Payment->Description);

      $statusResponse = new StatusResponse($transaction, $payment);

      return $statusResponse;
    }
909600
public function renderPage($data, $status = 200)
    {
        // creates the views with viewify function
        array_key_exists("views", $data) && $this->viewify($data["views"]);

        $data["stylesheets"] = ["css/style.css"];
        $data["javascripts"] = ["js/index.js"];


        if ($data["title"] !== null) {
            return $data["title"];
        }
        return false;
    }
802274
public function toCommon(int $amount, bool $format = true): string
    {
        $money          = $this->castMoney($amount, $this->getCurrencySwiftCode());
        $moneyFormatter = new DecimalMoneyFormatter(new ISOCurrencies());

        return ($format) ?
        number_format($moneyFormatter->format($money), 2, '.', ',') :
        $moneyFormatter->format($money);
    }
1328062
public function setStatus($status = null)
    {
        switch ($status) {
            //TODO implement all status codes
            case '500':
                $this->setStatusCode('HTTP/1.0 500 Internal Server Error');
                break;
            case '404':
                $this->setStatusCode('HTTP/1.0 404 Not Found');
                break;
            case '403':
                $this->setStatusCode('HTTP/1.0 403 Forbidden');
                break;
            case '402':
                $this->setStatusCode('HTTP/1.0 402 Payment Required');
                break;
            case '401':
                $this->setStatusCode('HTTP/1.0 401 Unauthorized');
                break;
            case '400':
                $this->setStatusCode('HTTP/1.0 400 Bad Request');
                break;
            case '200':
                $this->setStatusCode(Template::STATUS_OK);
                break;
            default:
                $this->setStatusCode('HTTP/1.0 ' .($status ?: 200));
                break;
        }
        return $this;
    }
51775
protected function convertAmount($amount, $convert = false)
    {
        if (!$convert) {
            return $amount;
        }

        return $amount * $this->currency->getSubunit();
    }
1004333
public function offlineAuth($amount = null)
    {
        $builder = new HpsCreditServiceOfflineAuthBuilder($this);
        return $builder
            ->withAmount($amount)
            ->withCurrency('usd');
    }
152355
public function getCssGradient(Color $color, $amount = null)
    {
        // Get gradient colors
        if (self::isLight($color)) {
            $lightColor = $color->hex;
            $darkColor = self::darken($color->copy(), $amount)->hex;
        } else {
            $lightColor = self::lighten($color->copy(), $amount)->hex;
            $darkColor = $color->hex;
        }

        /* fallback/image non-cover color */
        $css = "background-color: #" . $color->hex . ";";

        /* IE Browsers */
        $css .= "filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#" . $lightColor . "', endColorstr='#" . $darkColor . "');";

        /* Safari 4+, Chrome 1-9 */
        $css .= "background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#" . $lightColor . "), to(#" . $darkColor . "));";

        /* Safari 5.1+, Mobile Safari, Chrome 10+ */
        $css .= "background-image: -webkit-linear-gradient(top, #" . $lightColor . ", #" . $darkColor . ");";

        /* Firefox 3.6+ */
        $css .= "background-image: -moz-linear-gradient(top, #" . $lightColor . ", #" . $darkColor . ");";

        /* IE 10+ */
        $css .= "background-image: -ms-linear-gradient(top, #" . $lightColor . ", #" . $darkColor . ");";

        /* Opera 11.10+ */
        $css .= "background-image: -o-linear-gradient(top, #" . $lightColor . ", #" . $darkColor . ");";

        // Return our CSS
        return $css;
    }
1201016
public function fromFloat($amount, $currency = null)
    {
        if ($currency) {
            $this->setCurrency($currency);
        }

        if (!is_float($amount)) {
            throw new InvalidArgumentException(sprintf(
                'Amount must be a float, %s given',
                gettype($amount)
            ));
        }
        
        $this->amount = $this->toInt(
            round(
                $this->getSubUnit() * round($amount, $this->getFractionDigits(), PHP_ROUND_HALF_UP),
                0,
                PHP_ROUND_HALF_UP
            )
        );
        return $this;
    }
541143
public function create(
        string $title,
        string $description,
        $amount,
        array $optional = []
    ): Response {
        $body = \array_merge(\compact('title', 'description', 'amount'), $optional);

        list($headers, $stream) = $this->prepareMultipartRequestPayloads([], $body);

        return $this->stream('POST', 'open_collections', $headers, $body);
    }
627951
private static function percent($number, float $total, int $decimal = 2): string
	{
		return Number::percent(self::prepareFloat($number), $total, $decimal);
	}
1267505
public static function parse(string $amount)
    {
        $parser = new DecimalMoneyParser(new ISOCurrencies());

        return static::given(
            $parser->parse($amount, new Currency('MYR'))->getAmount()
        );
    }