mirror of
https://github.com/ramsey/uuid.git
synced 2026-06-26 17:46:38 +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:
+25
-7
@@ -1,5 +1,17 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the ramsey/uuid library
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
||||
* @license http://opensource.org/licenses/MIT MIT
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Ramsey\Uuid;
|
||||
|
||||
/**
|
||||
@@ -10,13 +22,16 @@ class BinaryUtils
|
||||
/**
|
||||
* Applies the RFC 4122 variant field to the `clock_seq_hi_and_reserved` field
|
||||
*
|
||||
* @param int $clockSeqHi
|
||||
* @link http://tools.ietf.org/html/rfc4122#section-4.1.1 RFC 4122, § 4.1.1: Variant
|
||||
*
|
||||
* @param int $clockSeqHi The value of `clock_seq_hi_and_reserved` field
|
||||
* before the RFC 4122 variant is applied
|
||||
*
|
||||
* @return int The high field of the clock sequence multiplexed with the variant
|
||||
* @link http://tools.ietf.org/html/rfc4122#section-4.1.1
|
||||
*/
|
||||
public static function applyVariant($clockSeqHi): int
|
||||
public static function applyVariant(int $clockSeqHi): int
|
||||
{
|
||||
// Set the variant to RFC 4122
|
||||
// Set the variant to RFC 4122.
|
||||
$clockSeqHi = $clockSeqHi & 0x3f;
|
||||
$clockSeqHi |= 0x80;
|
||||
|
||||
@@ -26,10 +41,13 @@ class BinaryUtils
|
||||
/**
|
||||
* Applies the RFC 4122 version number to the `time_hi_and_version` field
|
||||
*
|
||||
* @param string $timeHi
|
||||
* @param int $version
|
||||
* @link http://tools.ietf.org/html/rfc4122#section-4.1.3 RFC 4122, § 4.1.3: Version
|
||||
*
|
||||
* @param string $timeHi The value of the `time_hi_and_version` field before
|
||||
* the RFC 4122 version is applied
|
||||
* @param int $version The RFC 4122 version to apply to the `time_hi` field
|
||||
*
|
||||
* @return int The high field of the timestamp multiplexed with the version number
|
||||
* @link http://tools.ietf.org/html/rfc4122#section-4.1.3
|
||||
*/
|
||||
public static function applyVersion(string $timeHi, int $version): int
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user