| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* This file is part of the ramsey/uuid library |
| 5 |
* |
| 6 |
* For the full copyright and license information, please view the LICENSE |
| 7 |
* file that was distributed with this source code. |
| 8 |
* |
| 9 |
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com> |
| 10 |
* @license http://opensource.org/licenses/MIT MIT |
| 11 |
*/ |
| 12 |
declare (strict_types=1); |
| 13 |
namespace Dudlewebs\WPMCS\Ramsey\Uuid\Math; |
| 14 |
|
| 15 |
use Dudlewebs\WPMCS\Ramsey\Uuid\Type\Hexadecimal; |
| 16 |
use Dudlewebs\WPMCS\Ramsey\Uuid\Type\Integer as IntegerObject; |
| 17 |
use Dudlewebs\WPMCS\Ramsey\Uuid\Type\NumberInterface; |
| 18 |
/** |
| 19 |
* A calculator performs arithmetic operations on numbers |
| 20 |
* |
| 21 |
* @psalm-immutable |
| 22 |
*/ |
| 23 |
interface CalculatorInterface |
| 24 |
{ |
| 25 |
/** |
| 26 |
* Returns the sum of all the provided parameters |
| 27 |
* |
| 28 |
* @param NumberInterface $augend The first addend (the integer being added to) |
| 29 |
* @param NumberInterface ...$addends The additional integers to a add to the augend |
| 30 |
* |
| 31 |
* @return NumberInterface The sum of all the parameters |
| 32 |
*/ |
| 33 |
public function add(NumberInterface $augend, NumberInterface ...$addends): NumberInterface; |
| 34 |
/** |
| 35 |
* Returns the difference of all the provided parameters |
| 36 |
* |
| 37 |
* @param NumberInterface $minuend The integer being subtracted from |
| 38 |
* @param NumberInterface ...$subtrahends The integers to subtract from the minuend |
| 39 |
* |
| 40 |
* @return NumberInterface The difference after subtracting all parameters |
| 41 |
*/ |
| 42 |
public function subtract(NumberInterface $minuend, NumberInterface ...$subtrahends): NumberInterface; |
| 43 |
/** |
| 44 |
* Returns the product of all the provided parameters |
| 45 |
* |
| 46 |
* @param NumberInterface $multiplicand The integer to be multiplied |
| 47 |
* @param NumberInterface ...$multipliers The factors by which to multiply the multiplicand |
| 48 |
* |
| 49 |
* @return NumberInterface The product of multiplying all the provided parameters |
| 50 |
*/ |
| 51 |
public function multiply(NumberInterface $multiplicand, NumberInterface ...$multipliers): NumberInterface; |
| 52 |
/** |
| 53 |
* Returns the quotient of the provided parameters divided left-to-right |
| 54 |
* |
| 55 |
* @param int $roundingMode The RoundingMode constant to use for this operation |
| 56 |
* @param int $scale The scale to use for this operation |
| 57 |
* @param NumberInterface $dividend The integer to be divided |
| 58 |
* @param NumberInterface ...$divisors The integers to divide $dividend by, in |
| 59 |
* the order in which the division operations should take place |
| 60 |
* (left-to-right) |
| 61 |
* |
| 62 |
* @return NumberInterface The quotient of dividing the provided parameters left-to-right |
| 63 |
*/ |
| 64 |
public function divide(int $roundingMode, int $scale, NumberInterface $dividend, NumberInterface ...$divisors): NumberInterface; |
| 65 |
/** |
| 66 |
* Converts a value from an arbitrary base to a base-10 integer value |
| 67 |
* |
| 68 |
* @param string $value The value to convert |
| 69 |
* @param int $base The base to convert from (i.e., 2, 16, 32, etc.) |
| 70 |
* |
| 71 |
* @return IntegerObject The base-10 integer value of the converted value |
| 72 |
*/ |
| 73 |
public function fromBase(string $value, int $base): IntegerObject; |
| 74 |
/** |
| 75 |
* Converts a base-10 integer value to an arbitrary base |
| 76 |
* |
| 77 |
* @param IntegerObject $value The integer value to convert |
| 78 |
* @param int $base The base to convert to (i.e., 2, 16, 32, etc.) |
| 79 |
* |
| 80 |
* @return string The value represented in the specified base |
| 81 |
*/ |
| 82 |
public function toBase(IntegerObject $value, int $base): string; |
| 83 |
/** |
| 84 |
* Converts an Integer instance to a Hexadecimal instance |
| 85 |
*/ |
| 86 |
public function toHexadecimal(IntegerObject $value): Hexadecimal; |
| 87 |
/** |
| 88 |
* Converts a Hexadecimal instance to an Integer instance |
| 89 |
*/ |
| 90 |
public function toInteger(Hexadecimal $value): IntegerObject; |
| 91 |
} |
| 92 |
|