media-cloud-sync
/
includes
/
sdk
/
google
/
ramsey
/
uuid
/
src
/
Converter
/
Time
/
BigNumberTimeConverter.php
BigNumberTimeConverter.php in Media Cloud Sync 1.0.0, at includes/sdk/google/ramsey/uuid/src/Converter/Time/BigNumberTimeConverter.php
| 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 | declare (strict_types=1); |
| 13 | namespace Dudlewebs\WPMCS\Ramsey\Uuid\Converter\Time; |
| 14 | |
| 15 | use Dudlewebs\WPMCS\Ramsey\Uuid\Converter\TimeConverterInterface; |
| 16 | use Dudlewebs\WPMCS\Ramsey\Uuid\Math\BrickMathCalculator; |
| 17 | use Dudlewebs\WPMCS\Ramsey\Uuid\Type\Hexadecimal; |
| 18 | use Dudlewebs\WPMCS\Ramsey\Uuid\Type\Time; |
| 19 | /** |
| 20 | * Previously used to integrate moontoast/math as a bignum arithmetic library, |
| 21 | * BigNumberTimeConverter is deprecated in favor of GenericTimeConverter |
| 22 | * |
| 23 | * @deprecated Transition to {@see GenericTimeConverter}. |
| 24 | * |
| 25 | * @psalm-immutable |
| 26 | */ |
| 27 | class BigNumberTimeConverter implements TimeConverterInterface |
| 28 | { |
| 29 | /** |
| 30 | * @var TimeConverterInterface |
| 31 | */ |
| 32 | private $converter; |
| 33 | public function __construct() |
| 34 | { |
| 35 | $this->converter = new GenericTimeConverter(new BrickMathCalculator()); |
| 36 | } |
| 37 | public function calculateTime(string $seconds, string $microseconds): Hexadecimal |
| 38 | { |
| 39 | return $this->converter->calculateTime($seconds, $microseconds); |
| 40 | } |
| 41 | public function convertTime(Hexadecimal $uuidTimestamp): Time |
| 42 | { |
| 43 | return $this->converter->convertTime($uuidTimestamp); |
| 44 | } |
| 45 | } |
| 46 |