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,19 +8,15 @@
|
||||
*
|
||||
* @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\Converter;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
|
||||
|
||||
/**
|
||||
* TimeConverterInterface provides facilities for converting parts of time into
|
||||
* representations that may be used in UUIDs
|
||||
* A time converter converts timestamps into representations that may be used
|
||||
* in UUIDs
|
||||
*/
|
||||
interface TimeConverterInterface
|
||||
{
|
||||
@@ -27,24 +24,25 @@ interface TimeConverterInterface
|
||||
* Uses the provided seconds and micro-seconds to calculate the time_low,
|
||||
* time_mid, and time_high fields used by RFC 4122 version 1 UUIDs
|
||||
*
|
||||
* @param string $seconds
|
||||
* @param string $microSeconds
|
||||
* @link http://tools.ietf.org/html/rfc4122#section-4.2.2 RFC 4122, § 4.2.2: Generation Details
|
||||
*
|
||||
* @param string $seconds A string representation of the number of seconds
|
||||
* since the Unix epoch for the time to calculate
|
||||
* @param string $microSeconds A string representation of the micro-seconds
|
||||
* associated with the time to calculate
|
||||
*
|
||||
* @return string[] An array guaranteed to contain `low`, `mid`, and `hi` keys
|
||||
* @throws InvalidArgumentException if $seconds or $microseconds are not integer strings
|
||||
* @throws UnsatisfiedDependencyException if the chosen converter is not present
|
||||
* @link http://tools.ietf.org/html/rfc4122#section-4.2.2
|
||||
*/
|
||||
public function calculateTime(string $seconds, string $microSeconds): array;
|
||||
|
||||
/**
|
||||
* Converts a timestamp extracted from a UUID to a unix timestamp
|
||||
* Converts a timestamp extracted from a UUID to a Unix timestamp
|
||||
*
|
||||
* @param string $timestamp A string integer representation of a timestamp;
|
||||
* this must be a numeric string to accommodate unsigned integers
|
||||
* greater than PHP_INT_MAX.
|
||||
* @return string
|
||||
* @throws InvalidArgumentException if $timestamp is not an integer string
|
||||
* @throws UnsatisfiedDependencyException if the chosen converter is not present
|
||||
*
|
||||
* @return string String representation of an integer
|
||||
*/
|
||||
public function convertTime(string $timestamp): string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user