-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
140 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
namespace AbmmHasan\UUID; | ||
|
||
use Exception; | ||
|
||
if (!function_exists('AbmmHasan\UUID\uuid1')) { | ||
/** | ||
* Generates a version 1 UUID | ||
* | ||
* @param string|null $node The node value to use in the UUID. | ||
* @return string The generated UUID. | ||
* @throws Exception | ||
*/ | ||
function uuid1(string $node = null): string | ||
{ | ||
return GenerateUuid::v1($node); | ||
} | ||
} | ||
|
||
if (!function_exists('AbmmHasan\UUID\uuid3')) { | ||
/** | ||
* Generate a Version 3 UUID. | ||
* | ||
* @param string $string The string to generate the UUID from. | ||
* @param string $namespace The namespace to use for the UUID generation. Defaults to 'x500'. | ||
* @return string The generated UUID. | ||
* @throws Exception | ||
*/ | ||
function uuid3(string $string, string $namespace = 'x500'): string | ||
{ | ||
return GenerateUuid::v3($string, $namespace); | ||
} | ||
} | ||
|
||
if (!function_exists('AbmmHasan\UUID\uuid4')) { | ||
/** | ||
* Generates a version 4 UUID. | ||
* | ||
* @return string The generated UUID. | ||
* @throws Exception | ||
*/ | ||
function uuid4(): string | ||
{ | ||
return GenerateUuid::v4(); | ||
} | ||
} | ||
|
||
if (!function_exists('AbmmHasan\UUID\uuid5')) { | ||
/** | ||
* Generate a Version 5 UUID. | ||
* | ||
* @param string $string The string to generate the UUID from. | ||
* @param string $namespace The namespace to use for the UUID generation. Defaults to 'x500'. | ||
* @return string The generated UUID. | ||
* @throws Exception | ||
*/ | ||
function uuid5(string $string, string $namespace = 'x500'): string | ||
{ | ||
return GenerateUuid::v5($string, $namespace); | ||
} | ||
} |