1 | <?php |
||
14 | final class BigInteger |
||
15 | { |
||
16 | /** |
||
17 | * Holds the BigInteger's value. |
||
18 | * |
||
19 | * @var resource |
||
20 | */ |
||
21 | private $value; |
||
22 | |||
23 | /** |
||
24 | * Converts base-10 and binary strings (base-256) to BigIntegers. |
||
25 | * |
||
26 | * @param $x base-10 number or base-$base number if $base set. |
||
27 | * @param int $base |
||
28 | */ |
||
29 | public function __construct($x = 0, $base = 10) |
||
51 | |||
52 | /** |
||
53 | * Converts a BigInteger to a byte string (eg. base-256). |
||
54 | * |
||
55 | * @return string |
||
56 | */ |
||
57 | public function toBytes() |
||
69 | |||
70 | /** |
||
71 | * Adds two BigIntegers. |
||
72 | * |
||
73 | * @param \Jose\Util\BigInteger $y |
||
74 | * |
||
75 | * @return \Jose\Util\BigInteger |
||
76 | */ |
||
77 | public function add(BigInteger $y) |
||
83 | |||
84 | /** |
||
85 | * Subtracts two BigIntegers. |
||
86 | * |
||
87 | * @param \Jose\Util\BigInteger $y |
||
88 | * |
||
89 | * @return \Jose\Util\BigInteger |
||
90 | */ |
||
91 | public function subtract(BigInteger $y) |
||
97 | |||
98 | /** |
||
99 | * Multiplies two BigIntegers. |
||
100 | * |
||
101 | * @param \Jose\Util\BigInteger $x |
||
102 | * |
||
103 | * @return \Jose\Util\BigInteger |
||
104 | */ |
||
105 | public function multiply(BigInteger $x) |
||
111 | |||
112 | /** |
||
113 | * Divides two BigIntegers. |
||
114 | * |
||
115 | * @param \Jose\Util\BigInteger $y |
||
116 | * |
||
117 | * @return \Jose\Util\BigInteger[] |
||
118 | */ |
||
119 | public function divide(BigInteger $y) |
||
132 | |||
133 | /** |
||
134 | * Performs modular exponentiation. |
||
135 | * |
||
136 | * @param \Jose\Util\BigInteger $e |
||
137 | * @param \Jose\Util\BigInteger $n |
||
138 | * |
||
139 | * @return \Jose\Util\BigInteger |
||
140 | */ |
||
141 | public function modPow(BigInteger $e, BigInteger $n) |
||
160 | |||
161 | /** |
||
162 | * Calculates modular inverses. |
||
163 | * |
||
164 | * @param \Jose\Util\BigInteger $n |
||
165 | * |
||
166 | * @return \Jose\Util\BigInteger|bool |
||
167 | */ |
||
168 | public function modInverse(BigInteger $n) |
||
174 | |||
175 | /** |
||
176 | * Absolute value. |
||
177 | * |
||
178 | * @return \Jose\Util\BigInteger |
||
179 | */ |
||
180 | public function abs() |
||
186 | |||
187 | /** |
||
188 | * Compares two numbers. |
||
189 | * |
||
190 | * @param \Jose\Util\BigInteger $y |
||
191 | * |
||
192 | * @return int < 0 if $this is less than $y; > 0 if $this is greater than $y, and 0 if they are equal. |
||
193 | */ |
||
194 | public function compare(BigInteger $y) |
||
198 | |||
199 | /** |
||
200 | * Logical Left Shift. |
||
201 | * |
||
202 | * @param int $shift |
||
203 | * |
||
204 | * @return \Jose\Util\BigInteger |
||
205 | * |
||
206 | */ |
||
207 | public function bitwise_leftShift($shift) |
||
214 | |||
215 | /** |
||
216 | * Generates a random BigInteger. |
||
217 | * |
||
218 | * Byte length is equal to $length. Uses \phpseclib\Crypt\Random if it's loaded and mt_rand if it's not. |
||
219 | * |
||
220 | * @param int $size |
||
221 | * |
||
222 | * @return \Jose\Util\BigInteger |
||
223 | */ |
||
224 | private static function _random_number_helper($size) |
||
228 | |||
229 | /** |
||
230 | * Generate a random number. |
||
231 | * |
||
232 | * @param \Jose\Util\BigInteger $min |
||
233 | * @param \Jose\Util\BigInteger $max |
||
234 | * |
||
235 | * @return \Jose\Util\BigInteger |
||
236 | */ |
||
237 | public static function random(BigInteger $min, BigInteger $max) |
||
273 | |||
274 | } |
||
275 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..