← All changes
|
includes/sdk/google/ramsey/uuid/src/Generator/RandomLibAdapter.php
+12
-13
1.2.3
→
1.4.1
View file →
| @@ -9,31 +9,30 @@ | ||
| 9 | 9 | * @copyright Copyright (c) Ben Ramsey <ben@benramsey.com> |
| 10 | 10 | * @license http://opensource.org/licenses/MIT MIT |
| 11 | 11 | */ |
| 12 | 12 | declare (strict_types=1); |
| 13 | -namespace Dudlewebs\WPMCS\Ramsey\Uuid\Generator; | |
| 13 | +namespace Dudlewebs\WPMCS\GCP\Ramsey\Uuid\Generator; | |
| 14 | 14 | |
| 15 | -use Dudlewebs\WPMCS\RandomLib\Factory; | |
| 16 | -use Dudlewebs\WPMCS\RandomLib\Generator; | |
| 15 | +use Dudlewebs\WPMCS\GCP\RandomLib\Factory; | |
| 16 | +use Dudlewebs\WPMCS\GCP\RandomLib\Generator; | |
| 17 | 17 | /** |
| 18 | - * RandomLibAdapter generates strings of random binary data using the | |
| 19 | - * paragonie/random-lib library | |
| 18 | + * RandomLibAdapter generates strings of random binary data using the paragonie/random-lib library | |
| 20 | 19 | * |
| 20 | + * @deprecated This class will be removed in 5.0.0. Use the default RandomBytesGenerator or implement your own generator | |
| 21 | + * that implements RandomGeneratorInterface. | |
| 22 | + * | |
| 21 | 23 | * @link https://packagist.org/packages/paragonie/random-lib paragonie/random-lib |
| 22 | 24 | */ |
| 23 | 25 | class RandomLibAdapter implements RandomGeneratorInterface |
| 24 | 26 | { |
| 27 | + private Generator $generator; | |
| 25 | 28 | /** |
| 26 | - * @var Generator | |
| 27 | - */ | |
| 28 | - private $generator; | |
| 29 | - /** | |
| 30 | 29 | * Constructs a RandomLibAdapter |
| 31 | 30 | * |
| 32 | - * By default, if no Generator is passed in, this creates a high-strength | |
| 33 | - * generator to use when generating random binary data. | |
| 31 | + * By default, if no Generator is passed in, this creates a high-strength generator to use when generating random | |
| 32 | + * binary data. | |
| 34 | 33 | * |
| 35 | - * @param Generator|null $generator The generator to use when generating binary data | |
| 34 | + * @param Generator | null $generator The generator to use when generating binary data | |
| 36 | 35 | */ |
| 37 | 36 | public function __construct(?Generator $generator = null) |
| 38 | 37 | { |
| 39 | 38 | if ($generator === null) { |
| @@ -41,9 +40,9 @@ | ||
| 41 | 40 | $generator = $factory->getHighStrengthGenerator(); |
| 42 | 41 | } |
| 43 | 42 | $this->generator = $generator; |
| 44 | 43 | } |
| 45 | - public function generate(int $length): string | |
| 44 | + public function generate(int $length) : string | |
| 46 | 45 | { |
| 47 | 46 | return $this->generator->generate($length); |
| 48 | 47 | } |
| 49 | 48 | } |