function TimestampFirstCombCodec::swapBytes
Swaps bytes according to the timestamp-first COMB rules
4 calls to TimestampFirstCombCodec::swapBytes()
- TimestampFirstCombCodec::decode in vendor/
ramsey/ uuid/ src/ Codec/ TimestampFirstCombCodec.php - @inheritDoc
- TimestampFirstCombCodec::decodeBytes in vendor/
ramsey/ uuid/ src/ Codec/ TimestampFirstCombCodec.php - Returns a UuidInterface derived from a binary string representation
- TimestampFirstCombCodec::encode in vendor/
ramsey/ uuid/ src/ Codec/ TimestampFirstCombCodec.php - @psalm-return non-empty-string @psalm-suppress MoreSpecificReturnType we know that the retrieved `string` is never empty @psalm-suppress LessSpecificReturnStatement we know that the retrieved `string` is never empty
- TimestampFirstCombCodec::encodeBinary in vendor/
ramsey/ uuid/ src/ Codec/ TimestampFirstCombCodec.php - @psalm-return non-empty-string @psalm-suppress MoreSpecificReturnType we know that the retrieved `string` is never empty @psalm-suppress LessSpecificReturnStatement we know that the retrieved `string` is never empty
File
-
vendor/
ramsey/ uuid/ src/ Codec/ TimestampFirstCombCodec.php, line 103
Class
- TimestampFirstCombCodec
- TimestampFirstCombCodec encodes and decodes COMBs, with the timestamp as the first 48 bits
Namespace
Ramsey\Uuid\CodecCode
private function swapBytes(string $bytes) : string {
$first48Bits = substr($bytes, 0, 6);
$last48Bits = substr($bytes, -6);
$bytes = substr_replace($bytes, $last48Bits, 0, 6);
$bytes = substr_replace($bytes, $first48Bits, -6);
return $bytes;
}