@@ -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 | /** |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | { |
79 | 79 | $fullTimestampLength = \strlen($this->timestamp()); |
80 | 80 | $choppedDigits = $fullTimestampLength < $this->span ? 0 : $fullTimestampLength - $this->span; |
81 | - $maxTimestamp = (int)(\hexdec(\str_pad('', $this->span + $choppedDigits, 'f'))/$this->exponent); |
|
81 | + $maxTimestamp = (int) (\hexdec(\str_pad('', $this->span + $choppedDigits, 'f')) / $this->exponent); |
|
82 | 82 | |
83 | 83 | return new \DateTimeImmutable("@$maxTimestamp UTC"); |
84 | 84 | } |
@@ -123,6 +123,6 @@ discard block |
||
123 | 123 | */ |
124 | 124 | private function timestamp(): string |
125 | 125 | { |
126 | - return \dechex((int)(\microtime(true) * $this->exponent) - $this->epoch); |
|
126 | + return \dechex((int) (\microtime(true) * $this->exponent) - $this->epoch); |
|
127 | 127 | } |
128 | 128 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace UMA\Uuid; |
6 | 6 |