← All changes
|
includes/sdk/google/ramsey/uuid/src/Provider/Time/FixedTimeProvider.php
+15
-21
1.0.3
→
1.4.2
View file →
| @@ -9,48 +9,42 @@ | ||
| 9 | 9 | * @copyright Copyright (c) Ben Ramsey <[email protected]> |
| 10 | 10 | * @license http://opensource.org/licenses/MIT MIT |
| 11 | 11 | */ |
| 12 | 12 | declare (strict_types=1); |
| 13 | -namespace Dudlewebs\WPMCS\Ramsey\Uuid\Provider\Time; | |
| 13 | +namespace Dudlewebs\WPMCS\GCP\Ramsey\Uuid\Provider\Time; | |
| 14 | 14 | |
| 15 | -use Dudlewebs\WPMCS\Ramsey\Uuid\Provider\TimeProviderInterface; | |
| 16 | -use Dudlewebs\WPMCS\Ramsey\Uuid\Type\Integer as IntegerObject; | |
| 17 | -use Dudlewebs\WPMCS\Ramsey\Uuid\Type\Time; | |
| 15 | +use Dudlewebs\WPMCS\GCP\Ramsey\Uuid\Provider\TimeProviderInterface; | |
| 16 | +use Dudlewebs\WPMCS\GCP\Ramsey\Uuid\Type\Integer as IntegerObject; | |
| 17 | +use Dudlewebs\WPMCS\GCP\Ramsey\Uuid\Type\Time; | |
| 18 | 18 | /** |
| 19 | - * FixedTimeProvider uses an known time to provide the time | |
| 19 | + * FixedTimeProvider uses a known time to provide the time | |
| 20 | 20 | * |
| 21 | - * This provider allows the use of a previously-generated, or known, time | |
| 22 | - * when generating time-based UUIDs. | |
| 21 | + * This provider allows the use of a previously generated, or known, time when generating time-based UUIDs. | |
| 23 | 22 | */ |
| 24 | 23 | class FixedTimeProvider implements TimeProviderInterface |
| 25 | 24 | { |
| 26 | - /** | |
| 27 | - * @var Time | |
| 28 | - */ | |
| 29 | - private $fixedTime; | |
| 30 | - public function __construct(Time $time) | |
| 25 | + public function __construct(private Time $time) | |
| 31 | 26 | { |
| 32 | - $this->fixedTime = $time; | |
| 33 | 27 | } |
| 34 | 28 | /** |
| 35 | 29 | * Sets the `usec` component of the time |
| 36 | 30 | * |
| 37 | - * @param int|string|IntegerObject $value The `usec` value to set | |
| 31 | + * @param IntegerObject | int | string $value The `usec` value to set | |
| 38 | 32 | */ |
| 39 | - public function setUsec($value): void | |
| 33 | + public function setUsec($value) : void | |
| 40 | 34 | { |
| 41 | - $this->fixedTime = new Time($this->fixedTime->getSeconds(), $value); | |
| 35 | + $this->time = new Time($this->time->getSeconds(), $value); | |
| 42 | 36 | } |
| 43 | 37 | /** |
| 44 | 38 | * Sets the `sec` component of the time |
| 45 | 39 | * |
| 46 | - * @param int|string|IntegerObject $value The `sec` value to set | |
| 40 | + * @param IntegerObject | int | string $value The `sec` value to set | |
| 47 | 41 | */ |
| 48 | - public function setSec($value): void | |
| 42 | + public function setSec($value) : void | |
| 49 | 43 | { |
| 50 | - $this->fixedTime = new Time($value, $this->fixedTime->getMicroseconds()); | |
| 44 | + $this->time = new Time($value, $this->time->getMicroseconds()); | |
| 51 | 45 | } |
| 52 | - public function getTime(): Time | |
| 46 | + public function getTime() : Time | |
| 53 | 47 | { |
| 54 | - return $this->fixedTime; | |
| 48 | + return $this->time; | |
| 55 | 49 | } |
| 56 | 50 | } |