[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * This file is part of the ramsey/uuid library 5 * 6 * For the full copyright and license information, please view the LICENSE 7 * file that was distributed with this source code. 8 * 9 * @copyright Copyright (c) Ben Ramsey <[email protected]> 10 * @license http://opensource.org/licenses/MIT MIT 11 */ 12 13 namespace Ramsey\Uuid; 14 15 use Exception; 16 use InvalidArgumentException; 17 use Ramsey\Uuid\Exception\InvalidUuidStringException; 18 use Ramsey\Uuid\Exception\UnsatisfiedDependencyException; 19 20 /** 21 * Generate a version 1 UUID from a host ID, sequence number, and the current time. 22 * 23 * @param int|string|null $node A 48-bit number representing the hardware address 24 * This number may be represented as an integer or a hexadecimal string. 25 * @param int|null $clockSeq A 14-bit number used to help avoid duplicates that 26 * could arise when the clock is set backwards in time or if the node ID 27 * changes. 28 * @return string 29 * @throws UnsatisfiedDependencyException if called on a 32-bit system and 30 * `Moontoast\Math\BigNumber` is not present 31 * @throws InvalidArgumentException 32 * @throws Exception if it was not possible to gather sufficient entropy 33 */ 34 function v1($node = null, $clockSeq = null) 35 { 36 return Uuid::uuid1($node, $clockSeq)->toString(); 37 } 38 39 /** 40 * Generate a version 3 UUID based on the MD5 hash of a namespace identifier 41 * (which is a UUID) and a name (which is a string). 42 * 43 * @param string|UuidInterface $ns The UUID namespace in which to create the named UUID 44 * @param string $name The name to create a UUID for 45 * @return string 46 * @throws InvalidUuidStringException 47 */ 48 function v3($ns, $name) 49 { 50 return Uuid::uuid3($ns, $name)->toString(); 51 } 52 53 /** 54 * Generate a version 4 (random) UUID. 55 * 56 * @return string 57 * @throws UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present 58 * @throws InvalidArgumentException 59 * @throws Exception 60 */ 61 function v4() 62 { 63 return Uuid::uuid4()->toString(); 64 } 65 66 /** 67 * Generate a version 5 UUID based on the SHA-1 hash of a namespace 68 * identifier (which is a UUID) and a name (which is a string). 69 * 70 * @param string|UuidInterface $ns The UUID namespace in which to create the named UUID 71 * @param string $name The name to create a UUID for 72 * @return string 73 * @throws InvalidUuidStringException 74 */ 75 function v5($ns, $name) 76 { 77 return Uuid::uuid5($ns, $name)->toString(); 78 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |