!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/uploads/script/vendor/moneyphp/money/src/Calculator/   drwxr-xr-x
Free 13.23 GB of 57.97 GB (22.82%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     PhpCalculator.php (4.27 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

namespace Money\Calculator;

use 
Money\Calculator;
use 
Money\Money;
use 
Money\Number;

/**
 * @author Frederik Bosch <f.bosch@genkgo.nl>
 */
final class PhpCalculator implements Calculator
{
    
/**
     * {@inheritdoc}
     */
    
public static function supported()
    {
        return 
true;
    }

    
/**
     * {@inheritdoc}
     */
    
public function compare($a$b)
    {
        return (
$a $b) ? -: (($a $b) ? 0);
    }

    
/**
     * {@inheritdoc}
     */
    
public function add($amount$addend)
    {
        
$result $amount $addend;

        
$this->assertInteger($result);

        return (string) 
$result;
    }

    
/**
     * {@inheritdoc}
     */
    
public function subtract($amount$subtrahend)
    {
        
$result $amount $subtrahend;

        
$this->assertInteger($result);

        return (string) 
$result;
    }

    
/**
     * {@inheritdoc}
     */
    
public function multiply($amount$multiplier)
    {
        
$result $amount $multiplier;

        
$this->assertIntegerBounds($result);

        return (string) 
Number::fromNumber($result);
    }

    
/**
     * {@inheritdoc}
     */
    
public function divide($amount$divisor)
    {
        
$result $amount $divisor;

        
$this->assertIntegerBounds($result);

        return (string) 
Number::fromNumber($result);
    }

    
/**
     * {@inheritdoc}
     */
    
public function ceil($number)
    {
        return 
$this->castInteger(ceil($number));
    }

    
/**
     * {@inheritdoc}
     */
    
public function floor($number)
    {
        return 
$this->castInteger(floor($number));
    }

    
/**
     * {@inheritdoc}
     */
    
public function absolute($number)
    {
        
$result ltrim($number'-');

        
$this->assertIntegerBounds($result);

        return (string) 
$result;
    }

    
/**
     * {@inheritdoc}
     */
    
public function round($number$roundingMode)
    {
        if (
Money::ROUND_HALF_POSITIVE_INFINITY === $roundingMode) {
            
$number Number::fromNumber($number);

            if (
$number->isHalf()) {
                return 
$this->castInteger(ceil((string) $number));
            }

            return 
$this->castInteger(round((string) $number0Money::ROUND_HALF_UP));
        }

        if (
Money::ROUND_HALF_NEGATIVE_INFINITY === $roundingMode) {
            
$number Number::fromNumber($number);

            if (
$number->isHalf()) {
                return 
$this->castInteger(floor((string) $number));
            }

            return 
$this->castInteger(round((string) $number0Money::ROUND_HALF_DOWN));
        }

        return 
$this->castInteger(round($number0$roundingMode));
    }

    
/**
     * {@inheritdoc}
     */
    
public function share($amount$ratio$total)
    {
        return 
$this->castInteger(floor($amount $ratio $total));
    }

    
/**
     * {@inheritdoc}
     */
    
public function mod($amount$divisor)
    {
        
$result $amount $divisor;

        
$this->assertIntegerBounds($result);

        return (string) 
$result;
    }

    
/**
     * Asserts that an integer value didn't become something else
     * (after some arithmetic operation).
     *
     * @param int $amount
     *
     * @throws \OverflowException  If integer overflow occured
     * @throws \UnderflowException If integer underflow occured
     */
    
private function assertIntegerBounds($amount)
    {
        if (
$amount PHP_INT_MAX) {
            throw new 
\OverflowException('You overflowed the maximum allowed integer (PHP_INT_MAX)');
        } elseif (
$amount < ~PHP_INT_MAX) {
            throw new 
\UnderflowException('You underflowed the minimum allowed integer (PHP_INT_MAX)');
        }
    }

    
/**
     * Casts an amount to integer ensuring that an overflow/underflow did not occur.
     *
     * @param int $amount
     *
     * @return string
     */
    
private function castInteger($amount)
    {
        
$this->assertIntegerBounds($amount);

        return (string) 
intval($amount);
    }

    
/**
     * Asserts that integer remains integer after arithmetic operations.
     *
     * @param int $amount
     */
    
private function assertInteger($amount)
    {
        if (
filter_var($amountFILTER_VALIDATE_INT) === false) {
            throw new 
\UnexpectedValueException('The result of arithmetic operation is not an integer');
        }
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0057 ]--