@@ -38,7 +38,7 @@ |
||
38 | 38 | } |
39 | 39 | |
40 | 40 | // Use the 16 most significant octets of the hash as the basis for the new Uuid. |
41 | - $bytes = \unpack('C16', \sha1($this->nsBytes . $name, true)); |
|
41 | + $bytes = \unpack('C16', \sha1($this->nsBytes.$name, true)); |
|
42 | 42 | |
43 | 43 | // Set the four most significant bits (bits 12 through 15) of the |
44 | 44 | // time_hi_and_version field to the appropriate 4-bit version number |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | private function __construct(string $text) |
37 | 37 | { |
38 | 38 | if (false === self::isUuid($text)) { |
39 | - throw new \InvalidArgumentException('$text is not a valid Uuid. Got: ' . $text); |
|
39 | + throw new \InvalidArgumentException('$text is not a valid Uuid. Got: '.$text); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | $this->uuid = \strtolower($text); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | public static function fromBytes(string $bytes): Uuid |
67 | 67 | { |
68 | 68 | if (16 !== \strlen($bytes)) { |
69 | - throw new \InvalidArgumentException('Length of $bytes for new Uuid is not 16. Got: 0x' . \bin2hex($bytes)); |
|
69 | + throw new \InvalidArgumentException('Length of $bytes for new Uuid is not 16. Got: 0x'.\bin2hex($bytes)); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | return new self(self::bin2str($bytes)); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | public function __construct(string $nodeID) |
48 | 48 | { |
49 | 49 | if (0 === \preg_match(self::MAC_ADDR_FORMAT, $nodeID)) { |
50 | - throw new \InvalidArgumentException('$nodeID is not a valid MAC address. Got: ' . $nodeID); |
|
50 | + throw new \InvalidArgumentException('$nodeID is not a valid MAC address. Got: '.$nodeID); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | $this->nodeID = \str_replace(':', '', $nodeID); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | $bytes = \pack( |
61 | 61 | 'NnnnH12', |
62 | - $t & 0xffffffff, |
|
62 | + $t & 0xffffffff, |
|
63 | 63 | $t >> 32 & 0xffff, |
64 | 64 | $t >> 48 & 0x0fff | 0x1000, |
65 | 65 | \random_int(0, 0x3fff) | 0x8000, |
@@ -83,6 +83,6 @@ discard block |
||
83 | 83 | */ |
84 | 84 | private function timestamp(): int |
85 | 85 | { |
86 | - return self::GREGORIAN_OFFSET + (int)(10000000 * \microtime(true)); |
|
86 | + return self::GREGORIAN_OFFSET + (int) (10000000 * \microtime(true)); |
|
87 | 87 | } |
88 | 88 | } |
@@ -44,6 +44,6 @@ |
||
44 | 44 | */ |
45 | 45 | public function generate(string $name = null): Uuid |
46 | 46 | { |
47 | - return Uuid::fromBytes($this->head . \pack('J', $this->counter++)); |
|
47 | + return Uuid::fromBytes($this->head.\pack('J', $this->counter++)); |
|
48 | 48 | } |
49 | 49 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | public function __construct(int $granularity = 6) |
28 | 28 | { |
29 | 29 | if (!\in_array($granularity, \range(0, 6), true)) { |
30 | - throw new \InvalidArgumentException('$granularity must be in the [0, 6] range. Got: ' . $granularity); |
|
30 | + throw new \InvalidArgumentException('$granularity must be in the [0, 6] range. Got: '.$granularity); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | $this->exponent = 10 ** $granularity; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $head = $this->procrust($this->timestamp()); |
43 | 43 | $tail = \substr($this->v4->generate()->asBytes(), -10); |
44 | 44 | |
45 | - return Uuid::fromBytes($head . $tail); |
|
45 | + return Uuid::fromBytes($head.$tail); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | { |
57 | 57 | $fullTimestampLength = \strlen($this->timestamp()); |
58 | 58 | $choppedDigits = $fullTimestampLength < 12 ? 0 : $fullTimestampLength - 12; |
59 | - $maxTimestamp = (int)(\hexdec(\str_pad('', 12 + $choppedDigits, 'f'))/$this->exponent); |
|
59 | + $maxTimestamp = (int) (\hexdec(\str_pad('', 12 + $choppedDigits, 'f')) / $this->exponent); |
|
60 | 60 | |
61 | 61 | return new \DateTimeImmutable("@$maxTimestamp UTC"); |
62 | 62 | } |
@@ -101,6 +101,6 @@ discard block |
||
101 | 101 | */ |
102 | 102 | private function timestamp(): string |
103 | 103 | { |
104 | - return \dechex((int)(\microtime(true) * $this->exponent)); |
|
104 | + return \dechex((int) (\microtime(true) * $this->exponent)); |
|
105 | 105 | } |
106 | 106 | } |