From f4bb7bcbff3770387c2fecfa91ce4a60b916a474 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 27 Nov 2020 08:04:00 +0000 Subject: update composer libs --- vendor/ramsey/uuid/src/Fields/FieldsInterface.php | 32 ++++++++++++ .../uuid/src/Fields/SerializableFieldsTrait.php | 60 ++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 vendor/ramsey/uuid/src/Fields/FieldsInterface.php create mode 100644 vendor/ramsey/uuid/src/Fields/SerializableFieldsTrait.php (limited to 'vendor/ramsey/uuid/src/Fields') diff --git a/vendor/ramsey/uuid/src/Fields/FieldsInterface.php b/vendor/ramsey/uuid/src/Fields/FieldsInterface.php new file mode 100644 index 000000000..f1b7a290d --- /dev/null +++ b/vendor/ramsey/uuid/src/Fields/FieldsInterface.php @@ -0,0 +1,32 @@ + + * @license http://opensource.org/licenses/MIT MIT + */ + +declare(strict_types=1); + +namespace Ramsey\Uuid\Fields; + +use Serializable; + +/** + * UUIDs are comprised of unsigned integers, the bytes of which are separated + * into fields and arranged in a particular layout defined by the specification + * for the variant + * + * @psalm-immutable + */ +interface FieldsInterface extends Serializable +{ + /** + * Returns the bytes that comprise the fields + */ + public function getBytes(): string; +} diff --git a/vendor/ramsey/uuid/src/Fields/SerializableFieldsTrait.php b/vendor/ramsey/uuid/src/Fields/SerializableFieldsTrait.php new file mode 100644 index 000000000..4ae90be2c --- /dev/null +++ b/vendor/ramsey/uuid/src/Fields/SerializableFieldsTrait.php @@ -0,0 +1,60 @@ + + * @license http://opensource.org/licenses/MIT MIT + */ + +declare(strict_types=1); + +namespace Ramsey\Uuid\Fields; + +use function base64_decode; +use function strlen; + +/** + * Provides common serialization functionality to fields + * + * @psalm-immutable + */ +trait SerializableFieldsTrait +{ + /** + * @param string $bytes The bytes that comprise the fields + */ + abstract public function __construct(string $bytes); + + /** + * Returns the bytes that comprise the fields + */ + abstract public function getBytes(): string; + + /** + * Returns a string representation of object + */ + public function serialize(): string + { + return $this->getBytes(); + } + + /** + * Constructs the object from a serialized string representation + * + * @param string $serialized The serialized string representation of the object + * + * @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint + */ + public function unserialize($serialized): void + { + if (strlen($serialized) === 16) { + $this->__construct($serialized); + } else { + $this->__construct(base64_decode($serialized)); + } + } +} -- cgit v1.2.3