mirror of
https://github.com/ramsey/uuid.git
synced 2026-06-16 16:17:43 +03:00
Update coding style to include PSR-12, among other options
This also includes heavy use of slevomat/coding-standard to apply various checks to the code, based on maintainer (me) preference.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the ramsey/uuid library
|
||||
*
|
||||
@@ -7,54 +8,58 @@
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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(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
|
||||
* @return UuidInterface
|
||||
* @throws InvalidUuidStringException
|
||||
* @throws InvalidArgumentException if string has not 16 characters
|
||||
* @param string $bytes The binary string representation to convert into a
|
||||
* UuidInterface instance
|
||||
*
|
||||
* @return UuidInterface An instance of a UUID decoded from a binary string
|
||||
* representation
|
||||
*/
|
||||
public function decodeBytes(string $bytes): UuidInterface;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user