Debian Codegraph @

vendor/ramsey/uuid/src/Converter/Number/BigNumberConverter.php

raw
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 <[email protected]>
10 * @license http://opensource.org/licenses/MIT MIT
11 */
12
13 declare(strict_types=1);
14
15 namespace Ramsey\Uuid\Converter\Number;
16
17 use Ramsey\Uuid\Converter\NumberConverterInterface;
18 use Ramsey\Uuid\Math\BrickMathCalculator;
19
20 /**
21 * Previously used to integrate moontoast/math as a bignum arithmetic library, BigNumberConverter is deprecated in favor
22 * of GenericNumberConverter
23 *
24 * @deprecated Please transition to {@see GenericNumberConverter}.
25 *
26 * @immutable
27 */
28 class BigNumberConverter implements NumberConverterInterface
29 {
30 private NumberConverterInterface $converter;
31
32 public function __construct()
33 {
34 $this->converter = new GenericNumberConverter(new BrickMathCalculator());
35 }
36
37 /**
38 * @pure
39 */
40 public function fromHex(string $hex): string
41 {
42 return $this->converter->fromHex($hex);
43 }
44
45 /**
46 * @pure
47 */
48 public function toHex(string $number): string
49 {
50 return $this->converter->toHex($number);
51 }
52 }