PHP Classes

File: vendor/ramsey/uuid/src/BinaryUtils.php

Recommend this page to a friend!
  Classes of Renato De Oliveira Lucena  >  PHP Pokemon Script  >  vendor/ramsey/uuid/src/BinaryUtils.php  >  Download  
File: vendor/ramsey/uuid/src/BinaryUtils.php
Role: Class source
Content type: text/plain
Description: Class source
Class: PHP Pokemon Script
Provides an API to manage a database of Pokemons
Author: By
Last change:
Date: 2 years ago
Size: 1,126 bytes
 

Contents

Class file image Download
<?php

namespace Ramsey\Uuid;

/**
 * Provides binary math utilities
 */
class BinaryUtils
{
   
/**
     * Applies the RFC 4122 variant field to the `clock_seq_hi_and_reserved` field
     *
     * @param $clockSeqHi
     * @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)
    {
       
// Set the variant to RFC 4122
       
$clockSeqHi = $clockSeqHi & 0x3f;
       
$clockSeqHi &= ~(0xc0);
       
$clockSeqHi |= 0x80;

        return
$clockSeqHi;
    }

   
/**
     * Applies the RFC 4122 version number to the `time_hi_and_version` field
     *
     * @param string $timeHi
     * @param integer $version
     * @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($timeHi, $version)
    {
       
$timeHi = hexdec($timeHi) & 0x0fff;
       
$timeHi &= ~(0xf000);
       
$timeHi |= $version << 12;

        return
$timeHi;
    }
}


For more information send a message to info at phpclasses dot org.