aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/ramsey/uuid/src/Codec/CodecInterface.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/ramsey/uuid/src/Codec/CodecInterface.php')
-rw-r--r--vendor/ramsey/uuid/src/Codec/CodecInterface.php57
1 files changed, 34 insertions, 23 deletions
diff --git a/vendor/ramsey/uuid/src/Codec/CodecInterface.php b/vendor/ramsey/uuid/src/Codec/CodecInterface.php
index c6c54c78a..85f8a7e99 100644
--- a/vendor/ramsey/uuid/src/Codec/CodecInterface.php
+++ b/vendor/ramsey/uuid/src/Codec/CodecInterface.php
@@ -1,4 +1,5 @@
<?php
+
/**
* This file is part of the ramsey/uuid library
*
@@ -7,54 +8,64 @@
*
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
* @license http://opensource.org/licenses/MIT MIT
- * @link https://benramsey.com/projects/ramsey-uuid/ Documentation
- * @link https://packagist.org/packages/ramsey/uuid Packagist
- * @link https://github.com/ramsey/uuid GitHub
*/
+declare(strict_types=1);
+
namespace Ramsey\Uuid\Codec;
-use InvalidArgumentException;
-use Ramsey\Uuid\Exception\InvalidUuidStringException;
use Ramsey\Uuid\UuidInterface;
/**
- * CodecInterface represents a UUID coder-decoder
+ * A codec encodes and decodes a UUID according to defined rules
+ *
+ * @psalm-immutable
*/
interface CodecInterface
{
/**
- * Encodes a UuidInterface as a string representation of a UUID
+ * Returns a hexadecimal string representation of a UuidInterface
+ *
+ * @param UuidInterface $uuid The UUID for which to create a hexadecimal
+ * string representation
*
- * @param UuidInterface $uuid
* @return string Hexadecimal string representation of a UUID
+ *
+ * @psalm-return non-empty-string
*/
- public function encode(UuidInterface $uuid);
+ public function encode(UuidInterface $uuid): string;
/**
- * Encodes a UuidInterface as a binary representation of a UUID
+ * Returns a binary string representation of a UuidInterface
+ *
+ * @param UuidInterface $uuid The UUID for which to create a binary string
+ * representation
*
- * @param UuidInterface $uuid
* @return string Binary string representation of a UUID
+ *
+ * @psalm-return non-empty-string
*/
- public function encodeBinary(UuidInterface $uuid);
+ public function encodeBinary(UuidInterface $uuid): string;
/**
- * Decodes a string representation of a UUID into a UuidInterface object instance
+ * Returns a UuidInterface derived from a hexadecimal string representation
*
- * @param string $encodedUuid
- * @return UuidInterface
- * @throws InvalidUuidStringException
+ * @param string $encodedUuid The hexadecimal string representation to
+ * convert into a UuidInterface instance
+ *
+ * @return UuidInterface An instance of a UUID decoded from a hexadecimal
+ * string representation
*/
- public function decode($encodedUuid);
+ public function decode(string $encodedUuid): UuidInterface;
/**
- * Decodes a binary representation of a UUID into a UuidInterface object instance
+ * Returns a UuidInterface derived from a binary string representation
+ *
+ * @param string $bytes The binary string representation to convert into a
+ * UuidInterface instance
*
- * @param string $bytes
- * @return UuidInterface
- * @throws InvalidUuidStringException
- * @throws InvalidArgumentException if string has not 16 characters
+ * @return UuidInterface An instance of a UUID decoded from a binary string
+ * representation
*/
- public function decodeBytes($bytes);
+ public function decodeBytes(string $bytes): UuidInterface;
}