ALPHA 3.0.2a

This commit is contained in:
TheGamecraft
2018-09-10 08:51:18 -04:00
parent 7fe13ae0a7
commit 0e0ef86b71
1404 changed files with 10604 additions and 33714 deletions

View File

@@ -1,5 +1,15 @@
# ramsey/uuid Changelog
## 3.8.0
_Released: 2018-07-19_
* Add support for determining MAC address on FreeBSD systems ([#212](https://github.com/ramsey/uuid/pull/212))
* Add a polyfill for PHP ctype functions to support systems where the ctype functions are not part of the PHP build ([#223](https://github.com/ramsey/uuid/pull/223))
* Improve validation to disallow UUIDs with a trailing newline character ([#225](https://github.com/ramsey/uuid/pull/225))
* Add annotations for thrown exceptions for improved IDE hinting ([#232](https://github.com/ramsey/uuid/pull/232))
* Improve documentation, testing, and project metadata (i.e. `.gitattributes`, etc.)
## 3.7.3
_Released: 2018-01-19_

View File

@@ -26,21 +26,23 @@
},
"require": {
"php": "^5.4 || ^7.0",
"paragonie/random_compat": "^1.0|^2.0"
"paragonie/random_compat": "^1.0|^2.0|9.99.99",
"symfony/polyfill-ctype": "^1.8"
},
"require-dev": {
"moontoast/math": "^1.1",
"codeception/aspect-mock": "^1.0 | ~2.0.0",
"doctrine/annotations": "~1.2.0",
"goaop/framework": "1.0.0-alpha.2 | ^1.0 | ~2.1.0",
"ircmaxell/random-lib": "^1.1",
"phpunit/phpunit": "^4.7|^5.0",
"squizlabs/php_codesniffer": "^2.3",
"jakub-onderka/php-parallel-lint": "^0.9.0",
"mockery/mockery": "^0.9.9",
"goaop/framework": "1.0.0-alpha.2 | ^1.0 | ^2.1",
"doctrine/annotations": "~1.2.0",
"codeception/aspect-mock": "^1.0 | ~2.0.0",
"php-mock/php-mock-phpunit": "^0.3|^1.1"
"moontoast/math": "^1.1",
"php-mock/php-mock-phpunit": "^0.3|^1.1",
"phpunit/phpunit": "^4.7|^5.0|^6.5",
"squizlabs/php_codesniffer": "^2.3"
},
"suggest": {
"ext-ctype": "Provides support for PHP Ctype functions",
"ircmaxell/random-lib": "Provides RandomLib for use with the RandomLibAdapter",
"ext-libsodium": "Provides the PECL libsodium extension for use with the SodiumRandomGenerator",
"ext-uuid": "Provides the PECL UUID extension for use with the PeclUuidTimeGenerator and PeclUuidRandomGenerator",
@@ -71,5 +73,8 @@
"@phpunit",
"@phpcs"
]
},
"config": {
"sort-packages": true
}
}

View File

@@ -1 +0,0 @@
_build/

View File

@@ -1,20 +0,0 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = ramseyuuid
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

View File

@@ -1,169 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# ramsey/uuid documentation build configuration file, created by
# sphinx-quickstart on Tue Jan 16 20:01:49 2018.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = []
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = 'ramsey/uuid'
copyright = '2018, Ben Ramsey'
author = 'Ben Ramsey'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '3.7'
# The full version, including alpha/beta/rc tags.
release = '3.7'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# This is required for the alabaster theme
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
html_sidebars = {
'**': [
'relations.html', # needs 'show_related': True theme option to display
'searchbox.html',
]
}
# -- Options for HTMLHelp output ------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'ramseyuuiddoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'ramseyuuid.tex', 'ramsey/uuid Documentation',
'Ben Ramsey', 'manual'),
]
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'ramseyuuid', 'ramsey/uuid Documentation',
[author], 1)
]
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'ramseyuuid', 'ramsey/uuid Documentation',
author, 'ramseyuuid', 'One line description of project.',
'Miscellaneous'),
]

View File

@@ -1,19 +0,0 @@
.. ramsey/uuid documentation master file, created by
sphinx-quickstart on Tue Jan 16 20:01:49 2018.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
ramsey/uuid
===========
.. toctree::
:maxdepth: 2
:caption: Contents:
Indices and tables
==================
* :ref:`genindex`
* :ref:`search`

View File

@@ -42,6 +42,7 @@ interface CodecInterface
*
* @param string $encodedUuid
* @return UuidInterface
* @throws \Ramsey\Uuid\Exception\InvalidUuidStringException
*/
public function decode($encodedUuid);
@@ -50,6 +51,8 @@ interface CodecInterface
*
* @param string $bytes
* @return UuidInterface
* @throws \Ramsey\Uuid\Exception\InvalidUuidStringException
* @throws \InvalidArgumentException if string has not 16 characters
*/
public function decodeBytes($bytes);
}

View File

@@ -60,6 +60,7 @@ class GuidStringCodec extends StringCodec
*
* @param string $encodedUuid
* @return UuidInterface
* @throws \Ramsey\Uuid\Exception\InvalidUuidStringException
*/
public function decode($encodedUuid)
{
@@ -75,6 +76,7 @@ class GuidStringCodec extends StringCodec
*
* @param string $bytes
* @return UuidInterface
* @throws \Ramsey\Uuid\Exception\InvalidUuidStringException
*/
public function decodeBytes($bytes)
{

View File

@@ -50,6 +50,7 @@ class OrderedTimeCodec extends StringCodec
*
* @param string $bytes
* @return UuidInterface
* @throws \InvalidArgumentException if string has not 16 characters
*/
public function decodeBytes($bytes)
{

View File

@@ -74,6 +74,7 @@ class StringCodec implements CodecInterface
*
* @param string $encodedUuid
* @return UuidInterface
* @throws \Ramsey\Uuid\Exception\InvalidUuidStringException
*/
public function decode($encodedUuid)
{
@@ -88,6 +89,7 @@ class StringCodec implements CodecInterface
*
* @param string $bytes
* @return UuidInterface
* @throws \InvalidArgumentException if string has not 16 characters
*/
public function decodeBytes($bytes)
{
@@ -115,6 +117,7 @@ class StringCodec implements CodecInterface
*
* @param string $encodedUuid
* @return array
* @throws \Ramsey\Uuid\Exception\InvalidUuidStringException
*/
protected function extractComponents($encodedUuid)
{

View File

@@ -60,6 +60,7 @@ class TimestampFirstCombCodec extends StringCodec
* @param string $encodedUuid
*
* @return UuidInterface
* @throws \Ramsey\Uuid\Exception\InvalidUuidStringException
*/
public function decode($encodedUuid)
{
@@ -76,6 +77,7 @@ class TimestampFirstCombCodec extends StringCodec
* @param string $bytes
*
* @return UuidInterface
* @throws \Ramsey\Uuid\Exception\InvalidUuidStringException
*/
public function decodeBytes($bytes)
{

View File

@@ -28,6 +28,7 @@ interface NumberConverterInterface
*
* @param string $hex The hexadecimal string representation to convert
* @return mixed
* @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present
*/
public function fromHex($hex);
@@ -39,6 +40,7 @@ interface NumberConverterInterface
* a true integer, a string integer, or a object representation that
* this converter can understand
* @return string Hexadecimal string
* @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present
*/
public function toHex($integer);
}

View File

@@ -30,7 +30,7 @@ class DegradedTimeConverter implements TimeConverterInterface
* @param string $seconds
* @param string $microSeconds
* @return void
* @throws UnsatisfiedDependencyException
* @throws UnsatisfiedDependencyException if called on a 32-bit system and `Moontoast\Math\BigNumber` is not present
*/
public function calculateTime($seconds, $microSeconds)
{

View File

@@ -27,6 +27,8 @@ interface TimeConverterInterface
* @param string $seconds
* @param string $microSeconds
* @return string[] An array guaranteed to contain `low`, `mid`, and `high` keys
* @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if called on a 32-bit system and
* `Moontoast\Math\BigNumber` is not present
* @link http://tools.ietf.org/html/rfc4122#section-4.2.2
*/
public function calculateTime($seconds, $microSeconds);

View File

@@ -24,6 +24,9 @@ use Ramsey\Uuid\Exception\UnsupportedOperationException;
*/
class DegradedUuid extends Uuid
{
/**
* @inheritdoc
*/
public function getDateTime()
{
if ($this->getVersion() != 1) {

View File

@@ -53,6 +53,9 @@ class CombGenerator implements RandomGeneratorInterface
*
* @param integer $length The number of bytes of random binary data to generate
* @return string A binary string
* @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present
* @throws \InvalidArgumentException if length is not a positive integer
* @throws \Exception
*/
public function generate($length)
{

View File

@@ -72,6 +72,10 @@ class DefaultTimeGenerator implements TimeGeneratorInterface
* could arise when the clock is set backwards in time or if the node ID
* changes.
* @return string A binary string
* @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if called on a 32-bit system and
* `Moontoast\Math\BigNumber` is not present
* @throws \InvalidArgumentException
* @throws \Exception if it was not possible to gather sufficient entropy
*/
public function generate($node = null, $clockSeq = null)
{
@@ -111,6 +115,8 @@ class DefaultTimeGenerator implements TimeGeneratorInterface
*
* @param string|int $node A node value that may be used to override the node provider
* @return string Hexadecimal representation of the node ID
* @throws \InvalidArgumentException
* @throws \Exception
*/
protected function getValidNode($node)
{

View File

@@ -28,6 +28,7 @@ class RandomBytesGenerator implements RandomGeneratorInterface
*
* @param integer $length The number of bytes of random binary data to generate
* @return string A binary string
* @throws \Exception if it was not possible to gather sufficient entropy
*/
public function generate($length)
{

View File

@@ -25,6 +25,9 @@ interface RandomGeneratorInterface
*
* @param integer $length The number of bytes of random binary data to generate
* @return string A binary string
* @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present
* @throws \InvalidArgumentException
* @throws \Exception if it was not possible to gather sufficient entropy
*/
public function generate($length);
}

View File

@@ -30,6 +30,10 @@ interface TimeGeneratorInterface
* could arise when the clock is set backwards in time or if the node ID
* changes.
* @return string A binary string
* @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if called on a 32-bit system and
* `Moontoast\Math\BigNumber` is not present
* @throws \InvalidArgumentException
* @throws \Exception if it was not possible to gather sufficient entropy
*/
public function generate($node = null, $clockSeq = null);
}

View File

@@ -43,6 +43,7 @@ class FallbackNodeProvider implements NodeProviderInterface
* and returning the first non-empty value found
*
* @return string System node ID as a hexadecimal string
* @throws \Exception
*/
public function getNode()
{

View File

@@ -28,6 +28,7 @@ class RandomNodeProvider implements NodeProviderInterface
* Returns the system node ID
*
* @return string System node ID as a hexadecimal string
* @throws \Exception if it was not possible to gather sufficient entropy
*/
public function getNode()
{

View File

@@ -62,6 +62,10 @@ class SystemNodeProvider implements NodeProviderInterface
*/
protected function getIfconfig()
{
if (strpos(strtolower(ini_get('disable_functions')), 'passthru') !== false) {
return '';
}
ob_start();
switch (strtoupper(substr(php_uname('a'), 0, 3))) {
case 'WIN':
@@ -70,6 +74,9 @@ class SystemNodeProvider implements NodeProviderInterface
case 'DAR':
passthru('ifconfig 2>&1');
break;
case 'FRE':
passthru('netstat -i -f link 2>&1');
break;
case 'LIN':
default:
passthru('netstat -ie 2>&1');
@@ -88,17 +95,16 @@ class SystemNodeProvider implements NodeProviderInterface
{
$mac = false;
if (strtoupper(php_uname('s')) === "LINUX") {
if (strtoupper(php_uname('s')) === 'LINUX') {
$addressPaths = glob('/sys/class/net/*/address', GLOB_NOSORT);
if (empty($addressPaths)) {
return false;
}
$macs = array_map(
'file_get_contents',
$addressPaths
);
array_walk($addressPaths, function ($addressPath) use (&$macs) {
$macs[] = file_get_contents($addressPath);
});
$macs = array_map('trim', $macs);

View File

@@ -24,6 +24,7 @@ interface NodeProviderInterface
* Returns the system node ID
*
* @return string System node ID as a hexadecimal string
* @throws \Exception if it was not possible to gather sufficient entropy
*/
public function getNode();
}

View File

@@ -229,6 +229,7 @@ class Uuid implements UuidInterface
*
* @param string $serialized
* @link http://php.net/manual/en/class.serializable.php
* @throws \Ramsey\Uuid\Exception\InvalidUuidStringException
*/
public function unserialize($serialized)
{
@@ -332,6 +333,9 @@ class Uuid implements UuidInterface
return $this->converter;
}
/**
* @inheritdoc
*/
public function getDateTime()
{
if ($this->getVersion() != 1) {
@@ -384,6 +388,9 @@ class Uuid implements UuidInterface
return str_replace('-', '', $this->toString());
}
/**
* @inheritdoc
*/
public function getInteger()
{
return $this->converter->fromHex($this->getHex());
@@ -393,6 +400,7 @@ class Uuid implements UuidInterface
* Returns the least significant 64 bits of this UUID's 128 bit value.
*
* @return mixed Converted representation of the unsigned 64-bit integer value
* @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present
*/
public function getLeastSignificantBits()
{
@@ -413,6 +421,7 @@ class Uuid implements UuidInterface
* Returns the most significant 64 bits of this UUID's 128 bit value.
*
* @return mixed Converted representation of the unsigned 64-bit integer value
* @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present
*/
public function getMostSignificantBits()
{
@@ -534,6 +543,9 @@ class Uuid implements UuidInterface
return hexdec($this->getTimestampHex());
}
/**
* @inheritdoc
*/
public function getTimestampHex()
{
if ($this->getVersion() != 1) {
@@ -612,6 +624,8 @@ class Uuid implements UuidInterface
*
* @param string $bytes
* @return UuidInterface
* @throws \Ramsey\Uuid\Exception\InvalidUuidStringException
* @throws \InvalidArgumentException
*/
public static function fromBytes($bytes)
{
@@ -623,6 +637,7 @@ class Uuid implements UuidInterface
*
* @param string $name A string that specifies a UUID
* @return UuidInterface
* @throws \Ramsey\Uuid\Exception\InvalidUuidStringException
*/
public static function fromString($name)
{
@@ -634,6 +649,8 @@ class Uuid implements UuidInterface
*
* @param string $integer String representation of 128-bit integer
* @return UuidInterface
* @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present
* @throws \Ramsey\Uuid\Exception\InvalidUuidStringException
*/
public static function fromInteger($integer)
{
@@ -654,7 +671,7 @@ class Uuid implements UuidInterface
return true;
}
if (!preg_match('/' . self::VALID_PATTERN . '/', $uuid)) {
if (!preg_match('/' . self::VALID_PATTERN . '/D', $uuid)) {
return false;
}
@@ -670,6 +687,10 @@ class Uuid implements UuidInterface
* could arise when the clock is set backwards in time or if the node ID
* changes.
* @return UuidInterface
* @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if called on a 32-bit system and
* `Moontoast\Math\BigNumber` is not present
* @throws \InvalidArgumentException
* @throws \Exception if it was not possible to gather sufficient entropy
*/
public static function uuid1($node = null, $clockSeq = null)
{
@@ -683,6 +704,7 @@ class Uuid implements UuidInterface
* @param string $ns The UUID namespace in which to create the named UUID
* @param string $name The name to create a UUID for
* @return UuidInterface
* @throws \Ramsey\Uuid\Exception\InvalidUuidStringException
*/
public static function uuid3($ns, $name)
{
@@ -693,6 +715,9 @@ class Uuid implements UuidInterface
* Generate a version 4 (random) UUID.
*
* @return UuidInterface
* @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present
* @throws \InvalidArgumentException
* @throws \Exception
*/
public static function uuid4()
{
@@ -706,6 +731,7 @@ class Uuid implements UuidInterface
* @param string $ns The UUID namespace in which to create the named UUID
* @param string $name The name to create a UUID for
* @return UuidInterface
* @throws \Ramsey\Uuid\Exception\InvalidUuidStringException
*/
public static function uuid5($ns, $name)
{

View File

@@ -180,17 +180,26 @@ class UuidFactory implements UuidFactoryInterface
$this->uuidBuilder = $builder;
}
/**
* @inheritdoc
*/
public function fromBytes($bytes)
{
return $this->codec->decodeBytes($bytes);
}
/**
* @inheritdoc
*/
public function fromString($uuid)
{
$uuid = strtolower($uuid);
return $this->codec->decode($uuid);
}
/**
* @inheritdoc
*/
public function fromInteger($integer)
{
$hex = $this->numberConverter->toHex($integer);
@@ -199,6 +208,9 @@ class UuidFactory implements UuidFactoryInterface
return $this->fromString($hex);
}
/**
* @inheritdoc
*/
public function uuid1($node = null, $clockSeq = null)
{
$bytes = $this->timeGenerator->generate($node, $clockSeq);
@@ -207,11 +219,17 @@ class UuidFactory implements UuidFactoryInterface
return $this->uuidFromHashedName($hex, 1);
}
/**
* @inheritdoc
*/
public function uuid3($ns, $name)
{
return $this->uuidFromNsAndName($ns, $name, 3, 'md5');
}
/**
* @inheritdoc
*/
public function uuid4()
{
$bytes = $this->randomGenerator->generate(16);
@@ -224,6 +242,9 @@ class UuidFactory implements UuidFactoryInterface
return $this->uuidFromHashedName($hex, 4);
}
/**
* @inheritdoc
*/
public function uuid5($ns, $name)
{
return $this->uuidFromNsAndName($ns, $name, 5, 'sha1');
@@ -253,6 +274,7 @@ class UuidFactory implements UuidFactoryInterface
* @param string $hashFunction The hash function to use when hashing together
* the namespace and name
* @return UuidInterface
* @throws \Ramsey\Uuid\Exception\InvalidUuidStringException
*/
protected function uuidFromNsAndName($ns, $name, $version, $hashFunction)
{

View File

@@ -23,12 +23,16 @@ interface UuidFactoryInterface
/**
* Generate a version 1 UUID from a host ID, sequence number, and the current time.
*
* @param int|string $node A 48-bit number representing the hardware address
* @param int|string|null $node A 48-bit number representing the hardware address
* This number may be represented as an integer or a hexadecimal string.
* @param int $clockSeq A 14-bit number used to help avoid duplicates that
* @param int|null $clockSeq A 14-bit number used to help avoid duplicates that
* could arise when the clock is set backwards in time or if the node ID
* changes.
* @return UuidInterface
* @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if called on a 32-bit system and
* `Moontoast\Math\BigNumber` is not present
* @throws \InvalidArgumentException
* @throws \Exception if it was not possible to gather sufficient entropy
*/
public function uuid1($node = null, $clockSeq = null);
@@ -39,6 +43,7 @@ interface UuidFactoryInterface
* @param string $ns The UUID namespace in which to create the named UUID
* @param string $name The name to create a UUID for
* @return UuidInterface
* @throws \Ramsey\Uuid\Exception\InvalidUuidStringException
*/
public function uuid3($ns, $name);
@@ -46,6 +51,9 @@ interface UuidFactoryInterface
* Generate a version 4 (random) UUID.
*
* @return UuidInterface
* @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present
* @throws \InvalidArgumentException
* @throws \Exception
*/
public function uuid4();
@@ -56,6 +64,7 @@ interface UuidFactoryInterface
* @param string $ns The UUID namespace in which to create the named UUID
* @param string $name The name to create a UUID for
* @return UuidInterface
* @throws \Ramsey\Uuid\Exception\InvalidUuidStringException
*/
public function uuid5($ns, $name);
@@ -64,6 +73,8 @@ interface UuidFactoryInterface
*
* @param string $bytes A 16-byte string representation of a UUID
* @return UuidInterface
* @throws \Ramsey\Uuid\Exception\InvalidUuidStringException
* @throws \InvalidArgumentException if string has not 16 characters
*/
public function fromBytes($bytes);
@@ -72,6 +83,7 @@ interface UuidFactoryInterface
*
* @param string $uuid A string representation of a UUID
* @return UuidInterface
* @throws \Ramsey\Uuid\Exception\InvalidUuidStringException
*/
public function fromString($uuid);
@@ -84,6 +96,8 @@ interface UuidFactoryInterface
* @param mixed $integer The integer to use when creating a `Uuid` from an
* integer; may be of any type understood by the configured number converter
* @return UuidInterface
* @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present
* @throws \Ramsey\Uuid\Exception\InvalidUuidStringException
*/
public function fromInteger($integer);
}

View File

@@ -123,6 +123,8 @@ interface UuidInterface extends \JsonSerializable, \Serializable
*
* @return \DateTime A PHP DateTime representation of the date
* @throws UnsupportedOperationException If this UUID is not a version 1 UUID
* @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if called in a 32-bit system and
* `Moontoast\Math\BigNumber` is not present
*/
public function getDateTime();
@@ -131,6 +133,7 @@ interface UuidInterface extends \JsonSerializable, \Serializable
* representation.
*
* @return mixed Converted representation of the unsigned 128-bit integer value
* @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present
*/
public function getInteger();