@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace UMA\Uuid; |
| 6 | 6 | |
@@ -39,15 +39,15 @@ discard block |
||
| 39 | 39 | public function __construct(UuidGenerator $generator, \DateTimeImmutable $epoch, int $span, int $granularity) |
| 40 | 40 | { |
| 41 | 41 | if (new \DateTimeImmutable('now') < $epoch) { |
| 42 | - throw new \InvalidArgumentException('$epoch must be in the past. Got timestamp: ' . $epoch->getTimestamp()); |
|
| 42 | + throw new \InvalidArgumentException('$epoch must be in the past. Got timestamp: '.$epoch->getTimestamp()); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | if (!\in_array($span, \range(1, 16), true)) { |
| 46 | - throw new \InvalidArgumentException('$span must be in the [1, 16] range. Got: ' . $span); |
|
| 46 | + throw new \InvalidArgumentException('$span must be in the [1, 16] range. Got: '.$span); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | if (!\in_array($granularity, \range(0, 6), true)) { |
| 50 | - throw new \InvalidArgumentException('$granularity must be in the [0, 6] range. Got: ' . $granularity); |
|
| 50 | + throw new \InvalidArgumentException('$granularity must be in the [0, 6] range. Got: '.$granularity); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | $this->generator = $generator; |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $head = $this->procrust($this->timestamp()); |
| 65 | 65 | $tail = \substr($this->generator->generate()->asBytes(), -16 + ($this->span / 2)); |
| 66 | 66 | |
| 67 | - return Uuid::fromBytes($head . $tail); |
|
| 67 | + return Uuid::fromBytes($head.$tail); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | public function getOverflowDate(): \DateTimeImmutable |
| 78 | 78 | { |
| 79 | - $maxTimestamp = (int)(($this->maxTimestamp() - $this->epoch)/$this->exponent); |
|
| 79 | + $maxTimestamp = (int) (($this->maxTimestamp() - $this->epoch) / $this->exponent); |
|
| 80 | 80 | |
| 81 | 81 | return new \DateTimeImmutable("@$maxTimestamp UTC"); |
| 82 | 82 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | private function timestamp(): string |
| 123 | 123 | { |
| 124 | - return \dechex((int)(\microtime(true) * $this->exponent) - $this->epoch); |
|
| 124 | + return \dechex((int) (\microtime(true) * $this->exponent) - $this->epoch); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | private function maxTimestamp(): int |