mirror of
https://github.com/ramsey/uuid.git
synced 2026-06-23 17:28:59 +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,31 +8,25 @@
|
||||
*
|
||||
* @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\Provider\Node;
|
||||
|
||||
use Exception;
|
||||
use Ramsey\Uuid\Provider\NodeProviderInterface;
|
||||
|
||||
/**
|
||||
* RandomNodeProvider provides functionality to generate a random node ID, in
|
||||
* the event that the node ID could not be obtained from the host system
|
||||
* RandomNodeProvider generates a random node ID
|
||||
*
|
||||
* @link http://tools.ietf.org/html/rfc4122#section-4.5
|
||||
* @link http://tools.ietf.org/html/rfc4122#section-4.5 RFC 4122, § 4.5: Node IDs that Do Not Identify the Host
|
||||
*/
|
||||
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
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getNode(): string
|
||||
public function getNode()
|
||||
{
|
||||
$nodeBytes = random_bytes(6);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user