| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* This file is part of the ramsey/uuid library |
| 5 |
* |
| 6 |
* For the full copyright and license information, please view the LICENSE |
| 7 |
* file that was distributed with this source code. |
| 8 |
* |
| 9 |
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com> |
| 10 |
* @license http://opensource.org/licenses/MIT MIT |
| 11 |
*/ |
| 12 |
declare (strict_types=1); |
| 13 |
namespace Dudlewebs\WPMCS\Ramsey\Uuid\Codec; |
| 14 |
|
| 15 |
use Dudlewebs\WPMCS\Ramsey\Uuid\UuidInterface; |
| 16 |
/** |
| 17 |
* A codec encodes and decodes a UUID according to defined rules |
| 18 |
* |
| 19 |
* @psalm-immutable |
| 20 |
*/ |
| 21 |
interface CodecInterface |
| 22 |
{ |
| 23 |
/** |
| 24 |
* Returns a hexadecimal string representation of a UuidInterface |
| 25 |
* |
| 26 |
* @param UuidInterface $uuid The UUID for which to create a hexadecimal |
| 27 |
* string representation |
| 28 |
* |
| 29 |
* @return string Hexadecimal string representation of a UUID |
| 30 |
* |
| 31 |
* @psalm-return non-empty-string |
| 32 |
*/ |
| 33 |
public function encode(UuidInterface $uuid): string; |
| 34 |
/** |
| 35 |
* Returns a binary string representation of a UuidInterface |
| 36 |
* |
| 37 |
* @param UuidInterface $uuid The UUID for which to create a binary string |
| 38 |
* representation |
| 39 |
* |
| 40 |
* @return string Binary string representation of a UUID |
| 41 |
* |
| 42 |
* @psalm-return non-empty-string |
| 43 |
*/ |
| 44 |
public function encodeBinary(UuidInterface $uuid): string; |
| 45 |
/** |
| 46 |
* Returns a UuidInterface derived from a hexadecimal string representation |
| 47 |
* |
| 48 |
* @param string $encodedUuid The hexadecimal string representation to |
| 49 |
* convert into a UuidInterface instance |
| 50 |
* |
| 51 |
* @return UuidInterface An instance of a UUID decoded from a hexadecimal |
| 52 |
* string representation |
| 53 |
*/ |
| 54 |
public function decode(string $encodedUuid): UuidInterface; |
| 55 |
/** |
| 56 |
* Returns a UuidInterface derived from a binary string representation |
| 57 |
* |
| 58 |
* @param string $bytes The binary string representation to convert into a |
| 59 |
* UuidInterface instance |
| 60 |
* |
| 61 |
* @return UuidInterface An instance of a UUID decoded from a binary string |
| 62 |
* representation |
| 63 |
*/ |
| 64 |
public function decodeBytes(string $bytes): UuidInterface; |
| 65 |
} |
| 66 |
|