vendor/ramsey/uuid/src/Converter/Number/DegradedNumberConverter.php line 25

Open in your IDE?
  1. <?php
  2. /**
  3.  * This file is part of the ramsey/uuid library
  4.  *
  5.  * For the full copyright and license information, please view the LICENSE
  6.  * file that was distributed with this source code.
  7.  *
  8.  * @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
  9.  * @license http://opensource.org/licenses/MIT MIT
  10.  * @link https://benramsey.com/projects/ramsey-uuid/ Documentation
  11.  * @link https://packagist.org/packages/ramsey/uuid Packagist
  12.  * @link https://github.com/ramsey/uuid GitHub
  13.  */
  14. namespace Ramsey\Uuid\Converter\Number;
  15. use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
  16. use Ramsey\Uuid\Converter\NumberConverterInterface;
  17. /**
  18.  * DegradedNumberConverter throws `UnsatisfiedDependencyException` exceptions
  19.  * if attempting to use number conversion functionality in an environment that
  20.  * does not support large integers (i.e. when moontoast/math is not available)
  21.  */
  22. class DegradedNumberConverter implements NumberConverterInterface
  23. {
  24.     /**
  25.      * Throws an `UnsatisfiedDependencyException`
  26.      *
  27.      * @param string $hex The hexadecimal string representation to convert
  28.      * @return void
  29.      * @throws UnsatisfiedDependencyException
  30.      */
  31.     public function fromHex($hex)
  32.     {
  33.         throw new UnsatisfiedDependencyException(
  34.             'Cannot call ' __METHOD__ ' without support for large '
  35.             'integers, since integer is an unsigned '
  36.             '128-bit integer; Moontoast\Math\BigNumber is required.'
  37.         );
  38.     }
  39.     /**
  40.      * Throws an `UnsatisfiedDependencyException`
  41.      *
  42.      * @param mixed $integer An integer representation to convert
  43.      * @return void
  44.      * @throws UnsatisfiedDependencyException
  45.      */
  46.     public function toHex($integer)
  47.     {
  48.         throw new UnsatisfiedDependencyException(
  49.             'Cannot call ' __METHOD__ ' without support for large '
  50.             'integers, since integer is an unsigned '
  51.             '128-bit integer; Moontoast\Math\BigNumber is required. '
  52.         );
  53.     }
  54. }