Version Description
Download this release
Release Info
Developer | paultgoodchild |
Plugin | Shield Security for WordPress |
Version | 9.0.2 |
Comparing to | |
See all releases |
Code changes from version 9.0.1 to 9.0.2
- icwp-wpsf.php +1 -1
- plugin-spec.php +3 -3
- readme.txt +8 -2
- src/config/feature-login_protect.php +1 -0
- src/features/login_protect.php +1 -1
- src/lib/src/Controller/Controller.php +37 -21
- src/lib/src/Modules/Autoupdates/Strings.php +7 -4
- src/lib/src/Modules/LoginGuard/Strings.php +6 -4
- src/lib/src/Scans/Mal/BuildScanAction.php +0 -2
- src/lib/src/Scans/Ptg/BuildFileMap.php +4 -1
- src/lib/src/Scans/Ptg/BuildScanAction.php +17 -0
- src/lib/vendor/composer/autoload_classmap.php +46 -0
- src/lib/vendor/composer/autoload_files.php +1 -0
- src/lib/vendor/composer/autoload_psr4.php +1 -0
- src/lib/vendor/composer/autoload_real.php +3 -0
- src/lib/vendor/composer/autoload_static.php +52 -0
- src/lib/vendor/fernleafsystems/wordpress-services/src/Core/Plugins.php +5 -6
- src/lib/vendor/fernleafsystems/wordpress-services/src/Core/Themes.php +5 -6
- src/lib/vendor/ramsey/uuid/src/BinaryUtils.php +41 -0
- src/lib/vendor/ramsey/uuid/src/Builder/DefaultUuidBuilder.php +54 -0
- src/lib/vendor/ramsey/uuid/src/Builder/DegradedUuidBuilder.php +53 -0
- src/lib/vendor/ramsey/uuid/src/Builder/UuidBuilderInterface.php +34 -0
- src/lib/vendor/ramsey/uuid/src/Codec/CodecInterface.php +60 -0
- src/lib/vendor/ramsey/uuid/src/Codec/GuidStringCodec.php +103 -0
- src/lib/vendor/ramsey/uuid/src/Codec/OrderedTimeCodec.php +68 -0
- src/lib/vendor/ramsey/uuid/src/Codec/StringCodec.php +170 -0
- src/lib/vendor/ramsey/uuid/src/Codec/TimestampFirstCombCodec.php +108 -0
- src/lib/vendor/ramsey/uuid/src/Codec/TimestampLastCombCodec.php +22 -0
- src/lib/vendor/ramsey/uuid/src/Converter/Number/BigNumberConverter.php +54 -0
- src/lib/vendor/ramsey/uuid/src/Converter/Number/DegradedNumberConverter.php +58 -0
- src/lib/vendor/ramsey/uuid/src/Converter/NumberConverterInterface.php +48 -0
- src/lib/vendor/ramsey/uuid/src/Converter/Time/BigNumberTimeConverter.php +59 -0
- src/lib/vendor/ramsey/uuid/src/Converter/Time/DegradedTimeConverter.php +42 -0
- src/lib/vendor/ramsey/uuid/src/Converter/Time/PhpTimeConverter.php +47 -0
- src/lib/vendor/ramsey/uuid/src/Converter/TimeConverterInterface.php +37 -0
- src/lib/vendor/ramsey/uuid/src/DegradedUuid.php +116 -0
- src/lib/vendor/ramsey/uuid/src/Exception/InvalidUuidStringException.php +24 -0
- src/lib/vendor/ramsey/uuid/src/Exception/UnsatisfiedDependencyException.php +25 -0
- src/lib/vendor/ramsey/uuid/src/Exception/UnsupportedOperationException.php +24 -0
- src/lib/vendor/ramsey/uuid/src/FeatureSet.php +335 -0
- src/lib/vendor/ramsey/uuid/src/Generator/CombGenerator.php +91 -0
- src/lib/vendor/ramsey/uuid/src/Generator/DefaultTimeGenerator.php +141 -0
- src/lib/vendor/ramsey/uuid/src/Generator/MtRandGenerator.php +45 -0
- src/lib/vendor/ramsey/uuid/src/Generator/OpenSslGenerator.php +43 -0
- src/lib/vendor/ramsey/uuid/src/Generator/PeclUuidRandomGenerator.php +37 -0
- src/lib/vendor/ramsey/uuid/src/Generator/PeclUuidTimeGenerator.php +38 -0
- src/lib/vendor/ramsey/uuid/src/Generator/RandomBytesGenerator.php +39 -0
- src/lib/vendor/ramsey/uuid/src/Generator/RandomGeneratorFactory.php +31 -0
- src/lib/vendor/ramsey/uuid/src/Generator/RandomGeneratorInterface.php +37 -0
- src/lib/vendor/ramsey/uuid/src/Generator/RandomLibAdapter.php +62 -0
- src/lib/vendor/ramsey/uuid/src/Generator/SodiumRandomGenerator.php +41 -0
- src/lib/vendor/ramsey/uuid/src/Generator/TimeGeneratorFactory.php +72 -0
- src/lib/vendor/ramsey/uuid/src/Generator/TimeGeneratorInterface.php +43 -0
- src/lib/vendor/ramsey/uuid/src/Provider/Node/FallbackNodeProvider.php +59 -0
- src/lib/vendor/ramsey/uuid/src/Provider/Node/RandomNodeProvider.php +57 -0
- src/lib/vendor/ramsey/uuid/src/Provider/Node/SystemNodeProvider.php +128 -0
- src/lib/vendor/ramsey/uuid/src/Provider/NodeProviderInterface.php +32 -0
- src/lib/vendor/ramsey/uuid/src/Provider/Time/FixedTimeProvider.php +77 -0
- src/lib/vendor/ramsey/uuid/src/Provider/Time/SystemTimeProvider.php +33 -0
- src/lib/vendor/ramsey/uuid/src/Provider/TimeProviderInterface.php +29 -0
- src/lib/vendor/ramsey/uuid/src/Uuid.php +751 -0
- src/lib/vendor/ramsey/uuid/src/UuidFactory.php +315 -0
- src/lib/vendor/ramsey/uuid/src/UuidFactoryInterface.php +108 -0
- src/lib/vendor/ramsey/uuid/src/UuidInterface.php +274 -0
- src/lib/vendor/ramsey/uuid/src/functions.php +78 -0
- src/lib/vendor/symfony/polyfill-ctype/bootstrap.php +20 -0
- src/lib/vendor/symfony/polyfill-mbstring/bootstrap.php +86 -9
- src/processors/email.php +7 -6
- templates/twig/wpadmin_pages/insights/config/module_summaries.twig +1 -1
icwp-wpsf.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Shield Security
|
4 |
* Plugin URI: https://shsec.io/2f
|
5 |
* Description: Powerful, Easy-To-Use #1 Rated WordPress Security System
|
6 |
-
* Version: 9.0.
|
7 |
* Text Domain: wp-simple-firewall
|
8 |
* Domain Path: /languages
|
9 |
* Author: Shield Security
|
3 |
* Plugin Name: Shield Security
|
4 |
* Plugin URI: https://shsec.io/2f
|
5 |
* Description: Powerful, Easy-To-Use #1 Rated WordPress Security System
|
6 |
+
* Version: 9.0.2
|
7 |
* Text Domain: wp-simple-firewall
|
8 |
* Domain Path: /languages
|
9 |
* Author: Shield Security
|
plugin-spec.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
{
|
2 |
"properties": {
|
3 |
-
"version": "9.0.
|
4 |
-
"release_timestamp":
|
5 |
-
"build": "202005.
|
6 |
"slug_parent": "icwp",
|
7 |
"slug_plugin": "wpsf",
|
8 |
"human_name": "Shield",
|
1 |
{
|
2 |
"properties": {
|
3 |
+
"version": "9.0.2",
|
4 |
+
"release_timestamp": 1589452434,
|
5 |
+
"build": "202005.1402",
|
6 |
"slug_parent": "icwp",
|
7 |
"slug_plugin": "wpsf",
|
8 |
"human_name": "Shield",
|
readme.txt
CHANGED
@@ -8,7 +8,7 @@ Requires at least: 3.5.2
|
|
8 |
Requires PHP: 5.4.0
|
9 |
Recommended PHP: 7.0
|
10 |
Tested up to: 5.4
|
11 |
-
Stable tag: 9.0.
|
12 |
|
13 |
Smarter security protection from hackers through automation. Powerful scanners, 2-Factor Auth, limit logins, auto IP blocks & more.
|
14 |
|
@@ -373,8 +373,14 @@ You will always be able to use Shield Security and its free features in-full.
|
|
373 |
#### 9.0 Series
|
374 |
*Released: 5th April 2020* - [Release Announcement](https://shsec.io/hq)
|
375 |
|
376 |
-
**
|
377 |
|
|
|
|
|
|
|
|
|
|
|
|
|
378 |
* **(.1) FIXED**: Javascript for Anti-Bot Login Protection not loading in all cases.
|
379 |
* **(.1) FIXED**: MemberPress Registration protection PHP error.
|
380 |
* **(.0) NEW**: [*PRO*] [Critical File Locker](https://shsec.io/h4) to protect `wp-config.php` files.
|
8 |
Requires PHP: 5.4.0
|
9 |
Recommended PHP: 7.0
|
10 |
Tested up to: 5.4
|
11 |
+
Stable tag: 9.0.2
|
12 |
|
13 |
Smarter security protection from hackers through automation. Powerful scanners, 2-Factor Auth, limit logins, auto IP blocks & more.
|
14 |
|
373 |
#### 9.0 Series
|
374 |
*Released: 5th April 2020* - [Release Announcement](https://shsec.io/hq)
|
375 |
|
376 |
+
**Important**: The 9.0 Series is the last major version to support PHP 5.x. Shield 10+ will require a minimum of PHP 7.0.
|
377 |
|
378 |
+
##### [Please review the full Shield 9.0 Upgrade Guide here](https://shsec.io/shieldupgradeguide90).
|
379 |
+
|
380 |
+
* **(.2) IMPROVED**: Plugin/Theme Guard only scans certain types of files based on their extension. I.e. ignoring readme.txt, for example.
|
381 |
+
* **(.2) IMPROVED**: Some minor improvements to encoding special characters in the email subject/from name.
|
382 |
+
* **(.2) IMPROVED**: [WPHashes.com](https://shsec.io/hs) API token update is more reliable.
|
383 |
+
* **(.2) FIXED**: Applying a plugin update from within the Vulnerabilities scanner no longer disables that plugin.
|
384 |
* **(.1) FIXED**: Javascript for Anti-Bot Login Protection not loading in all cases.
|
385 |
* **(.1) FIXED**: MemberPress Registration protection PHP error.
|
386 |
* **(.0) NEW**: [*PRO*] [Critical File Locker](https://shsec.io/h4) to protect `wp-config.php` files.
|
src/config/feature-login_protect.php
CHANGED
@@ -352,6 +352,7 @@
|
|
352 |
{
|
353 |
"key": "antibot_form_ids",
|
354 |
"section": "section_brute_force_login_protection",
|
|
|
355 |
"type": "array",
|
356 |
"default": [
|
357 |
"form#ihc_login_form",
|
352 |
{
|
353 |
"key": "antibot_form_ids",
|
354 |
"section": "section_brute_force_login_protection",
|
355 |
+
"premium": true,
|
356 |
"type": "array",
|
357 |
"default": [
|
358 |
"form#ihc_login_form",
|
src/features/login_protect.php
CHANGED
@@ -26,7 +26,7 @@ class ICWP_WPSF_FeatureHandler_LoginProtect extends ICWP_WPSF_FeatureHandler_Bas
|
|
26 |
->sendEmailVerifyCanSend();
|
27 |
}
|
28 |
|
29 |
-
$aIds = $oOpts->
|
30 |
foreach ( $aIds as $nKey => $sId ) {
|
31 |
$sId = trim( strip_tags( $sId ) );
|
32 |
if ( empty( $sId ) ) {
|
26 |
->sendEmailVerifyCanSend();
|
27 |
}
|
28 |
|
29 |
+
$aIds = $oOpts->getOpt( 'antibot_form_ids', [] );
|
30 |
foreach ( $aIds as $nKey => $sId ) {
|
31 |
$sId = trim( strip_tags( $sId ) );
|
32 |
if ( empty( $sId ) ) {
|
src/lib/src/Controller/Controller.php
CHANGED
@@ -444,33 +444,51 @@ class Controller {
|
|
444 |
/**
|
445 |
* Only set to rebuild as required if you're doing so at the same point in the WordPress load each time.
|
446 |
* Certain plugins can modify the ID at different points in the load.
|
447 |
-
* @param bool $bRebuildIfRequired
|
448 |
* @return string - the unique, never-changing site install ID.
|
449 |
*/
|
450 |
-
public function getSiteInstallationId(
|
|
|
451 |
$sOptKey = $this->prefixOption( 'install_id' );
|
452 |
-
$aID = Services::WpGeneral()->getOption( $sOptKey );
|
453 |
|
454 |
-
$
|
455 |
-
|
456 |
-
'
|
457 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
458 |
|
459 |
-
if ( !
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
|
|
|
|
|
|
464 |
}
|
465 |
|
466 |
-
if (
|
467 |
-
|
468 |
-
$aID[ 'id' ] = sha1( uniqid( Services::WpGeneral()->getHomeUrl( '', true ), true ) );
|
469 |
-
$aID[ 'uniqs' ] = $aPossibleUniqs;
|
470 |
-
Services::WpGeneral()->updateOption( $sOptKey, $aID );
|
471 |
}
|
472 |
|
473 |
-
return $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
474 |
}
|
475 |
|
476 |
public function onWpLoaded() {
|
@@ -991,15 +1009,13 @@ class Controller {
|
|
991 |
* Hooked to 'shutdown'
|
992 |
*/
|
993 |
public function onWpShutdown() {
|
994 |
-
$this->getSiteInstallationId(
|
995 |
do_action( $this->prefix( 'pre_plugin_shutdown' ) );
|
996 |
do_action( $this->prefix( 'plugin_shutdown' ) );
|
997 |
$this->saveCurrentPluginControllerOptions();
|
998 |
$this->deleteFlags();
|
999 |
}
|
1000 |
|
1001 |
-
/**
|
1002 |
-
*/
|
1003 |
public function onWpLogout() {
|
1004 |
if ( $this->hasSessionId() ) {
|
1005 |
$this->clearSession();
|
444 |
/**
|
445 |
* Only set to rebuild as required if you're doing so at the same point in the WordPress load each time.
|
446 |
* Certain plugins can modify the ID at different points in the load.
|
|
|
447 |
* @return string - the unique, never-changing site install ID.
|
448 |
*/
|
449 |
+
public function getSiteInstallationId() {
|
450 |
+
$oWP = Services::WpGeneral();
|
451 |
$sOptKey = $this->prefixOption( 'install_id' );
|
|
|
452 |
|
453 |
+
$mStoredID = $oWP->getOption( $sOptKey );
|
454 |
+
if ( is_array( $mStoredID ) && !empty( $mStoredID[ 'id' ] ) ) {
|
455 |
+
$sID = $mStoredID[ 'id' ];
|
456 |
+
$bUpdate = true;
|
457 |
+
}
|
458 |
+
elseif ( is_string( $mStoredID ) && strpos( $mStoredID, ':' ) ) {
|
459 |
+
$sID = explode( ':', $mStoredID, 2 )[ 1 ];
|
460 |
+
$bUpdate = true;
|
461 |
+
}
|
462 |
+
else {
|
463 |
+
$sID = $mStoredID;
|
464 |
+
$bUpdate = false;
|
465 |
+
}
|
466 |
|
467 |
+
if ( empty( $sID ) || !is_string( $sID ) || ( strlen( $sID ) !== 40 && !\Ramsey\Uuid\Uuid::isValid( $sID ) ) ) {
|
468 |
+
try {
|
469 |
+
$sID = \Ramsey\Uuid\Uuid::uuid4()->toString();
|
470 |
+
}
|
471 |
+
catch ( \Exception $e ) {
|
472 |
+
$sID = sha1( uniqid( $oWP->getHomeUrl( '', true ), true ) );
|
473 |
+
}
|
474 |
+
$bUpdate = true;
|
475 |
}
|
476 |
|
477 |
+
if ( $bUpdate ) {
|
478 |
+
$oWP->updateOption( $sOptKey, $sID );
|
|
|
|
|
|
|
479 |
}
|
480 |
|
481 |
+
return $sID;
|
482 |
+
}
|
483 |
+
|
484 |
+
/**
|
485 |
+
* TODO: Use to set ID after license verify where applicable
|
486 |
+
* @param string $sID
|
487 |
+
*/
|
488 |
+
public function setSiteInstallID( $sID ) {
|
489 |
+
if ( !empty( $sID ) && ( \Ramsey\Uuid\Uuid::isValid( $sID ) ) ) {
|
490 |
+
Services::WpGeneral()->updateOption( $this->prefixOption( 'install_id' ), $sID );
|
491 |
+
}
|
492 |
}
|
493 |
|
494 |
public function onWpLoaded() {
|
1009 |
* Hooked to 'shutdown'
|
1010 |
*/
|
1011 |
public function onWpShutdown() {
|
1012 |
+
$this->getSiteInstallationId();
|
1013 |
do_action( $this->prefix( 'pre_plugin_shutdown' ) );
|
1014 |
do_action( $this->prefix( 'plugin_shutdown' ) );
|
1015 |
$this->saveCurrentPluginControllerOptions();
|
1016 |
$this->deleteFlags();
|
1017 |
}
|
1018 |
|
|
|
|
|
1019 |
public function onWpLogout() {
|
1020 |
if ( $this->hasSessionId() ) {
|
1021 |
$this->clearSession();
|
src/lib/src/Modules/Autoupdates/Strings.php
CHANGED
@@ -101,10 +101,13 @@ class Strings extends Base\Strings {
|
|
101 |
case 'autoupdate_plugin_self' :
|
102 |
$sName = __( 'Auto Update Plugin', 'wp-simple-firewall' );
|
103 |
$sSummary = __( 'Always Automatically Update This Plugin', 'wp-simple-firewall' );
|
104 |
-
$sDescription =
|
105 |
-
|
106 |
-
|
107 |
-
|
|
|
|
|
|
|
108 |
break;
|
109 |
|
110 |
case 'autoupdate_core' :
|
101 |
case 'autoupdate_plugin_self' :
|
102 |
$sName = __( 'Auto Update Plugin', 'wp-simple-firewall' );
|
103 |
$sSummary = __( 'Always Automatically Update This Plugin', 'wp-simple-firewall' );
|
104 |
+
$sDescription = [
|
105 |
+
sprintf(
|
106 |
+
__( 'Regardless of any other settings, automatically update the "%s" plugin.', 'wp-simple-firewall' ),
|
107 |
+
$sPlugName
|
108 |
+
),
|
109 |
+
__( 'The plugin will normally automatically update after approximately 2 days, if left to decide.', 'wp-simple-firewall' )
|
110 |
+
];
|
111 |
break;
|
112 |
|
113 |
case 'autoupdate_core' :
|
src/lib/src/Modules/LoginGuard/Strings.php
CHANGED
@@ -235,10 +235,12 @@ class Strings extends Base\Strings {
|
|
235 |
case 'antibot_form_ids' :
|
236 |
$sName = __( 'AntiBot Forms', 'wp-simple-firewall' );
|
237 |
$sSummary = __( 'Enter The Selectors Of The 3rd Party Login Forms For Use With AntiBot JS', 'wp-simple-firewall' );
|
238 |
-
$sDescription =
|
239 |
-
|
240 |
-
|
241 |
-
|
|
|
|
|
242 |
break;
|
243 |
|
244 |
case 'login_limit_interval' :
|
235 |
case 'antibot_form_ids' :
|
236 |
$sName = __( 'AntiBot Forms', 'wp-simple-firewall' );
|
237 |
$sSummary = __( 'Enter The Selectors Of The 3rd Party Login Forms For Use With AntiBot JS', 'wp-simple-firewall' );
|
238 |
+
$sDescription = [
|
239 |
+
__( 'Provide DOM selectors to attached AntiBot protection to any form.', 'wp-simple-firewall' ),
|
240 |
+
__( 'IDs are prefixed with "#".', 'wp-simple-firewall' ),
|
241 |
+
__( 'Classes are prefixed with ".".', 'wp-simple-firewall' ),
|
242 |
+
__( 'IDs are preferred over classes.', 'wp-simple-firewall' )
|
243 |
+
];
|
244 |
break;
|
245 |
|
246 |
case 'login_limit_interval' :
|
src/lib/src/Scans/Mal/BuildScanAction.php
CHANGED
@@ -15,8 +15,6 @@ class BuildScanAction extends Shield\Scans\Base\BaseBuildScanAction {
|
|
15 |
->build();
|
16 |
}
|
17 |
|
18 |
-
/**
|
19 |
-
*/
|
20 |
protected function setCustomFields() {
|
21 |
/** @var ScanActionVO $oAction */
|
22 |
$oAction = $this->getScanActionVO();
|
15 |
->build();
|
16 |
}
|
17 |
|
|
|
|
|
18 |
protected function setCustomFields() {
|
19 |
/** @var ScanActionVO $oAction */
|
20 |
$oAction = $this->getScanActionVO();
|
src/lib/src/Scans/Ptg/BuildFileMap.php
CHANGED
@@ -20,10 +20,13 @@ class BuildFileMap {
|
|
20 |
public function build() {
|
21 |
$aFiles = [];
|
22 |
|
|
|
|
|
|
|
23 |
$sAbsPath = wp_normalize_path( ABSPATH );
|
24 |
foreach ( $this->getScanRoots() as $sRootDir ) {
|
25 |
try {
|
26 |
-
$oDirIt = StandardDirectoryIterator::create( $sRootDir );
|
27 |
foreach ( $oDirIt as $oFsItem ) {
|
28 |
/** @var \SplFileInfo $oFsItem */
|
29 |
if ( $oFsItem->getSize() != 0 ) {
|
20 |
public function build() {
|
21 |
$aFiles = [];
|
22 |
|
23 |
+
/** @var ScanActionVO $oScanAction */
|
24 |
+
$oScanAction = $this->getScanActionVO();
|
25 |
+
|
26 |
$sAbsPath = wp_normalize_path( ABSPATH );
|
27 |
foreach ( $this->getScanRoots() as $sRootDir ) {
|
28 |
try {
|
29 |
+
$oDirIt = StandardDirectoryIterator::create( $sRootDir, 0, $oScanAction->file_exts );
|
30 |
foreach ( $oDirIt as $oFsItem ) {
|
31 |
/** @var \SplFileInfo $oFsItem */
|
32 |
if ( $oFsItem->getSize() != 0 ) {
|
src/lib/src/Scans/Ptg/BuildScanAction.php
CHANGED
@@ -13,4 +13,21 @@ class BuildScanAction extends Shield\Scans\Base\BaseBuildScanAction {
|
|
13 |
->setScanActionVO( $oAction )
|
14 |
->build();
|
15 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
}
|
13 |
->setScanActionVO( $oAction )
|
14 |
->build();
|
15 |
}
|
16 |
+
|
17 |
+
protected function setCustomFields() {
|
18 |
+
/** @var ScanActionVO $oAction */
|
19 |
+
$oAction = $this->getScanActionVO();
|
20 |
+
$oAction->file_exts = $this->getFileExts();
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @return array
|
25 |
+
*/
|
26 |
+
private function getFileExts() {
|
27 |
+
$aFileExts = apply_filters(
|
28 |
+
$this->getCon()->prefix( 'scan_ptg_file_exts' ),
|
29 |
+
[ 'js', 'json', 'otf', 'svg', 'ttf', 'eot', 'woff', 'woff2', 'php', 'php5', 'php7', 'phtml' ]
|
30 |
+
);
|
31 |
+
return is_array( $aFileExts ) ? $aFileExts : [];
|
32 |
+
}
|
33 |
}
|
src/lib/vendor/composer/autoload_classmap.php
CHANGED
@@ -780,6 +780,52 @@ return array(
|
|
780 |
'Psr\\Container\\ContainerExceptionInterface' => $vendorDir . '/psr/container/src/ContainerExceptionInterface.php',
|
781 |
'Psr\\Container\\ContainerInterface' => $vendorDir . '/psr/container/src/ContainerInterface.php',
|
782 |
'Psr\\Container\\NotFoundExceptionInterface' => $vendorDir . '/psr/container/src/NotFoundExceptionInterface.php',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
783 |
'ReCaptcha\\ReCaptcha' => $vendorDir . '/google/recaptcha/src/ReCaptcha/ReCaptcha.php',
|
784 |
'ReCaptcha\\RequestMethod' => $vendorDir . '/google/recaptcha/src/ReCaptcha/RequestMethod.php',
|
785 |
'ReCaptcha\\RequestMethod\\Curl' => $vendorDir . '/google/recaptcha/src/ReCaptcha/RequestMethod/Curl.php',
|
780 |
'Psr\\Container\\ContainerExceptionInterface' => $vendorDir . '/psr/container/src/ContainerExceptionInterface.php',
|
781 |
'Psr\\Container\\ContainerInterface' => $vendorDir . '/psr/container/src/ContainerInterface.php',
|
782 |
'Psr\\Container\\NotFoundExceptionInterface' => $vendorDir . '/psr/container/src/NotFoundExceptionInterface.php',
|
783 |
+
'Ramsey\\Uuid\\BinaryUtils' => $vendorDir . '/ramsey/uuid/src/BinaryUtils.php',
|
784 |
+
'Ramsey\\Uuid\\Builder\\DefaultUuidBuilder' => $vendorDir . '/ramsey/uuid/src/Builder/DefaultUuidBuilder.php',
|
785 |
+
'Ramsey\\Uuid\\Builder\\DegradedUuidBuilder' => $vendorDir . '/ramsey/uuid/src/Builder/DegradedUuidBuilder.php',
|
786 |
+
'Ramsey\\Uuid\\Builder\\UuidBuilderInterface' => $vendorDir . '/ramsey/uuid/src/Builder/UuidBuilderInterface.php',
|
787 |
+
'Ramsey\\Uuid\\Codec\\CodecInterface' => $vendorDir . '/ramsey/uuid/src/Codec/CodecInterface.php',
|
788 |
+
'Ramsey\\Uuid\\Codec\\GuidStringCodec' => $vendorDir . '/ramsey/uuid/src/Codec/GuidStringCodec.php',
|
789 |
+
'Ramsey\\Uuid\\Codec\\OrderedTimeCodec' => $vendorDir . '/ramsey/uuid/src/Codec/OrderedTimeCodec.php',
|
790 |
+
'Ramsey\\Uuid\\Codec\\StringCodec' => $vendorDir . '/ramsey/uuid/src/Codec/StringCodec.php',
|
791 |
+
'Ramsey\\Uuid\\Codec\\TimestampFirstCombCodec' => $vendorDir . '/ramsey/uuid/src/Codec/TimestampFirstCombCodec.php',
|
792 |
+
'Ramsey\\Uuid\\Codec\\TimestampLastCombCodec' => $vendorDir . '/ramsey/uuid/src/Codec/TimestampLastCombCodec.php',
|
793 |
+
'Ramsey\\Uuid\\Converter\\NumberConverterInterface' => $vendorDir . '/ramsey/uuid/src/Converter/NumberConverterInterface.php',
|
794 |
+
'Ramsey\\Uuid\\Converter\\Number\\BigNumberConverter' => $vendorDir . '/ramsey/uuid/src/Converter/Number/BigNumberConverter.php',
|
795 |
+
'Ramsey\\Uuid\\Converter\\Number\\DegradedNumberConverter' => $vendorDir . '/ramsey/uuid/src/Converter/Number/DegradedNumberConverter.php',
|
796 |
+
'Ramsey\\Uuid\\Converter\\TimeConverterInterface' => $vendorDir . '/ramsey/uuid/src/Converter/TimeConverterInterface.php',
|
797 |
+
'Ramsey\\Uuid\\Converter\\Time\\BigNumberTimeConverter' => $vendorDir . '/ramsey/uuid/src/Converter/Time/BigNumberTimeConverter.php',
|
798 |
+
'Ramsey\\Uuid\\Converter\\Time\\DegradedTimeConverter' => $vendorDir . '/ramsey/uuid/src/Converter/Time/DegradedTimeConverter.php',
|
799 |
+
'Ramsey\\Uuid\\Converter\\Time\\PhpTimeConverter' => $vendorDir . '/ramsey/uuid/src/Converter/Time/PhpTimeConverter.php',
|
800 |
+
'Ramsey\\Uuid\\DegradedUuid' => $vendorDir . '/ramsey/uuid/src/DegradedUuid.php',
|
801 |
+
'Ramsey\\Uuid\\Exception\\InvalidUuidStringException' => $vendorDir . '/ramsey/uuid/src/Exception/InvalidUuidStringException.php',
|
802 |
+
'Ramsey\\Uuid\\Exception\\UnsatisfiedDependencyException' => $vendorDir . '/ramsey/uuid/src/Exception/UnsatisfiedDependencyException.php',
|
803 |
+
'Ramsey\\Uuid\\Exception\\UnsupportedOperationException' => $vendorDir . '/ramsey/uuid/src/Exception/UnsupportedOperationException.php',
|
804 |
+
'Ramsey\\Uuid\\FeatureSet' => $vendorDir . '/ramsey/uuid/src/FeatureSet.php',
|
805 |
+
'Ramsey\\Uuid\\Generator\\CombGenerator' => $vendorDir . '/ramsey/uuid/src/Generator/CombGenerator.php',
|
806 |
+
'Ramsey\\Uuid\\Generator\\DefaultTimeGenerator' => $vendorDir . '/ramsey/uuid/src/Generator/DefaultTimeGenerator.php',
|
807 |
+
'Ramsey\\Uuid\\Generator\\MtRandGenerator' => $vendorDir . '/ramsey/uuid/src/Generator/MtRandGenerator.php',
|
808 |
+
'Ramsey\\Uuid\\Generator\\OpenSslGenerator' => $vendorDir . '/ramsey/uuid/src/Generator/OpenSslGenerator.php',
|
809 |
+
'Ramsey\\Uuid\\Generator\\PeclUuidRandomGenerator' => $vendorDir . '/ramsey/uuid/src/Generator/PeclUuidRandomGenerator.php',
|
810 |
+
'Ramsey\\Uuid\\Generator\\PeclUuidTimeGenerator' => $vendorDir . '/ramsey/uuid/src/Generator/PeclUuidTimeGenerator.php',
|
811 |
+
'Ramsey\\Uuid\\Generator\\RandomBytesGenerator' => $vendorDir . '/ramsey/uuid/src/Generator/RandomBytesGenerator.php',
|
812 |
+
'Ramsey\\Uuid\\Generator\\RandomGeneratorFactory' => $vendorDir . '/ramsey/uuid/src/Generator/RandomGeneratorFactory.php',
|
813 |
+
'Ramsey\\Uuid\\Generator\\RandomGeneratorInterface' => $vendorDir . '/ramsey/uuid/src/Generator/RandomGeneratorInterface.php',
|
814 |
+
'Ramsey\\Uuid\\Generator\\RandomLibAdapter' => $vendorDir . '/ramsey/uuid/src/Generator/RandomLibAdapter.php',
|
815 |
+
'Ramsey\\Uuid\\Generator\\SodiumRandomGenerator' => $vendorDir . '/ramsey/uuid/src/Generator/SodiumRandomGenerator.php',
|
816 |
+
'Ramsey\\Uuid\\Generator\\TimeGeneratorFactory' => $vendorDir . '/ramsey/uuid/src/Generator/TimeGeneratorFactory.php',
|
817 |
+
'Ramsey\\Uuid\\Generator\\TimeGeneratorInterface' => $vendorDir . '/ramsey/uuid/src/Generator/TimeGeneratorInterface.php',
|
818 |
+
'Ramsey\\Uuid\\Provider\\NodeProviderInterface' => $vendorDir . '/ramsey/uuid/src/Provider/NodeProviderInterface.php',
|
819 |
+
'Ramsey\\Uuid\\Provider\\Node\\FallbackNodeProvider' => $vendorDir . '/ramsey/uuid/src/Provider/Node/FallbackNodeProvider.php',
|
820 |
+
'Ramsey\\Uuid\\Provider\\Node\\RandomNodeProvider' => $vendorDir . '/ramsey/uuid/src/Provider/Node/RandomNodeProvider.php',
|
821 |
+
'Ramsey\\Uuid\\Provider\\Node\\SystemNodeProvider' => $vendorDir . '/ramsey/uuid/src/Provider/Node/SystemNodeProvider.php',
|
822 |
+
'Ramsey\\Uuid\\Provider\\TimeProviderInterface' => $vendorDir . '/ramsey/uuid/src/Provider/TimeProviderInterface.php',
|
823 |
+
'Ramsey\\Uuid\\Provider\\Time\\FixedTimeProvider' => $vendorDir . '/ramsey/uuid/src/Provider/Time/FixedTimeProvider.php',
|
824 |
+
'Ramsey\\Uuid\\Provider\\Time\\SystemTimeProvider' => $vendorDir . '/ramsey/uuid/src/Provider/Time/SystemTimeProvider.php',
|
825 |
+
'Ramsey\\Uuid\\Uuid' => $vendorDir . '/ramsey/uuid/src/Uuid.php',
|
826 |
+
'Ramsey\\Uuid\\UuidFactory' => $vendorDir . '/ramsey/uuid/src/UuidFactory.php',
|
827 |
+
'Ramsey\\Uuid\\UuidFactoryInterface' => $vendorDir . '/ramsey/uuid/src/UuidFactoryInterface.php',
|
828 |
+
'Ramsey\\Uuid\\UuidInterface' => $vendorDir . '/ramsey/uuid/src/UuidInterface.php',
|
829 |
'ReCaptcha\\ReCaptcha' => $vendorDir . '/google/recaptcha/src/ReCaptcha/ReCaptcha.php',
|
830 |
'ReCaptcha\\RequestMethod' => $vendorDir . '/google/recaptcha/src/ReCaptcha/RequestMethod.php',
|
831 |
'ReCaptcha\\RequestMethod\\Curl' => $vendorDir . '/google/recaptcha/src/ReCaptcha/RequestMethod/Curl.php',
|
src/lib/vendor/composer/autoload_files.php
CHANGED
@@ -9,4 +9,5 @@ return array(
|
|
9 |
'320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
|
10 |
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
|
11 |
'5255c38a0faeba867671b61dfda6d864' => $vendorDir . '/paragonie/random_compat/lib/random.php',
|
|
|
12 |
);
|
9 |
'320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
|
10 |
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
|
11 |
'5255c38a0faeba867671b61dfda6d864' => $vendorDir . '/paragonie/random_compat/lib/random.php',
|
12 |
+
'e39a8b23c42d4e1452234d762b03835a' => $vendorDir . '/ramsey/uuid/src/functions.php',
|
13 |
);
|
src/lib/vendor/composer/autoload_psr4.php
CHANGED
@@ -13,6 +13,7 @@ return array(
|
|
13 |
'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'),
|
14 |
'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'),
|
15 |
'ReCaptcha\\' => array($vendorDir . '/google/recaptcha/src/ReCaptcha'),
|
|
|
16 |
'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
|
17 |
'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'),
|
18 |
'LZCompressor\\' => array($vendorDir . '/nullpunkt/lz-string-php/src/LZCompressor'),
|
13 |
'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'),
|
14 |
'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'),
|
15 |
'ReCaptcha\\' => array($vendorDir . '/google/recaptcha/src/ReCaptcha'),
|
16 |
+
'Ramsey\\Uuid\\' => array($vendorDir . '/ramsey/uuid/src'),
|
17 |
'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
|
18 |
'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'),
|
19 |
'LZCompressor\\' => array($vendorDir . '/nullpunkt/lz-string-php/src/LZCompressor'),
|
src/lib/vendor/composer/autoload_real.php
CHANGED
@@ -13,6 +13,9 @@ class ComposerAutoloaderInitfcf2fe1888f1f5fc092770cdc8ef3cf4
|
|
13 |
}
|
14 |
}
|
15 |
|
|
|
|
|
|
|
16 |
public static function getLoader()
|
17 |
{
|
18 |
if (null !== self::$loader) {
|
13 |
}
|
14 |
}
|
15 |
|
16 |
+
/**
|
17 |
+
* @return \Composer\Autoload\ClassLoader
|
18 |
+
*/
|
19 |
public static function getLoader()
|
20 |
{
|
21 |
if (null !== self::$loader) {
|
src/lib/vendor/composer/autoload_static.php
CHANGED
@@ -10,6 +10,7 @@ class ComposerStaticInitfcf2fe1888f1f5fc092770cdc8ef3cf4
|
|
10 |
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
|
11 |
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
|
12 |
'5255c38a0faeba867671b61dfda6d864' => __DIR__ . '/..' . '/paragonie/random_compat/lib/random.php',
|
|
|
13 |
);
|
14 |
|
15 |
public static $prefixLengthsPsr4 = array (
|
@@ -31,6 +32,7 @@ class ComposerStaticInitfcf2fe1888f1f5fc092770cdc8ef3cf4
|
|
31 |
'R' =>
|
32 |
array (
|
33 |
'ReCaptcha\\' => 10,
|
|
|
34 |
),
|
35 |
'P' =>
|
36 |
array (
|
@@ -90,6 +92,10 @@ class ComposerStaticInitfcf2fe1888f1f5fc092770cdc8ef3cf4
|
|
90 |
array (
|
91 |
0 => __DIR__ . '/..' . '/google/recaptcha/src/ReCaptcha',
|
92 |
),
|
|
|
|
|
|
|
|
|
93 |
'Psr\\Container\\' =>
|
94 |
array (
|
95 |
0 => __DIR__ . '/..' . '/psr/container/src',
|
@@ -929,6 +935,52 @@ class ComposerStaticInitfcf2fe1888f1f5fc092770cdc8ef3cf4
|
|
929 |
'Psr\\Container\\ContainerExceptionInterface' => __DIR__ . '/..' . '/psr/container/src/ContainerExceptionInterface.php',
|
930 |
'Psr\\Container\\ContainerInterface' => __DIR__ . '/..' . '/psr/container/src/ContainerInterface.php',
|
931 |
'Psr\\Container\\NotFoundExceptionInterface' => __DIR__ . '/..' . '/psr/container/src/NotFoundExceptionInterface.php',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
932 |
'ReCaptcha\\ReCaptcha' => __DIR__ . '/..' . '/google/recaptcha/src/ReCaptcha/ReCaptcha.php',
|
933 |
'ReCaptcha\\RequestMethod' => __DIR__ . '/..' . '/google/recaptcha/src/ReCaptcha/RequestMethod.php',
|
934 |
'ReCaptcha\\RequestMethod\\Curl' => __DIR__ . '/..' . '/google/recaptcha/src/ReCaptcha/RequestMethod/Curl.php',
|
10 |
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
|
11 |
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
|
12 |
'5255c38a0faeba867671b61dfda6d864' => __DIR__ . '/..' . '/paragonie/random_compat/lib/random.php',
|
13 |
+
'e39a8b23c42d4e1452234d762b03835a' => __DIR__ . '/..' . '/ramsey/uuid/src/functions.php',
|
14 |
);
|
15 |
|
16 |
public static $prefixLengthsPsr4 = array (
|
32 |
'R' =>
|
33 |
array (
|
34 |
'ReCaptcha\\' => 10,
|
35 |
+
'Ramsey\\Uuid\\' => 12,
|
36 |
),
|
37 |
'P' =>
|
38 |
array (
|
92 |
array (
|
93 |
0 => __DIR__ . '/..' . '/google/recaptcha/src/ReCaptcha',
|
94 |
),
|
95 |
+
'Ramsey\\Uuid\\' =>
|
96 |
+
array (
|
97 |
+
0 => __DIR__ . '/..' . '/ramsey/uuid/src',
|
98 |
+
),
|
99 |
'Psr\\Container\\' =>
|
100 |
array (
|
101 |
0 => __DIR__ . '/..' . '/psr/container/src',
|
935 |
'Psr\\Container\\ContainerExceptionInterface' => __DIR__ . '/..' . '/psr/container/src/ContainerExceptionInterface.php',
|
936 |
'Psr\\Container\\ContainerInterface' => __DIR__ . '/..' . '/psr/container/src/ContainerInterface.php',
|
937 |
'Psr\\Container\\NotFoundExceptionInterface' => __DIR__ . '/..' . '/psr/container/src/NotFoundExceptionInterface.php',
|
938 |
+
'Ramsey\\Uuid\\BinaryUtils' => __DIR__ . '/..' . '/ramsey/uuid/src/BinaryUtils.php',
|
939 |
+
'Ramsey\\Uuid\\Builder\\DefaultUuidBuilder' => __DIR__ . '/..' . '/ramsey/uuid/src/Builder/DefaultUuidBuilder.php',
|
940 |
+
'Ramsey\\Uuid\\Builder\\DegradedUuidBuilder' => __DIR__ . '/..' . '/ramsey/uuid/src/Builder/DegradedUuidBuilder.php',
|
941 |
+
'Ramsey\\Uuid\\Builder\\UuidBuilderInterface' => __DIR__ . '/..' . '/ramsey/uuid/src/Builder/UuidBuilderInterface.php',
|
942 |
+
'Ramsey\\Uuid\\Codec\\CodecInterface' => __DIR__ . '/..' . '/ramsey/uuid/src/Codec/CodecInterface.php',
|
943 |
+
'Ramsey\\Uuid\\Codec\\GuidStringCodec' => __DIR__ . '/..' . '/ramsey/uuid/src/Codec/GuidStringCodec.php',
|
944 |
+
'Ramsey\\Uuid\\Codec\\OrderedTimeCodec' => __DIR__ . '/..' . '/ramsey/uuid/src/Codec/OrderedTimeCodec.php',
|
945 |
+
'Ramsey\\Uuid\\Codec\\StringCodec' => __DIR__ . '/..' . '/ramsey/uuid/src/Codec/StringCodec.php',
|
946 |
+
'Ramsey\\Uuid\\Codec\\TimestampFirstCombCodec' => __DIR__ . '/..' . '/ramsey/uuid/src/Codec/TimestampFirstCombCodec.php',
|
947 |
+
'Ramsey\\Uuid\\Codec\\TimestampLastCombCodec' => __DIR__ . '/..' . '/ramsey/uuid/src/Codec/TimestampLastCombCodec.php',
|
948 |
+
'Ramsey\\Uuid\\Converter\\NumberConverterInterface' => __DIR__ . '/..' . '/ramsey/uuid/src/Converter/NumberConverterInterface.php',
|
949 |
+
'Ramsey\\Uuid\\Converter\\Number\\BigNumberConverter' => __DIR__ . '/..' . '/ramsey/uuid/src/Converter/Number/BigNumberConverter.php',
|
950 |
+
'Ramsey\\Uuid\\Converter\\Number\\DegradedNumberConverter' => __DIR__ . '/..' . '/ramsey/uuid/src/Converter/Number/DegradedNumberConverter.php',
|
951 |
+
'Ramsey\\Uuid\\Converter\\TimeConverterInterface' => __DIR__ . '/..' . '/ramsey/uuid/src/Converter/TimeConverterInterface.php',
|
952 |
+
'Ramsey\\Uuid\\Converter\\Time\\BigNumberTimeConverter' => __DIR__ . '/..' . '/ramsey/uuid/src/Converter/Time/BigNumberTimeConverter.php',
|
953 |
+
'Ramsey\\Uuid\\Converter\\Time\\DegradedTimeConverter' => __DIR__ . '/..' . '/ramsey/uuid/src/Converter/Time/DegradedTimeConverter.php',
|
954 |
+
'Ramsey\\Uuid\\Converter\\Time\\PhpTimeConverter' => __DIR__ . '/..' . '/ramsey/uuid/src/Converter/Time/PhpTimeConverter.php',
|
955 |
+
'Ramsey\\Uuid\\DegradedUuid' => __DIR__ . '/..' . '/ramsey/uuid/src/DegradedUuid.php',
|
956 |
+
'Ramsey\\Uuid\\Exception\\InvalidUuidStringException' => __DIR__ . '/..' . '/ramsey/uuid/src/Exception/InvalidUuidStringException.php',
|
957 |
+
'Ramsey\\Uuid\\Exception\\UnsatisfiedDependencyException' => __DIR__ . '/..' . '/ramsey/uuid/src/Exception/UnsatisfiedDependencyException.php',
|
958 |
+
'Ramsey\\Uuid\\Exception\\UnsupportedOperationException' => __DIR__ . '/..' . '/ramsey/uuid/src/Exception/UnsupportedOperationException.php',
|
959 |
+
'Ramsey\\Uuid\\FeatureSet' => __DIR__ . '/..' . '/ramsey/uuid/src/FeatureSet.php',
|
960 |
+
'Ramsey\\Uuid\\Generator\\CombGenerator' => __DIR__ . '/..' . '/ramsey/uuid/src/Generator/CombGenerator.php',
|
961 |
+
'Ramsey\\Uuid\\Generator\\DefaultTimeGenerator' => __DIR__ . '/..' . '/ramsey/uuid/src/Generator/DefaultTimeGenerator.php',
|
962 |
+
'Ramsey\\Uuid\\Generator\\MtRandGenerator' => __DIR__ . '/..' . '/ramsey/uuid/src/Generator/MtRandGenerator.php',
|
963 |
+
'Ramsey\\Uuid\\Generator\\OpenSslGenerator' => __DIR__ . '/..' . '/ramsey/uuid/src/Generator/OpenSslGenerator.php',
|
964 |
+
'Ramsey\\Uuid\\Generator\\PeclUuidRandomGenerator' => __DIR__ . '/..' . '/ramsey/uuid/src/Generator/PeclUuidRandomGenerator.php',
|
965 |
+
'Ramsey\\Uuid\\Generator\\PeclUuidTimeGenerator' => __DIR__ . '/..' . '/ramsey/uuid/src/Generator/PeclUuidTimeGenerator.php',
|
966 |
+
'Ramsey\\Uuid\\Generator\\RandomBytesGenerator' => __DIR__ . '/..' . '/ramsey/uuid/src/Generator/RandomBytesGenerator.php',
|
967 |
+
'Ramsey\\Uuid\\Generator\\RandomGeneratorFactory' => __DIR__ . '/..' . '/ramsey/uuid/src/Generator/RandomGeneratorFactory.php',
|
968 |
+
'Ramsey\\Uuid\\Generator\\RandomGeneratorInterface' => __DIR__ . '/..' . '/ramsey/uuid/src/Generator/RandomGeneratorInterface.php',
|
969 |
+
'Ramsey\\Uuid\\Generator\\RandomLibAdapter' => __DIR__ . '/..' . '/ramsey/uuid/src/Generator/RandomLibAdapter.php',
|
970 |
+
'Ramsey\\Uuid\\Generator\\SodiumRandomGenerator' => __DIR__ . '/..' . '/ramsey/uuid/src/Generator/SodiumRandomGenerator.php',
|
971 |
+
'Ramsey\\Uuid\\Generator\\TimeGeneratorFactory' => __DIR__ . '/..' . '/ramsey/uuid/src/Generator/TimeGeneratorFactory.php',
|
972 |
+
'Ramsey\\Uuid\\Generator\\TimeGeneratorInterface' => __DIR__ . '/..' . '/ramsey/uuid/src/Generator/TimeGeneratorInterface.php',
|
973 |
+
'Ramsey\\Uuid\\Provider\\NodeProviderInterface' => __DIR__ . '/..' . '/ramsey/uuid/src/Provider/NodeProviderInterface.php',
|
974 |
+
'Ramsey\\Uuid\\Provider\\Node\\FallbackNodeProvider' => __DIR__ . '/..' . '/ramsey/uuid/src/Provider/Node/FallbackNodeProvider.php',
|
975 |
+
'Ramsey\\Uuid\\Provider\\Node\\RandomNodeProvider' => __DIR__ . '/..' . '/ramsey/uuid/src/Provider/Node/RandomNodeProvider.php',
|
976 |
+
'Ramsey\\Uuid\\Provider\\Node\\SystemNodeProvider' => __DIR__ . '/..' . '/ramsey/uuid/src/Provider/Node/SystemNodeProvider.php',
|
977 |
+
'Ramsey\\Uuid\\Provider\\TimeProviderInterface' => __DIR__ . '/..' . '/ramsey/uuid/src/Provider/TimeProviderInterface.php',
|
978 |
+
'Ramsey\\Uuid\\Provider\\Time\\FixedTimeProvider' => __DIR__ . '/..' . '/ramsey/uuid/src/Provider/Time/FixedTimeProvider.php',
|
979 |
+
'Ramsey\\Uuid\\Provider\\Time\\SystemTimeProvider' => __DIR__ . '/..' . '/ramsey/uuid/src/Provider/Time/SystemTimeProvider.php',
|
980 |
+
'Ramsey\\Uuid\\Uuid' => __DIR__ . '/..' . '/ramsey/uuid/src/Uuid.php',
|
981 |
+
'Ramsey\\Uuid\\UuidFactory' => __DIR__ . '/..' . '/ramsey/uuid/src/UuidFactory.php',
|
982 |
+
'Ramsey\\Uuid\\UuidFactoryInterface' => __DIR__ . '/..' . '/ramsey/uuid/src/UuidFactoryInterface.php',
|
983 |
+
'Ramsey\\Uuid\\UuidInterface' => __DIR__ . '/..' . '/ramsey/uuid/src/UuidInterface.php',
|
984 |
'ReCaptcha\\ReCaptcha' => __DIR__ . '/..' . '/google/recaptcha/src/ReCaptcha/ReCaptcha.php',
|
985 |
'ReCaptcha\\RequestMethod' => __DIR__ . '/..' . '/google/recaptcha/src/ReCaptcha/RequestMethod.php',
|
986 |
'ReCaptcha\\RequestMethod\\Curl' => __DIR__ . '/..' . '/google/recaptcha/src/ReCaptcha/RequestMethod/Curl.php',
|
src/lib/vendor/fernleafsystems/wordpress-services/src/Core/Plugins.php
CHANGED
@@ -163,16 +163,15 @@ class Plugins {
|
|
163 |
* @return array
|
164 |
*/
|
165 |
public function update( $sFile ) {
|
|
|
|
|
166 |
|
167 |
-
$oSkin =
|
168 |
-
|
169 |
-
: new Upgrades\UpgraderSkinLegacy();
|
170 |
-
$oUpgrader = new \Plugin_Upgrader( $oSkin );
|
171 |
-
$mResult = $oUpgrader->upgrade( $sFile );
|
172 |
|
173 |
return [
|
174 |
'successful' => $mResult === true,
|
175 |
-
'feedback' => $oSkin->
|
176 |
'errors' => is_wp_error( $mResult ) ? $mResult->get_error_messages() : [ 'no errors' ]
|
177 |
];
|
178 |
}
|
163 |
* @return array
|
164 |
*/
|
165 |
public function update( $sFile ) {
|
166 |
+
require_once( ABSPATH.'wp-admin/includes/upgrade.php' );
|
167 |
+
require_once( ABSPATH.'wp-admin/includes/class-wp-upgrader.php' );
|
168 |
|
169 |
+
$oSkin = new \Automatic_Upgrader_Skin();
|
170 |
+
$mResult = ( new \Plugin_Upgrader( $oSkin ) )->upgrade( $sFile );
|
|
|
|
|
|
|
171 |
|
172 |
return [
|
173 |
'successful' => $mResult === true,
|
174 |
+
'feedback' => $oSkin->get_upgrade_messages(),
|
175 |
'errors' => is_wp_error( $mResult ) ? $mResult->get_error_messages() : [ 'no errors' ]
|
176 |
];
|
177 |
}
|
src/lib/vendor/fernleafsystems/wordpress-services/src/Core/Themes.php
CHANGED
@@ -138,16 +138,15 @@ class Themes {
|
|
138 |
* @return array
|
139 |
*/
|
140 |
public function update( $sFile ) {
|
|
|
|
|
141 |
|
142 |
-
$oSkin =
|
143 |
-
|
144 |
-
: new Upgrades\UpgraderSkinLegacy();
|
145 |
-
$oUpgrader = new \Theme_Upgrader( $oSkin );
|
146 |
-
$mResult = $oUpgrader->upgrade( $sFile );
|
147 |
|
148 |
return [
|
149 |
'successful' => $mResult === true,
|
150 |
-
'feedback' => $oSkin->
|
151 |
'errors' => is_wp_error( $mResult ) ? $mResult->get_error_messages() : [ 'no errors' ]
|
152 |
];
|
153 |
}
|
138 |
* @return array
|
139 |
*/
|
140 |
public function update( $sFile ) {
|
141 |
+
require_once( ABSPATH.'wp-admin/includes/upgrade.php' );
|
142 |
+
require_once( ABSPATH.'wp-admin/includes/class-wp-upgrader.php' );
|
143 |
|
144 |
+
$oSkin = new \Automatic_Upgrader_Skin();
|
145 |
+
$mResult = ( new \Theme_Upgrader( $oSkin ) )->upgrade( $sFile );
|
|
|
|
|
|
|
146 |
|
147 |
return [
|
148 |
'successful' => $mResult === true,
|
149 |
+
'feedback' => $oSkin->get_upgrade_messages(),
|
150 |
'errors' => is_wp_error( $mResult ) ? $mResult->get_error_messages() : [ 'no errors' ]
|
151 |
];
|
152 |
}
|
src/lib/vendor/ramsey/uuid/src/BinaryUtils.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace Ramsey\Uuid;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Provides binary math utilities
|
7 |
+
*/
|
8 |
+
class BinaryUtils
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Applies the RFC 4122 variant field to the `clock_seq_hi_and_reserved` field
|
12 |
+
*
|
13 |
+
* @param $clockSeqHi
|
14 |
+
* @return int The high field of the clock sequence multiplexed with the variant
|
15 |
+
* @link http://tools.ietf.org/html/rfc4122#section-4.1.1
|
16 |
+
*/
|
17 |
+
public static function applyVariant($clockSeqHi)
|
18 |
+
{
|
19 |
+
// Set the variant to RFC 4122
|
20 |
+
$clockSeqHi = $clockSeqHi & 0x3f;
|
21 |
+
$clockSeqHi |= 0x80;
|
22 |
+
|
23 |
+
return $clockSeqHi;
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Applies the RFC 4122 version number to the `time_hi_and_version` field
|
28 |
+
*
|
29 |
+
* @param string $timeHi
|
30 |
+
* @param integer $version
|
31 |
+
* @return int The high field of the timestamp multiplexed with the version number
|
32 |
+
* @link http://tools.ietf.org/html/rfc4122#section-4.1.3
|
33 |
+
*/
|
34 |
+
public static function applyVersion($timeHi, $version)
|
35 |
+
{
|
36 |
+
$timeHi = hexdec($timeHi) & 0x0fff;
|
37 |
+
$timeHi |= $version << 12;
|
38 |
+
|
39 |
+
return $timeHi;
|
40 |
+
}
|
41 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Builder/DefaultUuidBuilder.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Builder;
|
16 |
+
|
17 |
+
use Ramsey\Uuid\Codec\CodecInterface;
|
18 |
+
use Ramsey\Uuid\Converter\NumberConverterInterface;
|
19 |
+
use Ramsey\Uuid\Uuid;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* DefaultUuidBuilder is the default UUID builder for ramsey/uuid; it builds
|
23 |
+
* instances of Uuid objects
|
24 |
+
*/
|
25 |
+
class DefaultUuidBuilder implements UuidBuilderInterface
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* @var NumberConverterInterface
|
29 |
+
*/
|
30 |
+
private $converter;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Constructs the DefaultUuidBuilder
|
34 |
+
*
|
35 |
+
* @param NumberConverterInterface $converter The number converter to use when constructing the Uuid
|
36 |
+
*/
|
37 |
+
public function __construct(NumberConverterInterface $converter)
|
38 |
+
{
|
39 |
+
$this->converter = $converter;
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Builds a Uuid
|
44 |
+
*
|
45 |
+
* @param CodecInterface $codec The codec to use for building this Uuid
|
46 |
+
* @param array $fields An array of fields from which to construct the Uuid;
|
47 |
+
* see {@see \Ramsey\Uuid\UuidInterface::getFieldsHex()} for array structure.
|
48 |
+
* @return Uuid
|
49 |
+
*/
|
50 |
+
public function build(CodecInterface $codec, array $fields)
|
51 |
+
{
|
52 |
+
return new Uuid($fields, $this->converter, $codec);
|
53 |
+
}
|
54 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Builder/DegradedUuidBuilder.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Builder;
|
16 |
+
|
17 |
+
use Ramsey\Uuid\Codec\CodecInterface;
|
18 |
+
use Ramsey\Uuid\Converter\NumberConverterInterface;
|
19 |
+
use Ramsey\Uuid\DegradedUuid;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* DegradedUuidBuilder builds instances of DegradedUuid
|
23 |
+
*/
|
24 |
+
class DegradedUuidBuilder implements UuidBuilderInterface
|
25 |
+
{
|
26 |
+
/**
|
27 |
+
* @var NumberConverterInterface
|
28 |
+
*/
|
29 |
+
private $converter;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Constructs the DegradedUuidBuilder
|
33 |
+
*
|
34 |
+
* @param NumberConverterInterface $converter The number converter to use when constructing the DegradedUuid
|
35 |
+
*/
|
36 |
+
public function __construct(NumberConverterInterface $converter)
|
37 |
+
{
|
38 |
+
$this->converter = $converter;
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Builds a DegradedUuid
|
43 |
+
*
|
44 |
+
* @param CodecInterface $codec The codec to use for building this DegradedUuid
|
45 |
+
* @param array $fields An array of fields from which to construct the DegradedUuid;
|
46 |
+
* see {@see \Ramsey\Uuid\UuidInterface::getFieldsHex()} for array structure.
|
47 |
+
* @return DegradedUuid
|
48 |
+
*/
|
49 |
+
public function build(CodecInterface $codec, array $fields)
|
50 |
+
{
|
51 |
+
return new DegradedUuid($fields, $this->converter, $codec);
|
52 |
+
}
|
53 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Builder/UuidBuilderInterface.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Builder;
|
16 |
+
|
17 |
+
use Ramsey\Uuid\Codec\CodecInterface;
|
18 |
+
use Ramsey\Uuid\UuidInterface;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* UuidBuilderInterface builds instances UuidInterface
|
22 |
+
*/
|
23 |
+
interface UuidBuilderInterface
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Builds an instance of a UuidInterface
|
27 |
+
*
|
28 |
+
* @param CodecInterface $codec The codec to use for building this UuidInterface instance
|
29 |
+
* @param array $fields An array of fields from which to construct a UuidInterface instance;
|
30 |
+
* see {@see \Ramsey\Uuid\UuidInterface::getFieldsHex()} for array structure.
|
31 |
+
* @return UuidInterface
|
32 |
+
*/
|
33 |
+
public function build(CodecInterface $codec, array $fields);
|
34 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Codec/CodecInterface.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Codec;
|
16 |
+
|
17 |
+
use InvalidArgumentException;
|
18 |
+
use Ramsey\Uuid\Exception\InvalidUuidStringException;
|
19 |
+
use Ramsey\Uuid\UuidInterface;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* CodecInterface represents a UUID coder-decoder
|
23 |
+
*/
|
24 |
+
interface CodecInterface
|
25 |
+
{
|
26 |
+
/**
|
27 |
+
* Encodes a UuidInterface as a string representation of a UUID
|
28 |
+
*
|
29 |
+
* @param UuidInterface $uuid
|
30 |
+
* @return string Hexadecimal string representation of a UUID
|
31 |
+
*/
|
32 |
+
public function encode(UuidInterface $uuid);
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Encodes a UuidInterface as a binary representation of a UUID
|
36 |
+
*
|
37 |
+
* @param UuidInterface $uuid
|
38 |
+
* @return string Binary string representation of a UUID
|
39 |
+
*/
|
40 |
+
public function encodeBinary(UuidInterface $uuid);
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Decodes a string representation of a UUID into a UuidInterface object instance
|
44 |
+
*
|
45 |
+
* @param string $encodedUuid
|
46 |
+
* @return UuidInterface
|
47 |
+
* @throws InvalidUuidStringException
|
48 |
+
*/
|
49 |
+
public function decode($encodedUuid);
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Decodes a binary representation of a UUID into a UuidInterface object instance
|
53 |
+
*
|
54 |
+
* @param string $bytes
|
55 |
+
* @return UuidInterface
|
56 |
+
* @throws InvalidUuidStringException
|
57 |
+
* @throws InvalidArgumentException if string has not 16 characters
|
58 |
+
*/
|
59 |
+
public function decodeBytes($bytes);
|
60 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Codec/GuidStringCodec.php
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Codec;
|
16 |
+
|
17 |
+
use Ramsey\Uuid\Exception\InvalidUuidStringException;
|
18 |
+
use Ramsey\Uuid\UuidInterface;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* GuidStringCodec encodes and decodes globally unique identifiers (GUID)
|
22 |
+
*
|
23 |
+
* @link https://en.wikipedia.org/wiki/Globally_unique_identifier
|
24 |
+
*/
|
25 |
+
class GuidStringCodec extends StringCodec
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Encodes a UuidInterface as a string representation of a GUID
|
29 |
+
*
|
30 |
+
* @param UuidInterface $uuid
|
31 |
+
* @return string Hexadecimal string representation of a GUID
|
32 |
+
*/
|
33 |
+
public function encode(UuidInterface $uuid)
|
34 |
+
{
|
35 |
+
$components = array_values($uuid->getFieldsHex());
|
36 |
+
|
37 |
+
// Swap byte-order on the first three fields
|
38 |
+
$this->swapFields($components);
|
39 |
+
|
40 |
+
return vsprintf(
|
41 |
+
'%08s-%04s-%04s-%02s%02s-%012s',
|
42 |
+
$components
|
43 |
+
);
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Encodes a UuidInterface as a binary representation of a GUID
|
48 |
+
*
|
49 |
+
* @param UuidInterface $uuid
|
50 |
+
* @return string Binary string representation of a GUID
|
51 |
+
*/
|
52 |
+
public function encodeBinary(UuidInterface $uuid)
|
53 |
+
{
|
54 |
+
$components = array_values($uuid->getFieldsHex());
|
55 |
+
|
56 |
+
return hex2bin(implode('', $components));
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Decodes a string representation of a GUID into a UuidInterface object instance
|
61 |
+
*
|
62 |
+
* @param string $encodedUuid
|
63 |
+
* @return UuidInterface
|
64 |
+
* @throws InvalidUuidStringException
|
65 |
+
*/
|
66 |
+
public function decode($encodedUuid)
|
67 |
+
{
|
68 |
+
$components = $this->extractComponents($encodedUuid);
|
69 |
+
|
70 |
+
$this->swapFields($components);
|
71 |
+
|
72 |
+
return $this->getBuilder()->build($this, $this->getFields($components));
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Decodes a binary representation of a GUID into a UuidInterface object instance
|
77 |
+
*
|
78 |
+
* @param string $bytes
|
79 |
+
* @return UuidInterface
|
80 |
+
* @throws InvalidUuidStringException
|
81 |
+
*/
|
82 |
+
public function decodeBytes($bytes)
|
83 |
+
{
|
84 |
+
// Specifically call parent::decode to preserve correct byte order
|
85 |
+
return parent::decode(bin2hex($bytes));
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Swaps fields to support GUID byte order
|
90 |
+
*
|
91 |
+
* @param array $components An array of UUID components (the UUID exploded on its dashes)
|
92 |
+
* @return void
|
93 |
+
*/
|
94 |
+
protected function swapFields(array &$components)
|
95 |
+
{
|
96 |
+
$hex = unpack('H*', pack('L', hexdec($components[0])));
|
97 |
+
$components[0] = $hex[1];
|
98 |
+
$hex = unpack('H*', pack('S', hexdec($components[1])));
|
99 |
+
$components[1] = $hex[1];
|
100 |
+
$hex = unpack('H*', pack('S', hexdec($components[2])));
|
101 |
+
$components[2] = $hex[1];
|
102 |
+
}
|
103 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Codec/OrderedTimeCodec.php
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
namespace Ramsey\Uuid\Codec;
|
15 |
+
|
16 |
+
use InvalidArgumentException;
|
17 |
+
use Ramsey\Uuid\UuidInterface;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* OrderedTimeCodec optimizes the bytes to increment UUIDs when time goes by, to improve database INSERTs.
|
21 |
+
* The string value will be unchanged from StringCodec. Only works for UUID type 1.
|
22 |
+
*/
|
23 |
+
class OrderedTimeCodec extends StringCodec
|
24 |
+
{
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Encodes a UuidInterface as an optimized binary representation of a UUID
|
28 |
+
*
|
29 |
+
* @param UuidInterface $uuid
|
30 |
+
* @return string Binary string representation of a UUID
|
31 |
+
*/
|
32 |
+
public function encodeBinary(UuidInterface $uuid)
|
33 |
+
{
|
34 |
+
$fields = $uuid->getFieldsHex();
|
35 |
+
|
36 |
+
$optimized = [
|
37 |
+
$fields['time_hi_and_version'],
|
38 |
+
$fields['time_mid'],
|
39 |
+
$fields['time_low'],
|
40 |
+
$fields['clock_seq_hi_and_reserved'],
|
41 |
+
$fields['clock_seq_low'],
|
42 |
+
$fields['node'],
|
43 |
+
];
|
44 |
+
|
45 |
+
return hex2bin(implode('', $optimized));
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Decodes an optimized binary representation of a UUID into a UuidInterface object instance
|
50 |
+
*
|
51 |
+
* @param string $bytes
|
52 |
+
* @return UuidInterface
|
53 |
+
* @throws InvalidArgumentException if string has not 16 characters
|
54 |
+
*/
|
55 |
+
public function decodeBytes($bytes)
|
56 |
+
{
|
57 |
+
if (strlen($bytes) !== 16) {
|
58 |
+
throw new InvalidArgumentException('$bytes string should contain 16 characters.');
|
59 |
+
}
|
60 |
+
|
61 |
+
$hex = unpack('H*', $bytes)[1];
|
62 |
+
|
63 |
+
// Rearrange the fields to their original order
|
64 |
+
$hex = substr($hex, 8, 4) . substr($hex, 12, 4) . substr($hex, 4, 4) . substr($hex, 0, 4) . substr($hex, 16);
|
65 |
+
|
66 |
+
return $this->decode($hex);
|
67 |
+
}
|
68 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Codec/StringCodec.php
ADDED
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Codec;
|
16 |
+
|
17 |
+
use InvalidArgumentException;
|
18 |
+
use Ramsey\Uuid\Builder\UuidBuilderInterface;
|
19 |
+
use Ramsey\Uuid\Exception\InvalidUuidStringException;
|
20 |
+
use Ramsey\Uuid\Uuid;
|
21 |
+
use Ramsey\Uuid\UuidInterface;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* StringCodec encodes and decodes RFC 4122 UUIDs
|
25 |
+
*
|
26 |
+
* @link http://tools.ietf.org/html/rfc4122
|
27 |
+
*/
|
28 |
+
class StringCodec implements CodecInterface
|
29 |
+
{
|
30 |
+
/**
|
31 |
+
* @var UuidBuilderInterface
|
32 |
+
*/
|
33 |
+
private $builder;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Constructs a StringCodec for use encoding and decoding UUIDs
|
37 |
+
*
|
38 |
+
* @param UuidBuilderInterface $builder The UUID builder to use when encoding UUIDs
|
39 |
+
*/
|
40 |
+
public function __construct(UuidBuilderInterface $builder)
|
41 |
+
{
|
42 |
+
$this->builder = $builder;
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Encodes a UuidInterface as a string representation of a UUID
|
47 |
+
*
|
48 |
+
* @param UuidInterface $uuid
|
49 |
+
* @return string Hexadecimal string representation of a UUID
|
50 |
+
*/
|
51 |
+
public function encode(UuidInterface $uuid)
|
52 |
+
{
|
53 |
+
$fields = array_values($uuid->getFieldsHex());
|
54 |
+
|
55 |
+
return vsprintf(
|
56 |
+
'%08s-%04s-%04s-%02s%02s-%012s',
|
57 |
+
$fields
|
58 |
+
);
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Encodes a UuidInterface as a binary representation of a UUID
|
63 |
+
*
|
64 |
+
* @param UuidInterface $uuid
|
65 |
+
* @return string Binary string representation of a UUID
|
66 |
+
*/
|
67 |
+
public function encodeBinary(UuidInterface $uuid)
|
68 |
+
{
|
69 |
+
return hex2bin($uuid->getHex());
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Decodes a string representation of a UUID into a UuidInterface object instance
|
74 |
+
*
|
75 |
+
* @param string $encodedUuid
|
76 |
+
* @return UuidInterface
|
77 |
+
* @throws InvalidUuidStringException
|
78 |
+
*/
|
79 |
+
public function decode($encodedUuid)
|
80 |
+
{
|
81 |
+
$components = $this->extractComponents($encodedUuid);
|
82 |
+
$fields = $this->getFields($components);
|
83 |
+
|
84 |
+
return $this->builder->build($this, $fields);
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Decodes a binary representation of a UUID into a UuidInterface object instance
|
89 |
+
*
|
90 |
+
* @param string $bytes
|
91 |
+
* @return UuidInterface
|
92 |
+
* @throws InvalidArgumentException if string has not 16 characters
|
93 |
+
*/
|
94 |
+
public function decodeBytes($bytes)
|
95 |
+
{
|
96 |
+
if (strlen($bytes) !== 16) {
|
97 |
+
throw new InvalidArgumentException('$bytes string should contain 16 characters.');
|
98 |
+
}
|
99 |
+
|
100 |
+
$hexUuid = unpack('H*', $bytes);
|
101 |
+
|
102 |
+
return $this->decode($hexUuid[1]);
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Returns the UUID builder
|
107 |
+
*
|
108 |
+
* @return UuidBuilderInterface
|
109 |
+
*/
|
110 |
+
protected function getBuilder()
|
111 |
+
{
|
112 |
+
return $this->builder;
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Returns an array of UUID components (the UUID exploded on its dashes)
|
117 |
+
*
|
118 |
+
* @param string $encodedUuid
|
119 |
+
* @return array
|
120 |
+
* @throws InvalidUuidStringException
|
121 |
+
*/
|
122 |
+
protected function extractComponents($encodedUuid)
|
123 |
+
{
|
124 |
+
$nameParsed = str_replace([
|
125 |
+
'urn:',
|
126 |
+
'uuid:',
|
127 |
+
'{',
|
128 |
+
'}',
|
129 |
+
'-'
|
130 |
+
], '', $encodedUuid);
|
131 |
+
|
132 |
+
// We have stripped out the dashes and are breaking up the string using
|
133 |
+
// substr(). In this way, we can accept a full hex value that doesn't
|
134 |
+
// contain dashes.
|
135 |
+
$components = [
|
136 |
+
substr($nameParsed, 0, 8),
|
137 |
+
substr($nameParsed, 8, 4),
|
138 |
+
substr($nameParsed, 12, 4),
|
139 |
+
substr($nameParsed, 16, 4),
|
140 |
+
substr($nameParsed, 20)
|
141 |
+
];
|
142 |
+
|
143 |
+
$nameParsed = implode('-', $components);
|
144 |
+
|
145 |
+
if (!Uuid::isValid($nameParsed)) {
|
146 |
+
throw new InvalidUuidStringException('Invalid UUID string: ' . $encodedUuid);
|
147 |
+
}
|
148 |
+
|
149 |
+
return $components;
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Returns the fields that make up this UUID
|
154 |
+
*
|
155 |
+
* @see \Ramsey\Uuid\UuidInterface::getFieldsHex()
|
156 |
+
* @param array $components
|
157 |
+
* @return array
|
158 |
+
*/
|
159 |
+
protected function getFields(array $components)
|
160 |
+
{
|
161 |
+
return [
|
162 |
+
'time_low' => str_pad($components[0], 8, '0', STR_PAD_LEFT),
|
163 |
+
'time_mid' => str_pad($components[1], 4, '0', STR_PAD_LEFT),
|
164 |
+
'time_hi_and_version' => str_pad($components[2], 4, '0', STR_PAD_LEFT),
|
165 |
+
'clock_seq_hi_and_reserved' => str_pad(substr($components[3], 0, 2), 2, '0', STR_PAD_LEFT),
|
166 |
+
'clock_seq_low' => str_pad(substr($components[3], 2), 2, '0', STR_PAD_LEFT),
|
167 |
+
'node' => str_pad($components[4], 12, '0', STR_PAD_LEFT)
|
168 |
+
];
|
169 |
+
}
|
170 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Codec/TimestampFirstCombCodec.php
ADDED
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
namespace Ramsey\Uuid\Codec;
|
15 |
+
|
16 |
+
use Ramsey\Uuid\Exception\InvalidUuidStringException;
|
17 |
+
use Ramsey\Uuid\UuidInterface;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* TimestampFirstCombCodec encodes and decodes COMB UUIDs which have the timestamp as the first 48 bits.
|
21 |
+
* To be used with MySQL, PostgreSQL, Oracle.
|
22 |
+
*/
|
23 |
+
class TimestampFirstCombCodec extends StringCodec
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Encodes a UuidInterface as a string representation of a timestamp first COMB UUID
|
27 |
+
*
|
28 |
+
* @param UuidInterface $uuid
|
29 |
+
*
|
30 |
+
* @return string Hexadecimal string representation of a GUID
|
31 |
+
*/
|
32 |
+
public function encode(UuidInterface $uuid)
|
33 |
+
{
|
34 |
+
$sixPieceComponents = array_values($uuid->getFieldsHex());
|
35 |
+
|
36 |
+
$this->swapTimestampAndRandomBits($sixPieceComponents);
|
37 |
+
|
38 |
+
return vsprintf(
|
39 |
+
'%08s-%04s-%04s-%02s%02s-%012s',
|
40 |
+
$sixPieceComponents
|
41 |
+
);
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Encodes a UuidInterface as a binary representation of timestamp first COMB UUID
|
46 |
+
*
|
47 |
+
* @param UuidInterface $uuid
|
48 |
+
*
|
49 |
+
* @return string Binary string representation of timestamp first COMB UUID
|
50 |
+
*/
|
51 |
+
public function encodeBinary(UuidInterface $uuid)
|
52 |
+
{
|
53 |
+
$stringEncoding = $this->encode($uuid);
|
54 |
+
|
55 |
+
return hex2bin(str_replace('-', '', $stringEncoding));
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Decodes a string representation of timestamp first COMB UUID into a UuidInterface object instance
|
60 |
+
*
|
61 |
+
* @param string $encodedUuid
|
62 |
+
*
|
63 |
+
* @return UuidInterface
|
64 |
+
* @throws InvalidUuidStringException
|
65 |
+
*/
|
66 |
+
public function decode($encodedUuid)
|
67 |
+
{
|
68 |
+
$fivePieceComponents = $this->extractComponents($encodedUuid);
|
69 |
+
|
70 |
+
$this->swapTimestampAndRandomBits($fivePieceComponents);
|
71 |
+
|
72 |
+
return $this->getBuilder()->build($this, $this->getFields($fivePieceComponents));
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Decodes a binary representation of timestamp first COMB UUID into a UuidInterface object instance
|
77 |
+
*
|
78 |
+
* @param string $bytes
|
79 |
+
*
|
80 |
+
* @return UuidInterface
|
81 |
+
* @throws InvalidUuidStringException
|
82 |
+
*/
|
83 |
+
public function decodeBytes($bytes)
|
84 |
+
{
|
85 |
+
return $this->decode(bin2hex($bytes));
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Swaps the first 48 bits with the last 48 bits
|
90 |
+
*
|
91 |
+
* @param array $components An array of UUID components (the UUID exploded on its dashes)
|
92 |
+
*
|
93 |
+
* @return void
|
94 |
+
*/
|
95 |
+
protected function swapTimestampAndRandomBits(array &$components)
|
96 |
+
{
|
97 |
+
$last48Bits = $components[4];
|
98 |
+
if (count($components) == 6) {
|
99 |
+
$last48Bits = $components[5];
|
100 |
+
$components[5] = $components[0] . $components[1];
|
101 |
+
} else {
|
102 |
+
$components[4] = $components[0] . $components[1];
|
103 |
+
}
|
104 |
+
|
105 |
+
$components[0] = substr($last48Bits, 0, 8);
|
106 |
+
$components[1] = substr($last48Bits, 8, 4);
|
107 |
+
}
|
108 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Codec/TimestampLastCombCodec.php
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
namespace Ramsey\Uuid\Codec;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* TimestampLastCombCodec encodes and decodes COMB UUIDs which have the timestamp as the last 48 bits.
|
18 |
+
* To be used with MSSQL.
|
19 |
+
*/
|
20 |
+
class TimestampLastCombCodec extends StringCodec
|
21 |
+
{
|
22 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Converter/Number/BigNumberConverter.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Converter\Number;
|
16 |
+
|
17 |
+
use Moontoast\Math\BigNumber;
|
18 |
+
use Ramsey\Uuid\Converter\NumberConverterInterface;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* BigNumberConverter converts UUIDs from hexadecimal characters into
|
22 |
+
* moontoast/math `BigNumber` representations of integers and vice versa
|
23 |
+
*/
|
24 |
+
class BigNumberConverter implements NumberConverterInterface
|
25 |
+
{
|
26 |
+
/**
|
27 |
+
* Converts a hexadecimal number into a `Moontoast\Math\BigNumber` representation
|
28 |
+
*
|
29 |
+
* @param string $hex The hexadecimal string representation to convert
|
30 |
+
* @return BigNumber
|
31 |
+
*/
|
32 |
+
public function fromHex($hex)
|
33 |
+
{
|
34 |
+
$number = BigNumber::convertToBase10($hex, 16);
|
35 |
+
|
36 |
+
return new BigNumber($number);
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Converts an integer or `Moontoast\Math\BigNumber` integer representation
|
41 |
+
* into a hexadecimal string representation
|
42 |
+
*
|
43 |
+
* @param int|string|BigNumber $integer An integer or `Moontoast\Math\BigNumber`
|
44 |
+
* @return string Hexadecimal string
|
45 |
+
*/
|
46 |
+
public function toHex($integer)
|
47 |
+
{
|
48 |
+
if (!$integer instanceof BigNumber) {
|
49 |
+
$integer = new BigNumber($integer);
|
50 |
+
}
|
51 |
+
|
52 |
+
return BigNumber::convertFromBase10($integer, 16);
|
53 |
+
}
|
54 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Converter/Number/DegradedNumberConverter.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Converter\Number;
|
16 |
+
|
17 |
+
use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
|
18 |
+
use Ramsey\Uuid\Converter\NumberConverterInterface;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* DegradedNumberConverter throws `UnsatisfiedDependencyException` exceptions
|
22 |
+
* if attempting to use number conversion functionality in an environment that
|
23 |
+
* does not support large integers (i.e. when moontoast/math is not available)
|
24 |
+
*/
|
25 |
+
class DegradedNumberConverter implements NumberConverterInterface
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Throws an `UnsatisfiedDependencyException`
|
29 |
+
*
|
30 |
+
* @param string $hex The hexadecimal string representation to convert
|
31 |
+
* @return void
|
32 |
+
* @throws UnsatisfiedDependencyException
|
33 |
+
*/
|
34 |
+
public function fromHex($hex)
|
35 |
+
{
|
36 |
+
throw new UnsatisfiedDependencyException(
|
37 |
+
'Cannot call ' . __METHOD__ . ' without support for large '
|
38 |
+
. 'integers, since integer is an unsigned '
|
39 |
+
. '128-bit integer; Moontoast\Math\BigNumber is required.'
|
40 |
+
);
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Throws an `UnsatisfiedDependencyException`
|
45 |
+
*
|
46 |
+
* @param mixed $integer An integer representation to convert
|
47 |
+
* @return void
|
48 |
+
* @throws UnsatisfiedDependencyException
|
49 |
+
*/
|
50 |
+
public function toHex($integer)
|
51 |
+
{
|
52 |
+
throw new UnsatisfiedDependencyException(
|
53 |
+
'Cannot call ' . __METHOD__ . ' without support for large '
|
54 |
+
. 'integers, since integer is an unsigned '
|
55 |
+
. '128-bit integer; Moontoast\Math\BigNumber is required. '
|
56 |
+
);
|
57 |
+
}
|
58 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Converter/NumberConverterInterface.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Converter;
|
16 |
+
|
17 |
+
use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* NumberConverterInterface converts UUIDs from hexadecimal characters into
|
21 |
+
* representations of integers and vice versa
|
22 |
+
*/
|
23 |
+
interface NumberConverterInterface
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Converts a hexadecimal number into an integer representation of the number
|
27 |
+
*
|
28 |
+
* The integer representation returned may be an object or a string
|
29 |
+
* representation of the integer, depending on the implementation.
|
30 |
+
*
|
31 |
+
* @param string $hex The hexadecimal string representation to convert
|
32 |
+
* @return mixed
|
33 |
+
* @throws UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present
|
34 |
+
*/
|
35 |
+
public function fromHex($hex);
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Converts an integer representation into a hexadecimal string representation
|
39 |
+
* of the number
|
40 |
+
*
|
41 |
+
* @param mixed $integer An integer representation to convert; this may be
|
42 |
+
* a true integer, a string integer, or a object representation that
|
43 |
+
* this converter can understand
|
44 |
+
* @return string Hexadecimal string
|
45 |
+
* @throws UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present
|
46 |
+
*/
|
47 |
+
public function toHex($integer);
|
48 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Converter/Time/BigNumberTimeConverter.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Converter\Time;
|
16 |
+
|
17 |
+
use Moontoast\Math\BigNumber;
|
18 |
+
use Ramsey\Uuid\Converter\TimeConverterInterface;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* BigNumberTimeConverter uses the moontoast/math library's `BigNumber` to
|
22 |
+
* provide facilities for converting parts of time into representations that may
|
23 |
+
* be used in UUIDs
|
24 |
+
*/
|
25 |
+
class BigNumberTimeConverter implements TimeConverterInterface
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Uses the provided seconds and micro-seconds to calculate the time_low,
|
29 |
+
* time_mid, and time_high fields used by RFC 4122 version 1 UUIDs
|
30 |
+
*
|
31 |
+
* @param string $seconds
|
32 |
+
* @param string $microSeconds
|
33 |
+
* @return string[] An array containing `low`, `mid`, and `high` keys
|
34 |
+
* @link http://tools.ietf.org/html/rfc4122#section-4.2.2
|
35 |
+
*/
|
36 |
+
public function calculateTime($seconds, $microSeconds)
|
37 |
+
{
|
38 |
+
$uuidTime = new BigNumber('0');
|
39 |
+
|
40 |
+
$sec = new BigNumber($seconds);
|
41 |
+
$sec->multiply('10000000');
|
42 |
+
|
43 |
+
$usec = new BigNumber($microSeconds);
|
44 |
+
$usec->multiply('10');
|
45 |
+
|
46 |
+
$uuidTime
|
47 |
+
->add($sec)
|
48 |
+
->add($usec)
|
49 |
+
->add('122192928000000000');
|
50 |
+
|
51 |
+
$uuidTimeHex = sprintf('%016s', $uuidTime->convertToBase(16));
|
52 |
+
|
53 |
+
return [
|
54 |
+
'low' => substr($uuidTimeHex, 8),
|
55 |
+
'mid' => substr($uuidTimeHex, 4, 4),
|
56 |
+
'hi' => substr($uuidTimeHex, 0, 4),
|
57 |
+
];
|
58 |
+
}
|
59 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Converter/Time/DegradedTimeConverter.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Converter\Time;
|
16 |
+
|
17 |
+
use Ramsey\Uuid\Converter\TimeConverterInterface;
|
18 |
+
use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* DegradedTimeConverter throws `UnsatisfiedDependencyException` exceptions
|
22 |
+
* if attempting to use time conversion functionality in an environment that
|
23 |
+
* does not support large integers (i.e. when moontoast/math is not available)
|
24 |
+
*/
|
25 |
+
class DegradedTimeConverter implements TimeConverterInterface
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Throws an `UnsatisfiedDependencyException`
|
29 |
+
*
|
30 |
+
* @param string $seconds
|
31 |
+
* @param string $microSeconds
|
32 |
+
* @return void
|
33 |
+
* @throws UnsatisfiedDependencyException if called on a 32-bit system and `Moontoast\Math\BigNumber` is not present
|
34 |
+
*/
|
35 |
+
public function calculateTime($seconds, $microSeconds)
|
36 |
+
{
|
37 |
+
throw new UnsatisfiedDependencyException(
|
38 |
+
'When calling ' . __METHOD__ . ' on a 32-bit system, '
|
39 |
+
. 'Moontoast\Math\BigNumber must be present.'
|
40 |
+
);
|
41 |
+
}
|
42 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Converter/Time/PhpTimeConverter.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Converter\Time;
|
16 |
+
|
17 |
+
use Ramsey\Uuid\Converter\TimeConverterInterface;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* PhpTimeConverter uses built-in PHP functions and standard math operations
|
21 |
+
* available to the PHP programming language to provide facilities for
|
22 |
+
* converting parts of time into representations that may be used in UUIDs
|
23 |
+
*/
|
24 |
+
class PhpTimeConverter implements TimeConverterInterface
|
25 |
+
{
|
26 |
+
/**
|
27 |
+
* Uses the provided seconds and micro-seconds to calculate the time_low,
|
28 |
+
* time_mid, and time_high fields used by RFC 4122 version 1 UUIDs
|
29 |
+
*
|
30 |
+
* @param string $seconds
|
31 |
+
* @param string $microSeconds
|
32 |
+
* @return string[] An array containing `low`, `mid`, and `high` keys
|
33 |
+
* @link http://tools.ietf.org/html/rfc4122#section-4.2.2
|
34 |
+
*/
|
35 |
+
public function calculateTime($seconds, $microSeconds)
|
36 |
+
{
|
37 |
+
// 0x01b21dd213814000 is the number of 100-ns intervals between the
|
38 |
+
// UUID epoch 1582-10-15 00:00:00 and the Unix epoch 1970-01-01 00:00:00.
|
39 |
+
$uuidTime = ($seconds * 10000000) + ($microSeconds * 10) + 0x01b21dd213814000;
|
40 |
+
|
41 |
+
return [
|
42 |
+
'low' => sprintf('%08x', $uuidTime & 0xffffffff),
|
43 |
+
'mid' => sprintf('%04x', ($uuidTime >> 32) & 0xffff),
|
44 |
+
'hi' => sprintf('%04x', ($uuidTime >> 48) & 0x0fff),
|
45 |
+
];
|
46 |
+
}
|
47 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Converter/TimeConverterInterface.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Converter;
|
16 |
+
|
17 |
+
use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* TimeConverterInterface provides facilities for converting parts of time into
|
21 |
+
* representations that may be used in UUIDs
|
22 |
+
*/
|
23 |
+
interface TimeConverterInterface
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Uses the provided seconds and micro-seconds to calculate the time_low,
|
27 |
+
* time_mid, and time_high fields used by RFC 4122 version 1 UUIDs
|
28 |
+
*
|
29 |
+
* @param string $seconds
|
30 |
+
* @param string $microSeconds
|
31 |
+
* @return string[] An array guaranteed to contain `low`, `mid`, and `hi` keys
|
32 |
+
* @throws UnsatisfiedDependencyException if called on a 32-bit system and
|
33 |
+
* `Moontoast\Math\BigNumber` is not present
|
34 |
+
* @link http://tools.ietf.org/html/rfc4122#section-4.2.2
|
35 |
+
*/
|
36 |
+
public function calculateTime($seconds, $microSeconds);
|
37 |
+
}
|
src/lib/vendor/ramsey/uuid/src/DegradedUuid.php
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid;
|
16 |
+
|
17 |
+
use DateTime;
|
18 |
+
use Moontoast\Math\BigNumber;
|
19 |
+
use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
|
20 |
+
use Ramsey\Uuid\Exception\UnsupportedOperationException;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* DegradedUuid represents an RFC 4122 UUID on 32-bit systems
|
24 |
+
*
|
25 |
+
* @see Uuid
|
26 |
+
*/
|
27 |
+
class DegradedUuid extends Uuid
|
28 |
+
{
|
29 |
+
/**
|
30 |
+
* @inheritdoc
|
31 |
+
*/
|
32 |
+
public function getDateTime()
|
33 |
+
{
|
34 |
+
if ($this->getVersion() != 1) {
|
35 |
+
throw new UnsupportedOperationException('Not a time-based UUID');
|
36 |
+
}
|
37 |
+
|
38 |
+
$time = $this->converter->fromHex($this->getTimestampHex());
|
39 |
+
|
40 |
+
$ts = new BigNumber($time, 20);
|
41 |
+
$ts->subtract('122192928000000000');
|
42 |
+
$ts->divide('10000000.0');
|
43 |
+
$ts->floor();
|
44 |
+
$unixTime = $ts->getValue();
|
45 |
+
|
46 |
+
return new DateTime("@{$unixTime}");
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* For degraded UUIDs, throws an `UnsatisfiedDependencyException` when
|
51 |
+
* called on a 32-bit system
|
52 |
+
*
|
53 |
+
* @throws UnsatisfiedDependencyException if called on a 32-bit system
|
54 |
+
*/
|
55 |
+
public function getFields()
|
56 |
+
{
|
57 |
+
throw new UnsatisfiedDependencyException(
|
58 |
+
'Cannot call ' . __METHOD__ . ' on a 32-bit system, since some '
|
59 |
+
. 'values overflow the system max integer value'
|
60 |
+
. '; consider calling getFieldsHex instead'
|
61 |
+
);
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* For degraded UUIDs, throws an `UnsatisfiedDependencyException` when
|
66 |
+
* called on a 32-bit system
|
67 |
+
*
|
68 |
+
* @throws UnsatisfiedDependencyException if called on a 32-bit system
|
69 |
+
*/
|
70 |
+
public function getNode()
|
71 |
+
{
|
72 |
+
throw new UnsatisfiedDependencyException(
|
73 |
+
'Cannot call ' . __METHOD__ . ' on a 32-bit system, since node '
|
74 |
+
. 'is an unsigned 48-bit integer and can overflow the system '
|
75 |
+
. 'max integer value'
|
76 |
+
. '; consider calling getNodeHex instead'
|
77 |
+
);
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* For degraded UUIDs, throws an `UnsatisfiedDependencyException` when
|
82 |
+
* called on a 32-bit system
|
83 |
+
*
|
84 |
+
* @throws UnsatisfiedDependencyException if called on a 32-bit system
|
85 |
+
*/
|
86 |
+
public function getTimeLow()
|
87 |
+
{
|
88 |
+
throw new UnsatisfiedDependencyException(
|
89 |
+
'Cannot call ' . __METHOD__ . ' on a 32-bit system, since time_low '
|
90 |
+
. 'is an unsigned 32-bit integer and can overflow the system '
|
91 |
+
. 'max integer value'
|
92 |
+
. '; consider calling getTimeLowHex instead'
|
93 |
+
);
|
94 |
+
}
|
95 |
+
|
96 |
+
/**
|
97 |
+
* For degraded UUIDs, throws an `UnsatisfiedDependencyException` when
|
98 |
+
* called on a 32-bit system
|
99 |
+
*
|
100 |
+
* @throws UnsatisfiedDependencyException if called on a 32-bit system
|
101 |
+
* @throws UnsupportedOperationException If this UUID is not a version 1 UUID
|
102 |
+
*/
|
103 |
+
public function getTimestamp()
|
104 |
+
{
|
105 |
+
if ($this->getVersion() != 1) {
|
106 |
+
throw new UnsupportedOperationException('Not a time-based UUID');
|
107 |
+
}
|
108 |
+
|
109 |
+
throw new UnsatisfiedDependencyException(
|
110 |
+
'Cannot call ' . __METHOD__ . ' on a 32-bit system, since timestamp '
|
111 |
+
. 'is an unsigned 60-bit integer and can overflow the system '
|
112 |
+
. 'max integer value'
|
113 |
+
. '; consider calling getTimestampHex instead'
|
114 |
+
);
|
115 |
+
}
|
116 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Exception/InvalidUuidStringException.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Exception;
|
16 |
+
|
17 |
+
use InvalidArgumentException;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Thrown to indicate that the parsed UUID string is invalid.
|
21 |
+
*/
|
22 |
+
class InvalidUuidStringException extends InvalidArgumentException
|
23 |
+
{
|
24 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Exception/UnsatisfiedDependencyException.php
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Exception;
|
16 |
+
|
17 |
+
use RuntimeException;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Thrown to indicate that the requested operation has dependencies that have not
|
21 |
+
* been satisfied.
|
22 |
+
*/
|
23 |
+
class UnsatisfiedDependencyException extends RuntimeException
|
24 |
+
{
|
25 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Exception/UnsupportedOperationException.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Exception;
|
16 |
+
|
17 |
+
use RuntimeException;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Thrown to indicate that the requested operation is not supported.
|
21 |
+
*/
|
22 |
+
class UnsupportedOperationException extends RuntimeException
|
23 |
+
{
|
24 |
+
}
|
src/lib/vendor/ramsey/uuid/src/FeatureSet.php
ADDED
@@ -0,0 +1,335 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid;
|
16 |
+
|
17 |
+
use Ramsey\Uuid\Converter\TimeConverterInterface;
|
18 |
+
use Ramsey\Uuid\Generator\PeclUuidTimeGenerator;
|
19 |
+
use Ramsey\Uuid\Provider\Node\FallbackNodeProvider;
|
20 |
+
use Ramsey\Uuid\Provider\Node\RandomNodeProvider;
|
21 |
+
use Ramsey\Uuid\Provider\Node\SystemNodeProvider;
|
22 |
+
use Ramsey\Uuid\Converter\NumberConverterInterface;
|
23 |
+
use Ramsey\Uuid\Converter\Number\BigNumberConverter;
|
24 |
+
use Ramsey\Uuid\Converter\Number\DegradedNumberConverter;
|
25 |
+
use Ramsey\Uuid\Converter\Time\BigNumberTimeConverter;
|
26 |
+
use Ramsey\Uuid\Converter\Time\DegradedTimeConverter;
|
27 |
+
use Ramsey\Uuid\Converter\Time\PhpTimeConverter;
|
28 |
+
use Ramsey\Uuid\Provider\Time\SystemTimeProvider;
|
29 |
+
use Ramsey\Uuid\Builder\UuidBuilderInterface;
|
30 |
+
use Ramsey\Uuid\Builder\DefaultUuidBuilder;
|
31 |
+
use Ramsey\Uuid\Codec\CodecInterface;
|
32 |
+
use Ramsey\Uuid\Codec\StringCodec;
|
33 |
+
use Ramsey\Uuid\Codec\GuidStringCodec;
|
34 |
+
use Ramsey\Uuid\Builder\DegradedUuidBuilder;
|
35 |
+
use Ramsey\Uuid\Generator\RandomGeneratorFactory;
|
36 |
+
use Ramsey\Uuid\Generator\RandomGeneratorInterface;
|
37 |
+
use Ramsey\Uuid\Generator\TimeGeneratorFactory;
|
38 |
+
use Ramsey\Uuid\Generator\TimeGeneratorInterface;
|
39 |
+
use Ramsey\Uuid\Provider\TimeProviderInterface;
|
40 |
+
use Ramsey\Uuid\Provider\NodeProviderInterface;
|
41 |
+
|
42 |
+
/**
|
43 |
+
* FeatureSet detects and exposes available features in the current environment
|
44 |
+
* (32- or 64-bit, available dependencies, etc.)
|
45 |
+
*/
|
46 |
+
class FeatureSet
|
47 |
+
{
|
48 |
+
/**
|
49 |
+
* @var bool
|
50 |
+
*/
|
51 |
+
private $disableBigNumber = false;
|
52 |
+
|
53 |
+
/**
|
54 |
+
* @var bool
|
55 |
+
*/
|
56 |
+
private $disable64Bit = false;
|
57 |
+
|
58 |
+
/**
|
59 |
+
* @var bool
|
60 |
+
*/
|
61 |
+
private $ignoreSystemNode = false;
|
62 |
+
|
63 |
+
/**
|
64 |
+
* @var bool
|
65 |
+
*/
|
66 |
+
private $enablePecl = false;
|
67 |
+
|
68 |
+
/**
|
69 |
+
* @var UuidBuilderInterface
|
70 |
+
*/
|
71 |
+
private $builder;
|
72 |
+
|
73 |
+
/**
|
74 |
+
* @var CodecInterface
|
75 |
+
*/
|
76 |
+
private $codec;
|
77 |
+
|
78 |
+
/**
|
79 |
+
* @var NodeProviderInterface
|
80 |
+
*/
|
81 |
+
private $nodeProvider;
|
82 |
+
|
83 |
+
/**
|
84 |
+
* @var NumberConverterInterface
|
85 |
+
*/
|
86 |
+
private $numberConverter;
|
87 |
+
|
88 |
+
/**
|
89 |
+
* @var RandomGeneratorInterface
|
90 |
+
*/
|
91 |
+
private $randomGenerator;
|
92 |
+
|
93 |
+
/**
|
94 |
+
* @var TimeGeneratorInterface
|
95 |
+
*/
|
96 |
+
private $timeGenerator;
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Constructs a `FeatureSet` for use by a `UuidFactory` to determine or set
|
100 |
+
* features available to the environment
|
101 |
+
*
|
102 |
+
* @param bool $useGuids Whether to build UUIDs using the `GuidStringCodec`
|
103 |
+
* @param bool $force32Bit Whether to force the use of 32-bit functionality
|
104 |
+
* (primarily for testing purposes)
|
105 |
+
* @param bool $forceNoBigNumber Whether to disable the use of moontoast/math
|
106 |
+
* `BigNumber` (primarily for testing purposes)
|
107 |
+
* @param bool $ignoreSystemNode Whether to disable attempts to check for
|
108 |
+
* the system host ID (primarily for testing purposes)
|
109 |
+
* @param bool $enablePecl Whether to enable the use of the `PeclUuidTimeGenerator`
|
110 |
+
* to generate version 1 UUIDs
|
111 |
+
*/
|
112 |
+
public function __construct(
|
113 |
+
$useGuids = false,
|
114 |
+
$force32Bit = false,
|
115 |
+
$forceNoBigNumber = false,
|
116 |
+
$ignoreSystemNode = false,
|
117 |
+
$enablePecl = false
|
118 |
+
) {
|
119 |
+
$this->disableBigNumber = $forceNoBigNumber;
|
120 |
+
$this->disable64Bit = $force32Bit;
|
121 |
+
$this->ignoreSystemNode = $ignoreSystemNode;
|
122 |
+
$this->enablePecl = $enablePecl;
|
123 |
+
|
124 |
+
$this->numberConverter = $this->buildNumberConverter();
|
125 |
+
$this->builder = $this->buildUuidBuilder();
|
126 |
+
$this->codec = $this->buildCodec($useGuids);
|
127 |
+
$this->nodeProvider = $this->buildNodeProvider();
|
128 |
+
$this->randomGenerator = $this->buildRandomGenerator();
|
129 |
+
$this->setTimeProvider(new SystemTimeProvider());
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Returns the builder configured for this environment
|
134 |
+
*
|
135 |
+
* @return UuidBuilderInterface
|
136 |
+
*/
|
137 |
+
public function getBuilder()
|
138 |
+
{
|
139 |
+
return $this->builder;
|
140 |
+
}
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Returns the UUID UUID coder-decoder configured for this environment
|
144 |
+
*
|
145 |
+
* @return CodecInterface
|
146 |
+
*/
|
147 |
+
public function getCodec()
|
148 |
+
{
|
149 |
+
return $this->codec;
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Returns the system node ID provider configured for this environment
|
154 |
+
*
|
155 |
+
* @return NodeProviderInterface
|
156 |
+
*/
|
157 |
+
public function getNodeProvider()
|
158 |
+
{
|
159 |
+
return $this->nodeProvider;
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Returns the number converter configured for this environment
|
164 |
+
*
|
165 |
+
* @return NumberConverterInterface
|
166 |
+
*/
|
167 |
+
public function getNumberConverter()
|
168 |
+
{
|
169 |
+
return $this->numberConverter;
|
170 |
+
}
|
171 |
+
|
172 |
+
/**
|
173 |
+
* Returns the random UUID generator configured for this environment
|
174 |
+
*
|
175 |
+
* @return RandomGeneratorInterface
|
176 |
+
*/
|
177 |
+
public function getRandomGenerator()
|
178 |
+
{
|
179 |
+
return $this->randomGenerator;
|
180 |
+
}
|
181 |
+
|
182 |
+
/**
|
183 |
+
* Returns the time-based UUID generator configured for this environment
|
184 |
+
*
|
185 |
+
* @return TimeGeneratorInterface
|
186 |
+
*/
|
187 |
+
public function getTimeGenerator()
|
188 |
+
{
|
189 |
+
return $this->timeGenerator;
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Sets the time provider for use in this environment
|
194 |
+
*
|
195 |
+
* @param TimeProviderInterface $timeProvider
|
196 |
+
*/
|
197 |
+
public function setTimeProvider(TimeProviderInterface $timeProvider)
|
198 |
+
{
|
199 |
+
$this->timeGenerator = $this->buildTimeGenerator($timeProvider);
|
200 |
+
}
|
201 |
+
|
202 |
+
/**
|
203 |
+
* Determines which UUID coder-decoder to use and returns the configured
|
204 |
+
* codec for this environment
|
205 |
+
*
|
206 |
+
* @param bool $useGuids Whether to build UUIDs using the `GuidStringCodec`
|
207 |
+
* @return CodecInterface
|
208 |
+
*/
|
209 |
+
protected function buildCodec($useGuids = false)
|
210 |
+
{
|
211 |
+
if ($useGuids) {
|
212 |
+
return new GuidStringCodec($this->builder);
|
213 |
+
}
|
214 |
+
|
215 |
+
return new StringCodec($this->builder);
|
216 |
+
}
|
217 |
+
|
218 |
+
/**
|
219 |
+
* Determines which system node ID provider to use and returns the configured
|
220 |
+
* system node ID provider for this environment
|
221 |
+
*
|
222 |
+
* @return NodeProviderInterface
|
223 |
+
*/
|
224 |
+
protected function buildNodeProvider()
|
225 |
+
{
|
226 |
+
if ($this->ignoreSystemNode) {
|
227 |
+
return new RandomNodeProvider();
|
228 |
+
}
|
229 |
+
|
230 |
+
return new FallbackNodeProvider([
|
231 |
+
new SystemNodeProvider(),
|
232 |
+
new RandomNodeProvider()
|
233 |
+
]);
|
234 |
+
}
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Determines which number converter to use and returns the configured
|
238 |
+
* number converter for this environment
|
239 |
+
*
|
240 |
+
* @return NumberConverterInterface
|
241 |
+
*/
|
242 |
+
protected function buildNumberConverter()
|
243 |
+
{
|
244 |
+
if ($this->hasBigNumber()) {
|
245 |
+
return new BigNumberConverter();
|
246 |
+
}
|
247 |
+
|
248 |
+
return new DegradedNumberConverter();
|
249 |
+
}
|
250 |
+
|
251 |
+
/**
|
252 |
+
* Determines which random UUID generator to use and returns the configured
|
253 |
+
* random UUID generator for this environment
|
254 |
+
*
|
255 |
+
* @return RandomGeneratorInterface
|
256 |
+
*/
|
257 |
+
protected function buildRandomGenerator()
|
258 |
+
{
|
259 |
+
return (new RandomGeneratorFactory())->getGenerator();
|
260 |
+
}
|
261 |
+
|
262 |
+
/**
|
263 |
+
* Determines which time-based UUID generator to use and returns the configured
|
264 |
+
* time-based UUID generator for this environment
|
265 |
+
*
|
266 |
+
* @param TimeProviderInterface $timeProvider
|
267 |
+
* @return TimeGeneratorInterface
|
268 |
+
*/
|
269 |
+
protected function buildTimeGenerator(TimeProviderInterface $timeProvider)
|
270 |
+
{
|
271 |
+
if ($this->enablePecl) {
|
272 |
+
return new PeclUuidTimeGenerator();
|
273 |
+
}
|
274 |
+
|
275 |
+
return (new TimeGeneratorFactory(
|
276 |
+
$this->nodeProvider,
|
277 |
+
$this->buildTimeConverter(),
|
278 |
+
$timeProvider
|
279 |
+
))->getGenerator();
|
280 |
+
}
|
281 |
+
|
282 |
+
/**
|
283 |
+
* Determines which time converter to use and returns the configured
|
284 |
+
* time converter for this environment
|
285 |
+
*
|
286 |
+
* @return TimeConverterInterface
|
287 |
+
*/
|
288 |
+
protected function buildTimeConverter()
|
289 |
+
{
|
290 |
+
if ($this->is64BitSystem()) {
|
291 |
+
return new PhpTimeConverter();
|
292 |
+
}
|
293 |
+
|
294 |
+
if ($this->hasBigNumber()) {
|
295 |
+
return new BigNumberTimeConverter();
|
296 |
+
}
|
297 |
+
|
298 |
+
return new DegradedTimeConverter();
|
299 |
+
}
|
300 |
+
|
301 |
+
/**
|
302 |
+
* Determines which UUID builder to use and returns the configured UUID
|
303 |
+
* builder for this environment
|
304 |
+
*
|
305 |
+
* @return UuidBuilderInterface
|
306 |
+
*/
|
307 |
+
protected function buildUuidBuilder()
|
308 |
+
{
|
309 |
+
if ($this->is64BitSystem()) {
|
310 |
+
return new DefaultUuidBuilder($this->numberConverter);
|
311 |
+
}
|
312 |
+
|
313 |
+
return new DegradedUuidBuilder($this->numberConverter);
|
314 |
+
}
|
315 |
+
|
316 |
+
/**
|
317 |
+
* Returns true if the system has `Moontoast\Math\BigNumber`
|
318 |
+
*
|
319 |
+
* @return bool
|
320 |
+
*/
|
321 |
+
protected function hasBigNumber()
|
322 |
+
{
|
323 |
+
return class_exists('Moontoast\Math\BigNumber') && !$this->disableBigNumber;
|
324 |
+
}
|
325 |
+
|
326 |
+
/**
|
327 |
+
* Returns true if the system is 64-bit, false otherwise
|
328 |
+
*
|
329 |
+
* @return bool
|
330 |
+
*/
|
331 |
+
protected function is64BitSystem()
|
332 |
+
{
|
333 |
+
return PHP_INT_SIZE == 8 && !$this->disable64Bit;
|
334 |
+
}
|
335 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Generator/CombGenerator.php
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Generator;
|
16 |
+
|
17 |
+
use Exception;
|
18 |
+
use InvalidArgumentException;
|
19 |
+
use Ramsey\Uuid\Converter\NumberConverterInterface;
|
20 |
+
use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* CombGenerator provides functionality to generate COMB (combined GUID/timestamp)
|
24 |
+
* sequential UUIDs
|
25 |
+
*
|
26 |
+
* @link https://en.wikipedia.org/wiki/Globally_unique_identifier#Sequential_algorithms
|
27 |
+
*/
|
28 |
+
class CombGenerator implements RandomGeneratorInterface
|
29 |
+
{
|
30 |
+
const TIMESTAMP_BYTES = 6;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @var RandomGeneratorInterface
|
34 |
+
*/
|
35 |
+
private $randomGenerator;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @var NumberConverterInterface
|
39 |
+
*/
|
40 |
+
private $converter;
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Constructs a `CombGenerator` using a random-number generator and a number converter
|
44 |
+
*
|
45 |
+
* @param RandomGeneratorInterface $generator Random-number generator for the non-time part.
|
46 |
+
* @param NumberConverterInterface $numberConverter Instance of number converter.
|
47 |
+
*/
|
48 |
+
public function __construct(RandomGeneratorInterface $generator, NumberConverterInterface $numberConverter)
|
49 |
+
{
|
50 |
+
$this->converter = $numberConverter;
|
51 |
+
$this->randomGenerator = $generator;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Generates a string of binary data of the specified length
|
56 |
+
*
|
57 |
+
* @param integer $length The number of bytes of random binary data to generate
|
58 |
+
* @return string A binary string
|
59 |
+
* @throws UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present
|
60 |
+
* @throws InvalidArgumentException if length is not a positive integer
|
61 |
+
* @throws Exception
|
62 |
+
*/
|
63 |
+
public function generate($length)
|
64 |
+
{
|
65 |
+
if ($length < self::TIMESTAMP_BYTES || $length < 0) {
|
66 |
+
throw new InvalidArgumentException('Length must be a positive integer.');
|
67 |
+
}
|
68 |
+
|
69 |
+
$hash = '';
|
70 |
+
|
71 |
+
if (self::TIMESTAMP_BYTES > 0 && $length > self::TIMESTAMP_BYTES) {
|
72 |
+
$hash = $this->randomGenerator->generate($length - self::TIMESTAMP_BYTES);
|
73 |
+
}
|
74 |
+
|
75 |
+
$lsbTime = str_pad($this->converter->toHex($this->timestamp()), self::TIMESTAMP_BYTES * 2, '0', STR_PAD_LEFT);
|
76 |
+
|
77 |
+
return hex2bin(str_pad(bin2hex($hash), $length - self::TIMESTAMP_BYTES, '0') . $lsbTime);
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Returns current timestamp as integer, precise to 0.00001 seconds
|
82 |
+
*
|
83 |
+
* @return string
|
84 |
+
*/
|
85 |
+
private function timestamp()
|
86 |
+
{
|
87 |
+
$time = explode(' ', microtime(false));
|
88 |
+
|
89 |
+
return $time[1] . substr($time[0], 2, 5);
|
90 |
+
}
|
91 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Generator/DefaultTimeGenerator.php
ADDED
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Generator;
|
16 |
+
|
17 |
+
use Exception;
|
18 |
+
use InvalidArgumentException;
|
19 |
+
use Ramsey\Uuid\BinaryUtils;
|
20 |
+
use Ramsey\Uuid\Converter\TimeConverterInterface;
|
21 |
+
use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
|
22 |
+
use Ramsey\Uuid\Provider\NodeProviderInterface;
|
23 |
+
use Ramsey\Uuid\Provider\TimeProviderInterface;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* DefaultTimeGenerator provides functionality to generate strings of binary
|
27 |
+
* data for version 1 UUIDs based on a host ID, sequence number, and the current
|
28 |
+
* time
|
29 |
+
*/
|
30 |
+
class DefaultTimeGenerator implements TimeGeneratorInterface
|
31 |
+
{
|
32 |
+
/**
|
33 |
+
* @var NodeProviderInterface
|
34 |
+
*/
|
35 |
+
private $nodeProvider;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @var TimeConverterInterface
|
39 |
+
*/
|
40 |
+
private $timeConverter;
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @var TimeProviderInterface
|
44 |
+
*/
|
45 |
+
private $timeProvider;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Constructs a `DefaultTimeGenerator` using a node provider, time converter,
|
49 |
+
* and time provider
|
50 |
+
*
|
51 |
+
* @param NodeProviderInterface $nodeProvider
|
52 |
+
* @param TimeConverterInterface $timeConverter
|
53 |
+
* @param TimeProviderInterface $timeProvider
|
54 |
+
*/
|
55 |
+
public function __construct(
|
56 |
+
NodeProviderInterface $nodeProvider,
|
57 |
+
TimeConverterInterface $timeConverter,
|
58 |
+
TimeProviderInterface $timeProvider
|
59 |
+
) {
|
60 |
+
$this->nodeProvider = $nodeProvider;
|
61 |
+
$this->timeConverter = $timeConverter;
|
62 |
+
$this->timeProvider = $timeProvider;
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Generate a version 1 UUID from a host ID, sequence number, and the current time
|
67 |
+
*
|
68 |
+
* If $node is not given, we will attempt to obtain the local hardware
|
69 |
+
* address. If $clockSeq is given, it is used as the sequence number;
|
70 |
+
* otherwise a random 14-bit sequence number is chosen.
|
71 |
+
*
|
72 |
+
* @param int|string $node A 48-bit number representing the hardware address
|
73 |
+
* This number may be represented as an integer or a hexadecimal string.
|
74 |
+
* @param int $clockSeq A 14-bit number used to help avoid duplicates that
|
75 |
+
* could arise when the clock is set backwards in time or if the node ID
|
76 |
+
* changes.
|
77 |
+
* @return string A binary string
|
78 |
+
* @throws UnsatisfiedDependencyException if called on a 32-bit system and
|
79 |
+
* `Moontoast\Math\BigNumber` is not present
|
80 |
+
* @throws InvalidArgumentException
|
81 |
+
* @throws Exception if it was not possible to gather sufficient entropy
|
82 |
+
*/
|
83 |
+
public function generate($node = null, $clockSeq = null)
|
84 |
+
{
|
85 |
+
$node = $this->getValidNode($node);
|
86 |
+
|
87 |
+
if ($clockSeq === null) {
|
88 |
+
// Not using "stable storage"; see RFC 4122, Section 4.2.1.1
|
89 |
+
$clockSeq = random_int(0, 0x3fff);
|
90 |
+
}
|
91 |
+
|
92 |
+
// Create a 60-bit time value as a count of 100-nanosecond intervals
|
93 |
+
// since 00:00:00.00, 15 October 1582
|
94 |
+
$timeOfDay = $this->timeProvider->currentTime();
|
95 |
+
$uuidTime = $this->timeConverter->calculateTime($timeOfDay['sec'], $timeOfDay['usec']);
|
96 |
+
|
97 |
+
$timeHi = BinaryUtils::applyVersion($uuidTime['hi'], 1);
|
98 |
+
$clockSeqHi = BinaryUtils::applyVariant($clockSeq >> 8);
|
99 |
+
|
100 |
+
$hex = vsprintf(
|
101 |
+
'%08s%04s%04s%02s%02s%012s',
|
102 |
+
[
|
103 |
+
$uuidTime['low'],
|
104 |
+
$uuidTime['mid'],
|
105 |
+
sprintf('%04x', $timeHi),
|
106 |
+
sprintf('%02x', $clockSeqHi),
|
107 |
+
sprintf('%02x', $clockSeq & 0xff),
|
108 |
+
$node,
|
109 |
+
]
|
110 |
+
);
|
111 |
+
|
112 |
+
return hex2bin($hex);
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Uses the node provider given when constructing this instance to get
|
117 |
+
* the node ID (usually a MAC address)
|
118 |
+
*
|
119 |
+
* @param string|int $node A node value that may be used to override the node provider
|
120 |
+
* @return string Hexadecimal representation of the node ID
|
121 |
+
* @throws InvalidArgumentException
|
122 |
+
* @throws Exception
|
123 |
+
*/
|
124 |
+
protected function getValidNode($node)
|
125 |
+
{
|
126 |
+
if ($node === null) {
|
127 |
+
$node = $this->nodeProvider->getNode();
|
128 |
+
}
|
129 |
+
|
130 |
+
// Convert the node to hex, if it is still an integer
|
131 |
+
if (is_int($node)) {
|
132 |
+
$node = sprintf('%012x', $node);
|
133 |
+
}
|
134 |
+
|
135 |
+
if (!ctype_xdigit($node) || strlen($node) > 12) {
|
136 |
+
throw new InvalidArgumentException('Invalid node value');
|
137 |
+
}
|
138 |
+
|
139 |
+
return strtolower(sprintf('%012s', $node));
|
140 |
+
}
|
141 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Generator/MtRandGenerator.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Generator;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* MtRandRandomGenerator provides functionality to generate strings of random
|
19 |
+
* binary data using the `mt_rand()` PHP function
|
20 |
+
*
|
21 |
+
* @deprecated The mt_rand() function is not a reliable source of randomness.
|
22 |
+
* The default RandomBytesGenerator, which uses the random_bytes() function,
|
23 |
+
* is recommended as the safest and most reliable source of randomness.
|
24 |
+
* <em>This generator will be removed in ramsey/uuid 4.0.0.</em>
|
25 |
+
* @link http://php.net/mt_rand
|
26 |
+
*/
|
27 |
+
class MtRandGenerator implements RandomGeneratorInterface
|
28 |
+
{
|
29 |
+
/**
|
30 |
+
* Generates a string of random binary data of the specified length
|
31 |
+
*
|
32 |
+
* @param integer $length The number of bytes of random binary data to generate
|
33 |
+
* @return string A binary string
|
34 |
+
*/
|
35 |
+
public function generate($length)
|
36 |
+
{
|
37 |
+
$bytes = '';
|
38 |
+
|
39 |
+
for ($i = 1; $i <= $length; $i++) {
|
40 |
+
$bytes = chr(mt_rand(0, 255)) . $bytes;
|
41 |
+
}
|
42 |
+
|
43 |
+
return $bytes;
|
44 |
+
}
|
45 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Generator/OpenSslGenerator.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Generator;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* OpenSslRandomGenerator provides functionality to generate strings of random
|
19 |
+
* binary data using the `openssl_random_pseudo_bytes()` PHP function
|
20 |
+
*
|
21 |
+
* The use of this generator requires PHP to be compiled using the
|
22 |
+
* `--with-openssl` option.
|
23 |
+
*
|
24 |
+
* @deprecated The openssl_random_pseudo_bytes() function is not a reliable
|
25 |
+
* source of randomness. The default RandomBytesGenerator, which uses the
|
26 |
+
* random_bytes() function, is recommended as the safest and most reliable
|
27 |
+
* source of randomness.
|
28 |
+
* <em>This generator will be removed in ramsey/uuid 4.0.0.</em>
|
29 |
+
* @link http://php.net/openssl_random_pseudo_bytes
|
30 |
+
*/
|
31 |
+
class OpenSslGenerator implements RandomGeneratorInterface
|
32 |
+
{
|
33 |
+
/**
|
34 |
+
* Generates a string of random binary data of the specified length
|
35 |
+
*
|
36 |
+
* @param integer $length The number of bytes of random binary data to generate
|
37 |
+
* @return string A binary string
|
38 |
+
*/
|
39 |
+
public function generate($length)
|
40 |
+
{
|
41 |
+
return openssl_random_pseudo_bytes($length);
|
42 |
+
}
|
43 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Generator/PeclUuidRandomGenerator.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Generator;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* PeclUuidRandomGenerator provides functionality to generate strings of random
|
19 |
+
* binary data using the PECL UUID PHP extension
|
20 |
+
*
|
21 |
+
* @link https://pecl.php.net/package/uuid
|
22 |
+
*/
|
23 |
+
class PeclUuidRandomGenerator implements RandomGeneratorInterface
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Generates a string of random binary data of the specified length
|
27 |
+
*
|
28 |
+
* @param integer $length The number of bytes of random binary data to generate
|
29 |
+
* @return string A binary string
|
30 |
+
*/
|
31 |
+
public function generate($length)
|
32 |
+
{
|
33 |
+
$uuid = uuid_create(UUID_TYPE_RANDOM);
|
34 |
+
|
35 |
+
return uuid_parse($uuid);
|
36 |
+
}
|
37 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Generator/PeclUuidTimeGenerator.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Generator;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* PeclUuidTimeGenerator provides functionality to generate strings of binary
|
19 |
+
* data for version 1 UUIDs using the PECL UUID PHP extension
|
20 |
+
*
|
21 |
+
* @link https://pecl.php.net/package/uuid
|
22 |
+
*/
|
23 |
+
class PeclUuidTimeGenerator implements TimeGeneratorInterface
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Generate a version 1 UUID using the PECL UUID extension
|
27 |
+
*
|
28 |
+
* @param int|string $node Not used in this context
|
29 |
+
* @param int $clockSeq Not used in this context
|
30 |
+
* @return string A binary string
|
31 |
+
*/
|
32 |
+
public function generate($node = null, $clockSeq = null)
|
33 |
+
{
|
34 |
+
$uuid = uuid_create(UUID_TYPE_TIME);
|
35 |
+
|
36 |
+
return uuid_parse($uuid);
|
37 |
+
}
|
38 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Generator/RandomBytesGenerator.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Generator;
|
16 |
+
|
17 |
+
use Exception;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* RandomBytesGenerator provides functionality to generate strings of random
|
21 |
+
* binary data using `random_bytes()` function in PHP 7+ or paragonie/random_compat
|
22 |
+
*
|
23 |
+
* @link http://php.net/random_bytes
|
24 |
+
* @link https://github.com/paragonie/random_compat
|
25 |
+
*/
|
26 |
+
class RandomBytesGenerator implements RandomGeneratorInterface
|
27 |
+
{
|
28 |
+
/**
|
29 |
+
* Generates a string of random binary data of the specified length
|
30 |
+
*
|
31 |
+
* @param integer $length The number of bytes of random binary data to generate
|
32 |
+
* @return string A binary string
|
33 |
+
* @throws Exception if it was not possible to gather sufficient entropy
|
34 |
+
*/
|
35 |
+
public function generate($length)
|
36 |
+
{
|
37 |
+
return random_bytes($length);
|
38 |
+
}
|
39 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Generator/RandomGeneratorFactory.php
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Generator;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* A factory for retrieving a random generator, based on the environment
|
19 |
+
*/
|
20 |
+
class RandomGeneratorFactory
|
21 |
+
{
|
22 |
+
/**
|
23 |
+
* Returns a default random generator, based on the current environment
|
24 |
+
*
|
25 |
+
* @return RandomGeneratorInterface
|
26 |
+
*/
|
27 |
+
public static function getGenerator()
|
28 |
+
{
|
29 |
+
return new RandomBytesGenerator();
|
30 |
+
}
|
31 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Generator/RandomGeneratorInterface.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Generator;
|
16 |
+
|
17 |
+
use Exception;
|
18 |
+
use InvalidArgumentException;
|
19 |
+
use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* RandomGeneratorInterface provides functionality to generate strings of random
|
23 |
+
* binary data
|
24 |
+
*/
|
25 |
+
interface RandomGeneratorInterface
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* Generates a string of random binary data of the specified length
|
29 |
+
*
|
30 |
+
* @param integer $length The number of bytes of random binary data to generate
|
31 |
+
* @return string A binary string
|
32 |
+
* @throws UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present
|
33 |
+
* @throws InvalidArgumentException
|
34 |
+
* @throws Exception if it was not possible to gather sufficient entropy
|
35 |
+
*/
|
36 |
+
public function generate($length);
|
37 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Generator/RandomLibAdapter.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Generator;
|
16 |
+
|
17 |
+
use RandomLib\Generator;
|
18 |
+
use RandomLib\Factory;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* RandomLibAdapter provides functionality to generate strings of random
|
22 |
+
* binary data using the paragonie/random-lib library
|
23 |
+
*
|
24 |
+
* @link https://packagist.org/packages/paragonie/random-lib
|
25 |
+
*/
|
26 |
+
class RandomLibAdapter implements RandomGeneratorInterface
|
27 |
+
{
|
28 |
+
/**
|
29 |
+
* @var Generator
|
30 |
+
*/
|
31 |
+
private $generator;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Constructs a `RandomLibAdapter` using a `RandomLib\Generator`
|
35 |
+
*
|
36 |
+
* By default, if no `Generator` is passed in, this creates a high-strength
|
37 |
+
* generator to use when generating random binary data.
|
38 |
+
*
|
39 |
+
* @param Generator $generator An paragonie/random-lib `Generator`
|
40 |
+
*/
|
41 |
+
public function __construct(Generator $generator = null)
|
42 |
+
{
|
43 |
+
$this->generator = $generator;
|
44 |
+
|
45 |
+
if ($this->generator === null) {
|
46 |
+
$factory = new Factory();
|
47 |
+
|
48 |
+
$this->generator = $factory->getHighStrengthGenerator();
|
49 |
+
}
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Generates a string of random binary data of the specified length
|
54 |
+
*
|
55 |
+
* @param integer $length The number of bytes of random binary data to generate
|
56 |
+
* @return string A binary string
|
57 |
+
*/
|
58 |
+
public function generate($length)
|
59 |
+
{
|
60 |
+
return $this->generator->generate($length);
|
61 |
+
}
|
62 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Generator/SodiumRandomGenerator.php
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Generator;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* SodiumRandomGenerator provides functionality to generate strings of random
|
19 |
+
* binary data using the PECL libsodium extension
|
20 |
+
*
|
21 |
+
* @deprecated As of PHP 7.2.0, the libsodium extension is bundled with PHP, and
|
22 |
+
* the random_bytes() PHP function is now the recommended method for
|
23 |
+
* generating random byes. The default RandomBytesGenerator uses the
|
24 |
+
* random_bytes() function.
|
25 |
+
* <em>This generator will be removed in ramsey/uuid 4.0.0.</em>
|
26 |
+
* @link http://pecl.php.net/package/libsodium
|
27 |
+
* @link https://paragonie.com/book/pecl-libsodium
|
28 |
+
*/
|
29 |
+
class SodiumRandomGenerator implements RandomGeneratorInterface
|
30 |
+
{
|
31 |
+
/**
|
32 |
+
* Generates a string of random binary data of the specified length
|
33 |
+
*
|
34 |
+
* @param integer $length The number of bytes of random binary data to generate
|
35 |
+
* @return string A binary string
|
36 |
+
*/
|
37 |
+
public function generate($length)
|
38 |
+
{
|
39 |
+
return \Sodium\randombytes_buf($length);
|
40 |
+
}
|
41 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Generator/TimeGeneratorFactory.php
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Generator;
|
16 |
+
|
17 |
+
use Ramsey\Uuid\Converter\TimeConverterInterface;
|
18 |
+
use Ramsey\Uuid\Provider\NodeProviderInterface;
|
19 |
+
use Ramsey\Uuid\Provider\TimeProviderInterface;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* A factory for retrieving a time generator, based on the environment
|
23 |
+
*/
|
24 |
+
class TimeGeneratorFactory
|
25 |
+
{
|
26 |
+
/**
|
27 |
+
* @var NodeProviderInterface
|
28 |
+
*/
|
29 |
+
private $nodeProvider;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @var TimeConverterInterface
|
33 |
+
*/
|
34 |
+
private $timeConverter;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* @var TimeProviderInterface
|
38 |
+
*/
|
39 |
+
private $timeProvider;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Constructs a `TimeGeneratorFactory` using a node provider, time converter,
|
43 |
+
* and time provider
|
44 |
+
*
|
45 |
+
* @param NodeProviderInterface $nodeProvider
|
46 |
+
* @param TimeConverterInterface $timeConverter
|
47 |
+
* @param TimeProviderInterface $timeProvider
|
48 |
+
*/
|
49 |
+
public function __construct(
|
50 |
+
NodeProviderInterface $nodeProvider,
|
51 |
+
TimeConverterInterface $timeConverter,
|
52 |
+
TimeProviderInterface $timeProvider
|
53 |
+
) {
|
54 |
+
$this->nodeProvider = $nodeProvider;
|
55 |
+
$this->timeConverter = $timeConverter;
|
56 |
+
$this->timeProvider = $timeProvider;
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Returns a default time generator, based on the current environment
|
61 |
+
*
|
62 |
+
* @return TimeGeneratorInterface
|
63 |
+
*/
|
64 |
+
public function getGenerator()
|
65 |
+
{
|
66 |
+
return new DefaultTimeGenerator(
|
67 |
+
$this->nodeProvider,
|
68 |
+
$this->timeConverter,
|
69 |
+
$this->timeProvider
|
70 |
+
);
|
71 |
+
}
|
72 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Generator/TimeGeneratorInterface.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Generator;
|
16 |
+
|
17 |
+
use Exception;
|
18 |
+
use InvalidArgumentException;
|
19 |
+
use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* TimeGeneratorInterface provides functionality to generate strings of binary
|
23 |
+
* data for version 1 UUIDs based on a host ID, sequence number, and the current
|
24 |
+
* time
|
25 |
+
*/
|
26 |
+
interface TimeGeneratorInterface
|
27 |
+
{
|
28 |
+
/**
|
29 |
+
* Generate a version 1 UUID from a host ID, sequence number, and the current time
|
30 |
+
*
|
31 |
+
* @param int|string $node A 48-bit number representing the hardware address
|
32 |
+
* This number may be represented as an integer or a hexadecimal string.
|
33 |
+
* @param int $clockSeq A 14-bit number used to help avoid duplicates that
|
34 |
+
* could arise when the clock is set backwards in time or if the node ID
|
35 |
+
* changes.
|
36 |
+
* @return string A binary string
|
37 |
+
* @throws UnsatisfiedDependencyException if called on a 32-bit system and
|
38 |
+
* `Moontoast\Math\BigNumber` is not present
|
39 |
+
* @throws InvalidArgumentException
|
40 |
+
* @throws Exception if it was not possible to gather sufficient entropy
|
41 |
+
*/
|
42 |
+
public function generate($node = null, $clockSeq = null);
|
43 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Provider/Node/FallbackNodeProvider.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Provider\Node;
|
16 |
+
|
17 |
+
use Exception;
|
18 |
+
use Ramsey\Uuid\Provider\NodeProviderInterface;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* FallbackNodeProvider attempts to gain the system host ID from an array of
|
22 |
+
* providers, falling back to the next in line in the event a host ID can not be
|
23 |
+
* obtained
|
24 |
+
*/
|
25 |
+
class FallbackNodeProvider implements NodeProviderInterface
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* @var NodeProviderInterface[]
|
29 |
+
*/
|
30 |
+
private $nodeProviders;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Constructs a `FallbackNodeProvider` using an array of node providers
|
34 |
+
*
|
35 |
+
* @param NodeProviderInterface[] $providers Array of node providers
|
36 |
+
*/
|
37 |
+
public function __construct(array $providers)
|
38 |
+
{
|
39 |
+
$this->nodeProviders = $providers;
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Returns the system node ID by iterating over an array of node providers
|
44 |
+
* and returning the first non-empty value found
|
45 |
+
*
|
46 |
+
* @return string System node ID as a hexadecimal string
|
47 |
+
* @throws Exception
|
48 |
+
*/
|
49 |
+
public function getNode()
|
50 |
+
{
|
51 |
+
foreach ($this->nodeProviders as $provider) {
|
52 |
+
if ($node = $provider->getNode()) {
|
53 |
+
return $node;
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
return null;
|
58 |
+
}
|
59 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Provider/Node/RandomNodeProvider.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Provider\Node;
|
16 |
+
|
17 |
+
use Exception;
|
18 |
+
use Ramsey\Uuid\Provider\NodeProviderInterface;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* RandomNodeProvider provides functionality to generate a random node ID, in
|
22 |
+
* the event that the node ID could not be obtained from the host system
|
23 |
+
*
|
24 |
+
* @link http://tools.ietf.org/html/rfc4122#section-4.5
|
25 |
+
*/
|
26 |
+
class RandomNodeProvider implements NodeProviderInterface
|
27 |
+
{
|
28 |
+
/**
|
29 |
+
* Returns the system node ID
|
30 |
+
*
|
31 |
+
* @return string System node ID as a hexadecimal string
|
32 |
+
* @throws Exception if it was not possible to gather sufficient entropy
|
33 |
+
*/
|
34 |
+
public function getNode()
|
35 |
+
{
|
36 |
+
$nodeBytes = random_bytes(6);
|
37 |
+
|
38 |
+
// Split the node bytes for math on 32-bit systems.
|
39 |
+
$nodeMsb = substr($nodeBytes, 0, 3);
|
40 |
+
$nodeLsb = substr($nodeBytes, 3);
|
41 |
+
|
42 |
+
// Set the multicast bit; see RFC 4122, section 4.5.
|
43 |
+
$nodeMsb = hex2bin(
|
44 |
+
str_pad(
|
45 |
+
dechex(hexdec(bin2hex($nodeMsb)) | 0x010000),
|
46 |
+
6,
|
47 |
+
'0',
|
48 |
+
STR_PAD_LEFT
|
49 |
+
)
|
50 |
+
);
|
51 |
+
|
52 |
+
// Recombine the node bytes.
|
53 |
+
$node = $nodeMsb . $nodeLsb;
|
54 |
+
|
55 |
+
return str_pad(bin2hex($node), 12, '0', STR_PAD_LEFT);
|
56 |
+
}
|
57 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Provider/Node/SystemNodeProvider.php
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Provider\Node;
|
16 |
+
|
17 |
+
use Ramsey\Uuid\Provider\NodeProviderInterface;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* SystemNodeProvider provides functionality to get the system node ID (MAC
|
21 |
+
* address) using external system calls
|
22 |
+
*/
|
23 |
+
class SystemNodeProvider implements NodeProviderInterface
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Returns the system node ID
|
27 |
+
*
|
28 |
+
* @return string|false System node ID as a hexadecimal string, or false if it is not found
|
29 |
+
*/
|
30 |
+
public function getNode()
|
31 |
+
{
|
32 |
+
static $node = null;
|
33 |
+
|
34 |
+
if ($node !== null) {
|
35 |
+
return $node;
|
36 |
+
}
|
37 |
+
|
38 |
+
$pattern = '/[^:]([0-9A-Fa-f]{2}([:-])[0-9A-Fa-f]{2}(\2[0-9A-Fa-f]{2}){4})[^:]/';
|
39 |
+
$matches = [];
|
40 |
+
|
41 |
+
// first try a linux specific way
|
42 |
+
$node = $this->getSysfs();
|
43 |
+
|
44 |
+
// Search the ifconfig output for all MAC addresses and return
|
45 |
+
// the first one found
|
46 |
+
if ($node === false) {
|
47 |
+
if (preg_match_all($pattern, $this->getIfconfig(), $matches, PREG_PATTERN_ORDER)) {
|
48 |
+
$node = $matches[1][0];
|
49 |
+
}
|
50 |
+
}
|
51 |
+
if ($node !== false) {
|
52 |
+
$node = str_replace([':', '-'], '', $node);
|
53 |
+
}
|
54 |
+
return $node;
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Returns the network interface configuration for the system
|
59 |
+
*
|
60 |
+
* @codeCoverageIgnore
|
61 |
+
* @return string
|
62 |
+
*/
|
63 |
+
protected function getIfconfig()
|
64 |
+
{
|
65 |
+
if (strpos(strtolower(ini_get('disable_functions')), 'passthru') !== false) {
|
66 |
+
return '';
|
67 |
+
}
|
68 |
+
|
69 |
+
ob_start();
|
70 |
+
switch (strtoupper(substr(constant('PHP_OS'), 0, 3))) {
|
71 |
+
case 'WIN':
|
72 |
+
passthru('ipconfig /all 2>&1');
|
73 |
+
break;
|
74 |
+
case 'DAR':
|
75 |
+
passthru('ifconfig 2>&1');
|
76 |
+
break;
|
77 |
+
case 'FRE':
|
78 |
+
passthru('netstat -i -f link 2>&1');
|
79 |
+
break;
|
80 |
+
case 'LIN':
|
81 |
+
default:
|
82 |
+
passthru('netstat -ie 2>&1');
|
83 |
+
break;
|
84 |
+
}
|
85 |
+
|
86 |
+
return ob_get_clean();
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Returns mac address from the first system interface via the sysfs interface
|
91 |
+
*
|
92 |
+
* @return string|bool
|
93 |
+
*/
|
94 |
+
protected function getSysfs()
|
95 |
+
{
|
96 |
+
$mac = false;
|
97 |
+
|
98 |
+
if (strtoupper(constant('PHP_OS')) === 'LINUX') {
|
99 |
+
$addressPaths = glob('/sys/class/net/*/address', GLOB_NOSORT);
|
100 |
+
|
101 |
+
if (empty($addressPaths)) {
|
102 |
+
return false;
|
103 |
+
}
|
104 |
+
|
105 |
+
$macs = [];
|
106 |
+
array_walk($addressPaths, function ($addressPath) use (&$macs) {
|
107 |
+
if (is_readable($addressPath)) {
|
108 |
+
$macs[] = file_get_contents($addressPath);
|
109 |
+
}
|
110 |
+
});
|
111 |
+
|
112 |
+
$macs = array_map('trim', $macs);
|
113 |
+
|
114 |
+
// remove invalid entries
|
115 |
+
$macs = array_filter($macs, function ($mac) {
|
116 |
+
return
|
117 |
+
// localhost adapter
|
118 |
+
$mac !== '00:00:00:00:00:00' &&
|
119 |
+
// must match mac adress
|
120 |
+
preg_match('/^([0-9a-f]{2}:){5}[0-9a-f]{2}$/i', $mac);
|
121 |
+
});
|
122 |
+
|
123 |
+
$mac = reset($macs);
|
124 |
+
}
|
125 |
+
|
126 |
+
return $mac;
|
127 |
+
}
|
128 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Provider/NodeProviderInterface.php
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Provider;
|
16 |
+
|
17 |
+
use Exception;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* NodeProviderInterface provides functionality to get the node ID (or host ID
|
21 |
+
* in the form of the system's MAC address) from a specific type of node provider
|
22 |
+
*/
|
23 |
+
interface NodeProviderInterface
|
24 |
+
{
|
25 |
+
/**
|
26 |
+
* Returns the system node ID
|
27 |
+
*
|
28 |
+
* @return string System node ID as a hexadecimal string
|
29 |
+
* @throws Exception if it was not possible to gather sufficient entropy
|
30 |
+
*/
|
31 |
+
public function getNode();
|
32 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Provider/Time/FixedTimeProvider.php
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Provider\Time;
|
16 |
+
|
17 |
+
use InvalidArgumentException;
|
18 |
+
use Ramsey\Uuid\Provider\TimeProviderInterface;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* FixedTimeProvider uses an previously-generated timestamp to provide the time
|
22 |
+
*
|
23 |
+
* This provider allows the use of a previously-generated timestamp, such as one
|
24 |
+
* stored in a database, when creating version 1 UUIDs.
|
25 |
+
*/
|
26 |
+
class FixedTimeProvider implements TimeProviderInterface
|
27 |
+
{
|
28 |
+
/**
|
29 |
+
* @var int[] Array containing `sec` and `usec` components of a timestamp
|
30 |
+
*/
|
31 |
+
private $fixedTime;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Constructs a `FixedTimeProvider` using the provided `$timestamp`
|
35 |
+
*
|
36 |
+
* @param int[] Array containing `sec` and `usec` components of a timestamp
|
37 |
+
* @throws InvalidArgumentException if the `$timestamp` does not contain `sec` or `usec` components
|
38 |
+
*/
|
39 |
+
public function __construct(array $timestamp)
|
40 |
+
{
|
41 |
+
if (!array_key_exists('sec', $timestamp) || !array_key_exists('usec', $timestamp)) {
|
42 |
+
throw new InvalidArgumentException('Array must contain sec and usec keys.');
|
43 |
+
}
|
44 |
+
|
45 |
+
$this->fixedTime = $timestamp;
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Sets the `usec` component of the timestamp
|
50 |
+
*
|
51 |
+
* @param int $value The `usec` value to set
|
52 |
+
*/
|
53 |
+
public function setUsec($value)
|
54 |
+
{
|
55 |
+
$this->fixedTime['usec'] = $value;
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Sets the `sec` component of the timestamp
|
60 |
+
*
|
61 |
+
* @param int $value The `sec` value to set
|
62 |
+
*/
|
63 |
+
public function setSec($value)
|
64 |
+
{
|
65 |
+
$this->fixedTime['sec'] = $value;
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Returns a timestamp array
|
70 |
+
*
|
71 |
+
* @return int[] Array containing `sec` and `usec` components of a timestamp
|
72 |
+
*/
|
73 |
+
public function currentTime()
|
74 |
+
{
|
75 |
+
return $this->fixedTime;
|
76 |
+
}
|
77 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Provider/Time/SystemTimeProvider.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Provider\Time;
|
16 |
+
|
17 |
+
use Ramsey\Uuid\Provider\TimeProviderInterface;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* SystemTimeProvider uses built-in PHP functions to provide the time
|
21 |
+
*/
|
22 |
+
class SystemTimeProvider implements TimeProviderInterface
|
23 |
+
{
|
24 |
+
/**
|
25 |
+
* Returns a timestamp array
|
26 |
+
*
|
27 |
+
* @return int[] Array containing `sec` and `usec` components of a timestamp
|
28 |
+
*/
|
29 |
+
public function currentTime()
|
30 |
+
{
|
31 |
+
return gettimeofday();
|
32 |
+
}
|
33 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Provider/TimeProviderInterface.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid\Provider;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* TimeProviderInterface provides functionality to get the time from a specific
|
19 |
+
* type of time provider
|
20 |
+
*/
|
21 |
+
interface TimeProviderInterface
|
22 |
+
{
|
23 |
+
/**
|
24 |
+
* Returns a timestamp array
|
25 |
+
*
|
26 |
+
* @return int[] Array guaranteed to contain `sec` and `usec` components of a timestamp
|
27 |
+
*/
|
28 |
+
public function currentTime();
|
29 |
+
}
|
src/lib/vendor/ramsey/uuid/src/Uuid.php
ADDED
@@ -0,0 +1,751 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid;
|
16 |
+
|
17 |
+
use DateTime;
|
18 |
+
use Exception;
|
19 |
+
use InvalidArgumentException;
|
20 |
+
use Ramsey\Uuid\Converter\NumberConverterInterface;
|
21 |
+
use Ramsey\Uuid\Codec\CodecInterface;
|
22 |
+
use Ramsey\Uuid\Exception\InvalidUuidStringException;
|
23 |
+
use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
|
24 |
+
use Ramsey\Uuid\Exception\UnsupportedOperationException;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Represents a universally unique identifier (UUID), according to RFC 4122.
|
28 |
+
*
|
29 |
+
* This class provides immutable UUID objects (the Uuid class) and the static
|
30 |
+
* methods `uuid1()`, `uuid3()`, `uuid4()`, and `uuid5()` for generating version
|
31 |
+
* 1, 3, 4, and 5 UUIDs as specified in RFC 4122.
|
32 |
+
*
|
33 |
+
* If all you want is a unique ID, you should probably call `uuid1()` or `uuid4()`.
|
34 |
+
* Note that `uuid1()` may compromise privacy since it creates a UUID containing
|
35 |
+
* the computer’s network address. `uuid4()` creates a random UUID.
|
36 |
+
*
|
37 |
+
* @link http://tools.ietf.org/html/rfc4122
|
38 |
+
* @link http://en.wikipedia.org/wiki/Universally_unique_identifier
|
39 |
+
* @link http://docs.python.org/3/library/uuid.html
|
40 |
+
* @link http://docs.oracle.com/javase/6/docs/api/java/util/UUID.html
|
41 |
+
*/
|
42 |
+
class Uuid implements UuidInterface
|
43 |
+
{
|
44 |
+
/**
|
45 |
+
* When this namespace is specified, the name string is a fully-qualified domain name.
|
46 |
+
* @link http://tools.ietf.org/html/rfc4122#appendix-C
|
47 |
+
*/
|
48 |
+
const NAMESPACE_DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
|
49 |
+
|
50 |
+
/**
|
51 |
+
* When this namespace is specified, the name string is a URL.
|
52 |
+
* @link http://tools.ietf.org/html/rfc4122#appendix-C
|
53 |
+
*/
|
54 |
+
const NAMESPACE_URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
|
55 |
+
|
56 |
+
/**
|
57 |
+
* When this namespace is specified, the name string is an ISO OID.
|
58 |
+
* @link http://tools.ietf.org/html/rfc4122#appendix-C
|
59 |
+
*/
|
60 |
+
const NAMESPACE_OID = '6ba7b812-9dad-11d1-80b4-00c04fd430c8';
|
61 |
+
|
62 |
+
/**
|
63 |
+
* When this namespace is specified, the name string is an X.500 DN in DER or a text output format.
|
64 |
+
* @link http://tools.ietf.org/html/rfc4122#appendix-C
|
65 |
+
*/
|
66 |
+
const NAMESPACE_X500 = '6ba7b814-9dad-11d1-80b4-00c04fd430c8';
|
67 |
+
|
68 |
+
/**
|
69 |
+
* The nil UUID is special form of UUID that is specified to have all 128 bits set to zero.
|
70 |
+
* @link http://tools.ietf.org/html/rfc4122#section-4.1.7
|
71 |
+
*/
|
72 |
+
const NIL = '00000000-0000-0000-0000-000000000000';
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Reserved for NCS compatibility.
|
76 |
+
* @link http://tools.ietf.org/html/rfc4122#section-4.1.1
|
77 |
+
*/
|
78 |
+
const RESERVED_NCS = 0;
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Specifies the UUID layout given in RFC 4122.
|
82 |
+
* @link http://tools.ietf.org/html/rfc4122#section-4.1.1
|
83 |
+
*/
|
84 |
+
const RFC_4122 = 2;
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Reserved for Microsoft compatibility.
|
88 |
+
* @link http://tools.ietf.org/html/rfc4122#section-4.1.1
|
89 |
+
*/
|
90 |
+
const RESERVED_MICROSOFT = 6;
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Reserved for future definition.
|
94 |
+
* @link http://tools.ietf.org/html/rfc4122#section-4.1.1
|
95 |
+
*/
|
96 |
+
const RESERVED_FUTURE = 7;
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Regular expression pattern for matching a valid UUID of any variant.
|
100 |
+
*/
|
101 |
+
const VALID_PATTERN = '^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$';
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Version 1 (time-based) UUID object constant identifier
|
105 |
+
*/
|
106 |
+
const UUID_TYPE_TIME = 1;
|
107 |
+
|
108 |
+
/**
|
109 |
+
* Version 2 (identifier-based) UUID object constant identifier
|
110 |
+
*/
|
111 |
+
const UUID_TYPE_IDENTIFIER = 2;
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Version 3 (name-based and hashed with MD5) UUID object constant identifier
|
115 |
+
*/
|
116 |
+
const UUID_TYPE_HASH_MD5 = 3;
|
117 |
+
|
118 |
+
/**
|
119 |
+
* Version 4 (random) UUID object constant identifier
|
120 |
+
*/
|
121 |
+
const UUID_TYPE_RANDOM = 4;
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Version 5 (name-based and hashed with SHA1) UUID object constant identifier
|
125 |
+
*/
|
126 |
+
const UUID_TYPE_HASH_SHA1 = 5;
|
127 |
+
|
128 |
+
/**
|
129 |
+
* The factory to use when creating UUIDs.
|
130 |
+
* @var UuidFactoryInterface
|
131 |
+
*/
|
132 |
+
private static $factory = null;
|
133 |
+
|
134 |
+
/**
|
135 |
+
* The codec to use when encoding or decoding UUID strings.
|
136 |
+
* @var CodecInterface
|
137 |
+
*/
|
138 |
+
protected $codec;
|
139 |
+
|
140 |
+
/**
|
141 |
+
* The fields that make up this UUID.
|
142 |
+
*
|
143 |
+
* This is initialized to the nil value.
|
144 |
+
*
|
145 |
+
* @var array
|
146 |
+
* @see UuidInterface::getFieldsHex()
|
147 |
+
*/
|
148 |
+
protected $fields = [
|
149 |
+
'time_low' => '00000000',
|
150 |
+
'time_mid' => '0000',
|
151 |
+
'time_hi_and_version' => '0000',
|
152 |
+
'clock_seq_hi_and_reserved' => '00',
|
153 |
+
'clock_seq_low' => '00',
|
154 |
+
'node' => '000000000000',
|
155 |
+
];
|
156 |
+
|
157 |
+
/**
|
158 |
+
* The number converter to use for converting hex values to/from integers.
|
159 |
+
* @var NumberConverterInterface
|
160 |
+
*/
|
161 |
+
protected $converter;
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Creates a universally unique identifier (UUID) from an array of fields.
|
165 |
+
*
|
166 |
+
* Unless you're making advanced use of this library to generate identifiers
|
167 |
+
* that deviate from RFC 4122, you probably do not want to instantiate a
|
168 |
+
* UUID directly. Use the static methods, instead:
|
169 |
+
*
|
170 |
+
* ```
|
171 |
+
* use Ramsey\Uuid\Uuid;
|
172 |
+
*
|
173 |
+
* $timeBasedUuid = Uuid::uuid1();
|
174 |
+
* $namespaceMd5Uuid = Uuid::uuid3(Uuid::NAMESPACE_URL, 'http://php.net/');
|
175 |
+
* $randomUuid = Uuid::uuid4();
|
176 |
+
* $namespaceSha1Uuid = Uuid::uuid5(Uuid::NAMESPACE_URL, 'http://php.net/');
|
177 |
+
* ```
|
178 |
+
*
|
179 |
+
* @param array $fields An array of fields from which to construct a UUID;
|
180 |
+
* see {@see \Ramsey\Uuid\UuidInterface::getFieldsHex()} for array structure.
|
181 |
+
* @param NumberConverterInterface $converter The number converter to use
|
182 |
+
* for converting hex values to/from integers.
|
183 |
+
* @param CodecInterface $codec The codec to use when encoding or decoding
|
184 |
+
* UUID strings.
|
185 |
+
*/
|
186 |
+
public function __construct(
|
187 |
+
array $fields,
|
188 |
+
NumberConverterInterface $converter,
|
189 |
+
CodecInterface $codec
|
190 |
+
) {
|
191 |
+
$this->fields = $fields;
|
192 |
+
$this->codec = $codec;
|
193 |
+
$this->converter = $converter;
|
194 |
+
}
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Converts this UUID object to a string when the object is used in any
|
198 |
+
* string context.
|
199 |
+
*
|
200 |
+
* @return string
|
201 |
+
* @link http://www.php.net/manual/en/language.oop5.magic.php#object.tostring
|
202 |
+
*/
|
203 |
+
public function __toString()
|
204 |
+
{
|
205 |
+
return $this->toString();
|
206 |
+
}
|
207 |
+
|
208 |
+
/**
|
209 |
+
* Converts this UUID object to a string when the object is serialized
|
210 |
+
* with `json_encode()`
|
211 |
+
*
|
212 |
+
* @return string
|
213 |
+
* @link http://php.net/manual/en/class.jsonserializable.php
|
214 |
+
*/
|
215 |
+
public function jsonSerialize()
|
216 |
+
{
|
217 |
+
return $this->toString();
|
218 |
+
}
|
219 |
+
|
220 |
+
/**
|
221 |
+
* Converts this UUID object to a string when the object is serialized
|
222 |
+
* with `serialize()`
|
223 |
+
*
|
224 |
+
* @return string
|
225 |
+
* @link http://php.net/manual/en/class.serializable.php
|
226 |
+
*/
|
227 |
+
public function serialize()
|
228 |
+
{
|
229 |
+
return $this->toString();
|
230 |
+
}
|
231 |
+
|
232 |
+
/**
|
233 |
+
* Re-constructs the object from its serialized form.
|
234 |
+
*
|
235 |
+
* @param string $serialized
|
236 |
+
* @link http://php.net/manual/en/class.serializable.php
|
237 |
+
* @throws InvalidUuidStringException
|
238 |
+
*/
|
239 |
+
public function unserialize($serialized)
|
240 |
+
{
|
241 |
+
$uuid = self::fromString($serialized);
|
242 |
+
$this->codec = $uuid->codec;
|
243 |
+
$this->converter = $uuid->converter;
|
244 |
+
$this->fields = $uuid->fields;
|
245 |
+
}
|
246 |
+
|
247 |
+
public function compareTo(UuidInterface $other)
|
248 |
+
{
|
249 |
+
if ($this->getMostSignificantBitsHex() < $other->getMostSignificantBitsHex()) {
|
250 |
+
return -1;
|
251 |
+
}
|
252 |
+
|
253 |
+
if ($this->getMostSignificantBitsHex() > $other->getMostSignificantBitsHex()) {
|
254 |
+
return 1;
|
255 |
+
}
|
256 |
+
|
257 |
+
if ($this->getLeastSignificantBitsHex() < $other->getLeastSignificantBitsHex()) {
|
258 |
+
return -1;
|
259 |
+
}
|
260 |
+
|
261 |
+
if ($this->getLeastSignificantBitsHex() > $other->getLeastSignificantBitsHex()) {
|
262 |
+
return 1;
|
263 |
+
}
|
264 |
+
|
265 |
+
return 0;
|
266 |
+
}
|
267 |
+
|
268 |
+
public function equals($other)
|
269 |
+
{
|
270 |
+
if (!$other instanceof UuidInterface) {
|
271 |
+
return false;
|
272 |
+
}
|
273 |
+
|
274 |
+
return $this->compareTo($other) == 0;
|
275 |
+
}
|
276 |
+
|
277 |
+
public function getBytes()
|
278 |
+
{
|
279 |
+
return $this->codec->encodeBinary($this);
|
280 |
+
}
|
281 |
+
|
282 |
+
/**
|
283 |
+
* Returns the high field of the clock sequence multiplexed with the variant
|
284 |
+
* (bits 65-72 of the UUID).
|
285 |
+
*
|
286 |
+
* @return int Unsigned 8-bit integer value of clock_seq_hi_and_reserved
|
287 |
+
*/
|
288 |
+
public function getClockSeqHiAndReserved()
|
289 |
+
{
|
290 |
+
return hexdec($this->getClockSeqHiAndReservedHex());
|
291 |
+
}
|
292 |
+
|
293 |
+
public function getClockSeqHiAndReservedHex()
|
294 |
+
{
|
295 |
+
return $this->fields['clock_seq_hi_and_reserved'];
|
296 |
+
}
|
297 |
+
|
298 |
+
/**
|
299 |
+
* Returns the low field of the clock sequence (bits 73-80 of the UUID).
|
300 |
+
*
|
301 |
+
* @return int Unsigned 8-bit integer value of clock_seq_low
|
302 |
+
*/
|
303 |
+
public function getClockSeqLow()
|
304 |
+
{
|
305 |
+
return hexdec($this->getClockSeqLowHex());
|
306 |
+
}
|
307 |
+
|
308 |
+
public function getClockSeqLowHex()
|
309 |
+
{
|
310 |
+
return $this->fields['clock_seq_low'];
|
311 |
+
}
|
312 |
+
|
313 |
+
/**
|
314 |
+
* Returns the clock sequence value associated with this UUID.
|
315 |
+
*
|
316 |
+
* For UUID version 1, the clock sequence is used to help avoid
|
317 |
+
* duplicates that could arise when the clock is set backwards in time
|
318 |
+
* or if the node ID changes.
|
319 |
+
*
|
320 |
+
* For UUID version 3 or 5, the clock sequence is a 14-bit value
|
321 |
+
* constructed from a name as described in RFC 4122, Section 4.3.
|
322 |
+
*
|
323 |
+
* For UUID version 4, clock sequence is a randomly or pseudo-randomly
|
324 |
+
* generated 14-bit value as described in RFC 4122, Section 4.4.
|
325 |
+
*
|
326 |
+
* @return int Unsigned 14-bit integer value of clock sequence
|
327 |
+
* @link http://tools.ietf.org/html/rfc4122#section-4.1.5
|
328 |
+
*/
|
329 |
+
public function getClockSequence()
|
330 |
+
{
|
331 |
+
return ($this->getClockSeqHiAndReserved() & 0x3f) << 8 | $this->getClockSeqLow();
|
332 |
+
}
|
333 |
+
|
334 |
+
public function getClockSequenceHex()
|
335 |
+
{
|
336 |
+
return sprintf('%04x', $this->getClockSequence());
|
337 |
+
}
|
338 |
+
|
339 |
+
public function getNumberConverter()
|
340 |
+
{
|
341 |
+
return $this->converter;
|
342 |
+
}
|
343 |
+
|
344 |
+
/**
|
345 |
+
* @inheritdoc
|
346 |
+
*/
|
347 |
+
public function getDateTime()
|
348 |
+
{
|
349 |
+
if ($this->getVersion() != 1) {
|
350 |
+
throw new UnsupportedOperationException('Not a time-based UUID');
|
351 |
+
}
|
352 |
+
|
353 |
+
$unixTimeNanoseconds = $this->getTimestamp() - 0x01b21dd213814000;
|
354 |
+
$unixTime = ($unixTimeNanoseconds - $unixTimeNanoseconds % 1e7) / 1e7;
|
355 |
+
|
356 |
+
return new DateTime("@{$unixTime}");
|
357 |
+
}
|
358 |
+
|
359 |
+
/**
|
360 |
+
* Returns an array of the fields of this UUID, with keys named according
|
361 |
+
* to the RFC 4122 names for the fields.
|
362 |
+
*
|
363 |
+
* * **time_low**: The low field of the timestamp, an unsigned 32-bit integer
|
364 |
+
* * **time_mid**: The middle field of the timestamp, an unsigned 16-bit integer
|
365 |
+
* * **time_hi_and_version**: The high field of the timestamp multiplexed with
|
366 |
+
* the version number, an unsigned 16-bit integer
|
367 |
+
* * **clock_seq_hi_and_reserved**: The high field of the clock sequence
|
368 |
+
* multiplexed with the variant, an unsigned 8-bit integer
|
369 |
+
* * **clock_seq_low**: The low field of the clock sequence, an unsigned
|
370 |
+
* 8-bit integer
|
371 |
+
* * **node**: The spatially unique node identifier, an unsigned 48-bit
|
372 |
+
* integer
|
373 |
+
*
|
374 |
+
* @return array The UUID fields represented as integer values
|
375 |
+
* @link http://tools.ietf.org/html/rfc4122#section-4.1.2
|
376 |
+
*/
|
377 |
+
public function getFields()
|
378 |
+
{
|
379 |
+
return [
|
380 |
+
'time_low' => $this->getTimeLow(),
|
381 |
+
'time_mid' => $this->getTimeMid(),
|
382 |
+
'time_hi_and_version' => $this->getTimeHiAndVersion(),
|
383 |
+
'clock_seq_hi_and_reserved' => $this->getClockSeqHiAndReserved(),
|
384 |
+
'clock_seq_low' => $this->getClockSeqLow(),
|
385 |
+
'node' => $this->getNode(),
|
386 |
+
];
|
387 |
+
}
|
388 |
+
|
389 |
+
public function getFieldsHex()
|
390 |
+
{
|
391 |
+
return $this->fields;
|
392 |
+
}
|
393 |
+
|
394 |
+
public function getHex()
|
395 |
+
{
|
396 |
+
return str_replace('-', '', $this->toString());
|
397 |
+
}
|
398 |
+
|
399 |
+
/**
|
400 |
+
* @inheritdoc
|
401 |
+
*/
|
402 |
+
public function getInteger()
|
403 |
+
{
|
404 |
+
return $this->converter->fromHex($this->getHex());
|
405 |
+
}
|
406 |
+
|
407 |
+
/**
|
408 |
+
* Returns the least significant 64 bits of this UUID's 128 bit value.
|
409 |
+
*
|
410 |
+
* @return mixed Converted representation of the unsigned 64-bit integer value
|
411 |
+
* @throws UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present
|
412 |
+
*/
|
413 |
+
public function getLeastSignificantBits()
|
414 |
+
{
|
415 |
+
return $this->converter->fromHex($this->getLeastSignificantBitsHex());
|
416 |
+
}
|
417 |
+
|
418 |
+
public function getLeastSignificantBitsHex()
|
419 |
+
{
|
420 |
+
return sprintf(
|
421 |
+
'%02s%02s%012s',
|
422 |
+
$this->fields['clock_seq_hi_and_reserved'],
|
423 |
+
$this->fields['clock_seq_low'],
|
424 |
+
$this->fields['node']
|
425 |
+
);
|
426 |
+
}
|
427 |
+
|
428 |
+
/**
|
429 |
+
* Returns the most significant 64 bits of this UUID's 128 bit value.
|
430 |
+
*
|
431 |
+
* @return mixed Converted representation of the unsigned 64-bit integer value
|
432 |
+
* @throws UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present
|
433 |
+
*/
|
434 |
+
public function getMostSignificantBits()
|
435 |
+
{
|
436 |
+
return $this->converter->fromHex($this->getMostSignificantBitsHex());
|
437 |
+
}
|
438 |
+
|
439 |
+
public function getMostSignificantBitsHex()
|
440 |
+
{
|
441 |
+
return sprintf(
|
442 |
+
'%08s%04s%04s',
|
443 |
+
$this->fields['time_low'],
|
444 |
+
$this->fields['time_mid'],
|
445 |
+
$this->fields['time_hi_and_version']
|
446 |
+
);
|
447 |
+
}
|
448 |
+
|
449 |
+
/**
|
450 |
+
* Returns the node value associated with this UUID
|
451 |
+
*
|
452 |
+
* For UUID version 1, the node field consists of an IEEE 802 MAC
|
453 |
+
* address, usually the host address. For systems with multiple IEEE
|
454 |
+
* 802 addresses, any available one can be used. The lowest addressed
|
455 |
+
* octet (octet number 10) contains the global/local bit and the
|
456 |
+
* unicast/multicast bit, and is the first octet of the address
|
457 |
+
* transmitted on an 802.3 LAN.
|
458 |
+
*
|
459 |
+
* For systems with no IEEE address, a randomly or pseudo-randomly
|
460 |
+
* generated value may be used; see RFC 4122, Section 4.5. The
|
461 |
+
* multicast bit must be set in such addresses, in order that they
|
462 |
+
* will never conflict with addresses obtained from network cards.
|
463 |
+
*
|
464 |
+
* For UUID version 3 or 5, the node field is a 48-bit value constructed
|
465 |
+
* from a name as described in RFC 4122, Section 4.3.
|
466 |
+
*
|
467 |
+
* For UUID version 4, the node field is a randomly or pseudo-randomly
|
468 |
+
* generated 48-bit value as described in RFC 4122, Section 4.4.
|
469 |
+
*
|
470 |
+
* @return int Unsigned 48-bit integer value of node
|
471 |
+
* @link http://tools.ietf.org/html/rfc4122#section-4.1.6
|
472 |
+
*/
|
473 |
+
public function getNode()
|
474 |
+
{
|
475 |
+
return hexdec($this->getNodeHex());
|
476 |
+
}
|
477 |
+
|
478 |
+
public function getNodeHex()
|
479 |
+
{
|
480 |
+
return $this->fields['node'];
|
481 |
+
}
|
482 |
+
|
483 |
+
/**
|
484 |
+
* Returns the high field of the timestamp multiplexed with the version
|
485 |
+
* number (bits 49-64 of the UUID).
|
486 |
+
*
|
487 |
+
* @return int Unsigned 16-bit integer value of time_hi_and_version
|
488 |
+
*/
|
489 |
+
public function getTimeHiAndVersion()
|
490 |
+
{
|
491 |
+
return hexdec($this->getTimeHiAndVersionHex());
|
492 |
+
}
|
493 |
+
|
494 |
+
public function getTimeHiAndVersionHex()
|
495 |
+
{
|
496 |
+
return $this->fields['time_hi_and_version'];
|
497 |
+
}
|
498 |
+
|
499 |
+
/**
|
500 |
+
* Returns the low field of the timestamp (the first 32 bits of the UUID).
|
501 |
+
*
|
502 |
+
* @return int Unsigned 32-bit integer value of time_low
|
503 |
+
*/
|
504 |
+
public function getTimeLow()
|
505 |
+
{
|
506 |
+
return hexdec($this->getTimeLowHex());
|
507 |
+
}
|
508 |
+
|
509 |
+
public function getTimeLowHex()
|
510 |
+
{
|
511 |
+
return $this->fields['time_low'];
|
512 |
+
}
|
513 |
+
|
514 |
+
/**
|
515 |
+
* Returns the middle field of the timestamp (bits 33-48 of the UUID).
|
516 |
+
*
|
517 |
+
* @return int Unsigned 16-bit integer value of time_mid
|
518 |
+
*/
|
519 |
+
public function getTimeMid()
|
520 |
+
{
|
521 |
+
return hexdec($this->getTimeMidHex());
|
522 |
+
}
|
523 |
+
|
524 |
+
public function getTimeMidHex()
|
525 |
+
{
|
526 |
+
return $this->fields['time_mid'];
|
527 |
+
}
|
528 |
+
|
529 |
+
/**
|
530 |
+
* Returns the timestamp value associated with this UUID.
|
531 |
+
*
|
532 |
+
* The 60 bit timestamp value is constructed from the time_low,
|
533 |
+
* time_mid, and time_hi fields of this UUID. The resulting
|
534 |
+
* timestamp is measured in 100-nanosecond units since midnight,
|
535 |
+
* October 15, 1582 UTC.
|
536 |
+
*
|
537 |
+
* The timestamp value is only meaningful in a time-based UUID, which
|
538 |
+
* has version type 1. If this UUID is not a time-based UUID then
|
539 |
+
* this method throws UnsupportedOperationException.
|
540 |
+
*
|
541 |
+
* @return int Unsigned 60-bit integer value of the timestamp
|
542 |
+
* @throws UnsupportedOperationException If this UUID is not a version 1 UUID
|
543 |
+
* @link http://tools.ietf.org/html/rfc4122#section-4.1.4
|
544 |
+
*/
|
545 |
+
public function getTimestamp()
|
546 |
+
{
|
547 |
+
if ($this->getVersion() != 1) {
|
548 |
+
throw new UnsupportedOperationException('Not a time-based UUID');
|
549 |
+
}
|
550 |
+
|
551 |
+
return hexdec($this->getTimestampHex());
|
552 |
+
}
|
553 |
+
|
554 |
+
/**
|
555 |
+
* @inheritdoc
|
556 |
+
*/
|
557 |
+
public function getTimestampHex()
|
558 |
+
{
|
559 |
+
if ($this->getVersion() != 1) {
|
560 |
+
throw new UnsupportedOperationException('Not a time-based UUID');
|
561 |
+
}
|
562 |
+
|
563 |
+
return sprintf(
|
564 |
+
'%03x%04s%08s',
|
565 |
+
($this->getTimeHiAndVersion() & 0x0fff),
|
566 |
+
$this->fields['time_mid'],
|
567 |
+
$this->fields['time_low']
|
568 |
+
);
|
569 |
+
}
|
570 |
+
|
571 |
+
public function getUrn()
|
572 |
+
{
|
573 |
+
return 'urn:uuid:' . $this->toString();
|
574 |
+
}
|
575 |
+
|
576 |
+
public function getVariant()
|
577 |
+
{
|
578 |
+
$clockSeq = $this->getClockSeqHiAndReserved();
|
579 |
+
|
580 |
+
if (0 === ($clockSeq & 0x80)) {
|
581 |
+
return self::RESERVED_NCS;
|
582 |
+
}
|
583 |
+
|
584 |
+
if (0 === ($clockSeq & 0x40)) {
|
585 |
+
return self::RFC_4122;
|
586 |
+
}
|
587 |
+
|
588 |
+
if (0 === ($clockSeq & 0x20)) {
|
589 |
+
return self::RESERVED_MICROSOFT;
|
590 |
+
}
|
591 |
+
|
592 |
+
return self::RESERVED_FUTURE;
|
593 |
+
}
|
594 |
+
|
595 |
+
public function getVersion()
|
596 |
+
{
|
597 |
+
if ($this->getVariant() == self::RFC_4122) {
|
598 |
+
return (int) (($this->getTimeHiAndVersion() >> 12) & 0x0f);
|
599 |
+
}
|
600 |
+
|
601 |
+
return null;
|
602 |
+
}
|
603 |
+
|
604 |
+
public function toString()
|
605 |
+
{
|
606 |
+
return $this->codec->encode($this);
|
607 |
+
}
|
608 |
+
|
609 |
+
/**
|
610 |
+
* Returns the currently set factory used to create UUIDs.
|
611 |
+
*
|
612 |
+
* @return UuidFactoryInterface
|
613 |
+
*/
|
614 |
+
public static function getFactory()
|
615 |
+
{
|
616 |
+
if (!self::$factory) {
|
617 |
+
self::$factory = new UuidFactory();
|
618 |
+
}
|
619 |
+
|
620 |
+
return self::$factory;
|
621 |
+
}
|
622 |
+
|
623 |
+
/**
|
624 |
+
* Sets the factory used to create UUIDs.
|
625 |
+
*
|
626 |
+
* @param UuidFactoryInterface $factory
|
627 |
+
*/
|
628 |
+
public static function setFactory(UuidFactoryInterface $factory)
|
629 |
+
{
|
630 |
+
self::$factory = $factory;
|
631 |
+
}
|
632 |
+
|
633 |
+
/**
|
634 |
+
* Creates a UUID from a byte string.
|
635 |
+
*
|
636 |
+
* @param string $bytes
|
637 |
+
* @return UuidInterface
|
638 |
+
* @throws InvalidUuidStringException
|
639 |
+
* @throws InvalidArgumentException
|
640 |
+
*/
|
641 |
+
public static function fromBytes($bytes)
|
642 |
+
{
|
643 |
+
return self::getFactory()->fromBytes($bytes);
|
644 |
+
}
|
645 |
+
|
646 |
+
/**
|
647 |
+
* Creates a UUID from the string standard representation.
|
648 |
+
*
|
649 |
+
* @param string $name A string that specifies a UUID
|
650 |
+
* @return UuidInterface
|
651 |
+
* @throws InvalidUuidStringException
|
652 |
+
*/
|
653 |
+
public static function fromString($name)
|
654 |
+
{
|
655 |
+
return self::getFactory()->fromString($name);
|
656 |
+
}
|
657 |
+
|
658 |
+
/**
|
659 |
+
* Creates a UUID from a 128-bit integer string.
|
660 |
+
*
|
661 |
+
* @param string $integer String representation of 128-bit integer
|
662 |
+
* @return UuidInterface
|
663 |
+
* @throws UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present
|
664 |
+
* @throws InvalidUuidStringException
|
665 |
+
*/
|
666 |
+
public static function fromInteger($integer)
|
667 |
+
{
|
668 |
+
return self::getFactory()->fromInteger($integer);
|
669 |
+
}
|
670 |
+
|
671 |
+
/**
|
672 |
+
* Check if a string is a valid UUID.
|
673 |
+
*
|
674 |
+
* @param string $uuid The string UUID to test
|
675 |
+
* @return boolean
|
676 |
+
*/
|
677 |
+
public static function isValid($uuid)
|
678 |
+
{
|
679 |
+
$uuid = str_replace(['urn:', 'uuid:', 'URN:', 'UUID:', '{', '}'], '', $uuid);
|
680 |
+
|
681 |
+
if ($uuid == self::NIL) {
|
682 |
+
return true;
|
683 |
+
}
|
684 |
+
|
685 |
+
if (!preg_match('/' . self::VALID_PATTERN . '/D', $uuid)) {
|
686 |
+
return false;
|
687 |
+
}
|
688 |
+
|
689 |
+
return true;
|
690 |
+
}
|
691 |
+
|
692 |
+
/**
|
693 |
+
* Generate a version 1 UUID from a host ID, sequence number, and the current time.
|
694 |
+
*
|
695 |
+
* @param int|string $node A 48-bit number representing the hardware address
|
696 |
+
* This number may be represented as an integer or a hexadecimal string.
|
697 |
+
* @param int $clockSeq A 14-bit number used to help avoid duplicates that
|
698 |
+
* could arise when the clock is set backwards in time or if the node ID
|
699 |
+
* changes.
|
700 |
+
* @return UuidInterface
|
701 |
+
* @throws UnsatisfiedDependencyException if called on a 32-bit system and
|
702 |
+
* `Moontoast\Math\BigNumber` is not present
|
703 |
+
* @throws InvalidArgumentException
|
704 |
+
* @throws Exception if it was not possible to gather sufficient entropy
|
705 |
+
*/
|
706 |
+
public static function uuid1($node = null, $clockSeq = null)
|
707 |
+
{
|
708 |
+
return self::getFactory()->uuid1($node, $clockSeq);
|
709 |
+
}
|
710 |
+
|
711 |
+
/**
|
712 |
+
* Generate a version 3 UUID based on the MD5 hash of a namespace identifier
|
713 |
+
* (which is a UUID) and a name (which is a string).
|
714 |
+
*
|
715 |
+
* @param string|UuidInterface $ns The UUID namespace in which to create the named UUID
|
716 |
+
* @param string $name The name to create a UUID for
|
717 |
+
* @return UuidInterface
|
718 |
+
* @throws InvalidUuidStringException
|
719 |
+
*/
|
720 |
+
public static function uuid3($ns, $name)
|
721 |
+
{
|
722 |
+
return self::getFactory()->uuid3($ns, $name);
|
723 |
+
}
|
724 |
+
|
725 |
+
/**
|
726 |
+
* Generate a version 4 (random) UUID.
|
727 |
+
*
|
728 |
+
* @return UuidInterface
|
729 |
+
* @throws UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present
|
730 |
+
* @throws InvalidArgumentException
|
731 |
+
* @throws Exception
|
732 |
+
*/
|
733 |
+
public static function uuid4()
|
734 |
+
{
|
735 |
+
return self::getFactory()->uuid4();
|
736 |
+
}
|
737 |
+
|
738 |
+
/**
|
739 |
+
* Generate a version 5 UUID based on the SHA-1 hash of a namespace
|
740 |
+
* identifier (which is a UUID) and a name (which is a string).
|
741 |
+
*
|
742 |
+
* @param string|UuidInterface $ns The UUID namespace in which to create the named UUID
|
743 |
+
* @param string $name The name to create a UUID for
|
744 |
+
* @return UuidInterface
|
745 |
+
* @throws InvalidUuidStringException
|
746 |
+
*/
|
747 |
+
public static function uuid5($ns, $name)
|
748 |
+
{
|
749 |
+
return self::getFactory()->uuid5($ns, $name);
|
750 |
+
}
|
751 |
+
}
|
src/lib/vendor/ramsey/uuid/src/UuidFactory.php
ADDED
@@ -0,0 +1,315 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid;
|
16 |
+
|
17 |
+
use Ramsey\Uuid\Converter\NumberConverterInterface;
|
18 |
+
use Ramsey\Uuid\Exception\InvalidUuidStringException;
|
19 |
+
use Ramsey\Uuid\Provider\NodeProviderInterface;
|
20 |
+
use Ramsey\Uuid\Generator\RandomGeneratorInterface;
|
21 |
+
use Ramsey\Uuid\Generator\TimeGeneratorInterface;
|
22 |
+
use Ramsey\Uuid\Codec\CodecInterface;
|
23 |
+
use Ramsey\Uuid\Builder\UuidBuilderInterface;
|
24 |
+
|
25 |
+
class UuidFactory implements UuidFactoryInterface
|
26 |
+
{
|
27 |
+
/**
|
28 |
+
* @var CodecInterface
|
29 |
+
*/
|
30 |
+
private $codec = null;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @var NodeProviderInterface
|
34 |
+
*/
|
35 |
+
private $nodeProvider = null;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @var NumberConverterInterface
|
39 |
+
*/
|
40 |
+
private $numberConverter = null;
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @var RandomGeneratorInterface
|
44 |
+
*/
|
45 |
+
private $randomGenerator = null;
|
46 |
+
|
47 |
+
/**
|
48 |
+
* @var TimeGeneratorInterface
|
49 |
+
*/
|
50 |
+
private $timeGenerator = null;
|
51 |
+
|
52 |
+
/**
|
53 |
+
* @var UuidBuilderInterface
|
54 |
+
*/
|
55 |
+
private $uuidBuilder = null;
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Constructs a `UuidFactory` for creating `Ramsey\Uuid\UuidInterface` instances
|
59 |
+
*
|
60 |
+
* @param FeatureSet $features A set of features for use when creating UUIDs
|
61 |
+
*/
|
62 |
+
public function __construct(FeatureSet $features = null)
|
63 |
+
{
|
64 |
+
$features = $features ?: new FeatureSet();
|
65 |
+
|
66 |
+
$this->codec = $features->getCodec();
|
67 |
+
$this->nodeProvider = $features->getNodeProvider();
|
68 |
+
$this->numberConverter = $features->getNumberConverter();
|
69 |
+
$this->randomGenerator = $features->getRandomGenerator();
|
70 |
+
$this->timeGenerator = $features->getTimeGenerator();
|
71 |
+
$this->uuidBuilder = $features->getBuilder();
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Returns the UUID coder-decoder used by this factory
|
76 |
+
*
|
77 |
+
* @return CodecInterface
|
78 |
+
*/
|
79 |
+
public function getCodec()
|
80 |
+
{
|
81 |
+
return $this->codec;
|
82 |
+
}
|
83 |
+
|
84 |
+
/**
|
85 |
+
* Sets the UUID coder-decoder used by this factory
|
86 |
+
*
|
87 |
+
* @param CodecInterface $codec
|
88 |
+
*/
|
89 |
+
public function setCodec(CodecInterface $codec)
|
90 |
+
{
|
91 |
+
$this->codec = $codec;
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Returns the system node ID provider used by this factory
|
96 |
+
*
|
97 |
+
* @return NodeProviderInterface
|
98 |
+
*/
|
99 |
+
public function getNodeProvider()
|
100 |
+
{
|
101 |
+
return $this->nodeProvider;
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Returns the random UUID generator used by this factory
|
106 |
+
*
|
107 |
+
* @return RandomGeneratorInterface
|
108 |
+
*/
|
109 |
+
public function getRandomGenerator()
|
110 |
+
{
|
111 |
+
return $this->randomGenerator;
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Returns the time-based UUID generator used by this factory
|
116 |
+
*
|
117 |
+
* @return TimeGeneratorInterface
|
118 |
+
*/
|
119 |
+
public function getTimeGenerator()
|
120 |
+
{
|
121 |
+
return $this->timeGenerator;
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Sets the time-based UUID generator this factory will use to generate version 1 UUIDs
|
126 |
+
*
|
127 |
+
* @param TimeGeneratorInterface $generator
|
128 |
+
*/
|
129 |
+
public function setTimeGenerator(TimeGeneratorInterface $generator)
|
130 |
+
{
|
131 |
+
$this->timeGenerator = $generator;
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Returns the number converter used by this factory
|
136 |
+
*
|
137 |
+
* @return NumberConverterInterface
|
138 |
+
*/
|
139 |
+
public function getNumberConverter()
|
140 |
+
{
|
141 |
+
return $this->numberConverter;
|
142 |
+
}
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Sets the random UUID generator this factory will use to generate version 4 UUIDs
|
146 |
+
*
|
147 |
+
* @param RandomGeneratorInterface $generator
|
148 |
+
*/
|
149 |
+
public function setRandomGenerator(RandomGeneratorInterface $generator)
|
150 |
+
{
|
151 |
+
$this->randomGenerator = $generator;
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Sets the number converter this factory will use
|
156 |
+
*
|
157 |
+
* @param NumberConverterInterface $converter
|
158 |
+
*/
|
159 |
+
public function setNumberConverter(NumberConverterInterface $converter)
|
160 |
+
{
|
161 |
+
$this->numberConverter = $converter;
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Returns the UUID builder this factory uses when creating `Uuid` instances
|
166 |
+
*
|
167 |
+
* @return UuidBuilderInterface $builder
|
168 |
+
*/
|
169 |
+
public function getUuidBuilder()
|
170 |
+
{
|
171 |
+
return $this->uuidBuilder;
|
172 |
+
}
|
173 |
+
|
174 |
+
/**
|
175 |
+
* Sets the UUID builder this factory will use when creating `Uuid` instances
|
176 |
+
*
|
177 |
+
* @param UuidBuilderInterface $builder
|
178 |
+
*/
|
179 |
+
public function setUuidBuilder(UuidBuilderInterface $builder)
|
180 |
+
{
|
181 |
+
$this->uuidBuilder = $builder;
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* @inheritdoc
|
186 |
+
*/
|
187 |
+
public function fromBytes($bytes)
|
188 |
+
{
|
189 |
+
return $this->codec->decodeBytes($bytes);
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* @inheritdoc
|
194 |
+
*/
|
195 |
+
public function fromString($uuid)
|
196 |
+
{
|
197 |
+
$uuid = strtolower($uuid);
|
198 |
+
return $this->codec->decode($uuid);
|
199 |
+
}
|
200 |
+
|
201 |
+
/**
|
202 |
+
* @inheritdoc
|
203 |
+
*/
|
204 |
+
public function fromInteger($integer)
|
205 |
+
{
|
206 |
+
$hex = $this->numberConverter->toHex($integer);
|
207 |
+
$hex = str_pad($hex, 32, '0', STR_PAD_LEFT);
|
208 |
+
|
209 |
+
return $this->fromString($hex);
|
210 |
+
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* @inheritdoc
|
214 |
+
*/
|
215 |
+
public function uuid1($node = null, $clockSeq = null)
|
216 |
+
{
|
217 |
+
$bytes = $this->timeGenerator->generate($node, $clockSeq);
|
218 |
+
$hex = bin2hex($bytes);
|
219 |
+
|
220 |
+
return $this->uuidFromHashedName($hex, 1);
|
221 |
+
}
|
222 |
+
|
223 |
+
/**
|
224 |
+
* @inheritdoc
|
225 |
+
*/
|
226 |
+
public function uuid3($ns, $name)
|
227 |
+
{
|
228 |
+
return $this->uuidFromNsAndName($ns, $name, 3, 'md5');
|
229 |
+
}
|
230 |
+
|
231 |
+
/**
|
232 |
+
* @inheritdoc
|
233 |
+
*/
|
234 |
+
public function uuid4()
|
235 |
+
{
|
236 |
+
$bytes = $this->randomGenerator->generate(16);
|
237 |
+
|
238 |
+
// When converting the bytes to hex, it turns into a 32-character
|
239 |
+
// hexadecimal string that looks a lot like an MD5 hash, so at this
|
240 |
+
// point, we can just pass it to uuidFromHashedName.
|
241 |
+
$hex = bin2hex($bytes);
|
242 |
+
|
243 |
+
return $this->uuidFromHashedName($hex, 4);
|
244 |
+
}
|
245 |
+
|
246 |
+
/**
|
247 |
+
* @inheritdoc
|
248 |
+
*/
|
249 |
+
public function uuid5($ns, $name)
|
250 |
+
{
|
251 |
+
return $this->uuidFromNsAndName($ns, $name, 5, 'sha1');
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Returns a `Uuid`
|
256 |
+
*
|
257 |
+
* Uses the configured builder and codec and the provided array of hexadecimal
|
258 |
+
* value UUID fields to construct a `Uuid` object.
|
259 |
+
*
|
260 |
+
* @param array $fields An array of fields from which to construct a UUID;
|
261 |
+
* see {@see \Ramsey\Uuid\UuidInterface::getFieldsHex()} for array structure.
|
262 |
+
* @return UuidInterface
|
263 |
+
*/
|
264 |
+
public function uuid(array $fields)
|
265 |
+
{
|
266 |
+
return $this->uuidBuilder->build($this->codec, $fields);
|
267 |
+
}
|
268 |
+
|
269 |
+
/**
|
270 |
+
* Returns a version 3 or 5 namespaced `Uuid`
|
271 |
+
*
|
272 |
+
* @param string|UuidInterface $ns The UUID namespace to use
|
273 |
+
* @param string $name The string to hash together with the namespace
|
274 |
+
* @param int $version The version of UUID to create (3 or 5)
|
275 |
+
* @param string $hashFunction The hash function to use when hashing together
|
276 |
+
* the namespace and name
|
277 |
+
* @return UuidInterface
|
278 |
+
* @throws InvalidUuidStringException
|
279 |
+
*/
|
280 |
+
protected function uuidFromNsAndName($ns, $name, $version, $hashFunction)
|
281 |
+
{
|
282 |
+
if (!($ns instanceof UuidInterface)) {
|
283 |
+
$ns = $this->codec->decode($ns);
|
284 |
+
}
|
285 |
+
|
286 |
+
$hash = call_user_func($hashFunction, ($ns->getBytes() . $name));
|
287 |
+
|
288 |
+
return $this->uuidFromHashedName($hash, $version);
|
289 |
+
}
|
290 |
+
|
291 |
+
/**
|
292 |
+
* Returns a `Uuid` created from `$hash` with the version field set to `$version`
|
293 |
+
* and the variant field set for RFC 4122
|
294 |
+
*
|
295 |
+
* @param string $hash The hash to use when creating the UUID
|
296 |
+
* @param int $version The UUID version to set for this hash (1, 3, 4, or 5)
|
297 |
+
* @return UuidInterface
|
298 |
+
*/
|
299 |
+
protected function uuidFromHashedName($hash, $version)
|
300 |
+
{
|
301 |
+
$timeHi = BinaryUtils::applyVersion(substr($hash, 12, 4), $version);
|
302 |
+
$clockSeqHi = BinaryUtils::applyVariant(hexdec(substr($hash, 16, 2)));
|
303 |
+
|
304 |
+
$fields = [
|
305 |
+
'time_low' => substr($hash, 0, 8),
|
306 |
+
'time_mid' => substr($hash, 8, 4),
|
307 |
+
'time_hi_and_version' => str_pad(dechex($timeHi), 4, '0', STR_PAD_LEFT),
|
308 |
+
'clock_seq_hi_and_reserved' => str_pad(dechex($clockSeqHi), 2, '0', STR_PAD_LEFT),
|
309 |
+
'clock_seq_low' => substr($hash, 18, 2),
|
310 |
+
'node' => substr($hash, 20, 12),
|
311 |
+
];
|
312 |
+
|
313 |
+
return $this->uuid($fields);
|
314 |
+
}
|
315 |
+
}
|
src/lib/vendor/ramsey/uuid/src/UuidFactoryInterface.php
ADDED
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid;
|
16 |
+
|
17 |
+
use Exception;
|
18 |
+
use InvalidArgumentException;
|
19 |
+
use Ramsey\Uuid\Exception\InvalidUuidStringException;
|
20 |
+
use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* UuidFactoryInterface defines common functionality all `UuidFactory` instances
|
24 |
+
* must implement
|
25 |
+
*/
|
26 |
+
interface UuidFactoryInterface
|
27 |
+
{
|
28 |
+
/**
|
29 |
+
* Generate a version 1 UUID from a host ID, sequence number, and the current time.
|
30 |
+
*
|
31 |
+
* @param int|string|null $node A 48-bit number representing the hardware address
|
32 |
+
* This number may be represented as an integer or a hexadecimal string.
|
33 |
+
* @param int|null $clockSeq A 14-bit number used to help avoid duplicates that
|
34 |
+
* could arise when the clock is set backwards in time or if the node ID
|
35 |
+
* changes.
|
36 |
+
* @return UuidInterface
|
37 |
+
* @throws UnsatisfiedDependencyException if called on a 32-bit system and
|
38 |
+
* `Moontoast\Math\BigNumber` is not present
|
39 |
+
* @throws InvalidArgumentException
|
40 |
+
* @throws Exception if it was not possible to gather sufficient entropy
|
41 |
+
*/
|
42 |
+
public function uuid1($node = null, $clockSeq = null);
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Generate a version 3 UUID based on the MD5 hash of a namespace identifier
|
46 |
+
* (which is a UUID) and a name (which is a string).
|
47 |
+
*
|
48 |
+
* @param string|UuidInterface $ns The UUID namespace in which to create the named UUID
|
49 |
+
* @param string $name The name to create a UUID for
|
50 |
+
* @return UuidInterface
|
51 |
+
* @throws InvalidUuidStringException
|
52 |
+
*/
|
53 |
+
public function uuid3($ns, $name);
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Generate a version 4 (random) UUID.
|
57 |
+
*
|
58 |
+
* @return UuidInterface
|
59 |
+
* @throws UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present
|
60 |
+
* @throws InvalidArgumentException
|
61 |
+
* @throws Exception
|
62 |
+
*/
|
63 |
+
public function uuid4();
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Generate a version 5 UUID based on the SHA-1 hash of a namespace
|
67 |
+
* identifier (which is a UUID) and a name (which is a string).
|
68 |
+
*
|
69 |
+
* @param string|UuidInterface $ns The UUID namespace in which to create the named UUID
|
70 |
+
* @param string $name The name to create a UUID for
|
71 |
+
* @return UuidInterface
|
72 |
+
* @throws InvalidUuidStringException
|
73 |
+
*/
|
74 |
+
public function uuid5($ns, $name);
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Creates a UUID from a byte string.
|
78 |
+
*
|
79 |
+
* @param string $bytes A 16-byte string representation of a UUID
|
80 |
+
* @return UuidInterface
|
81 |
+
* @throws InvalidUuidStringException
|
82 |
+
* @throws InvalidArgumentException if string has not 16 characters
|
83 |
+
*/
|
84 |
+
public function fromBytes($bytes);
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Creates a UUID from the string standard representation
|
88 |
+
*
|
89 |
+
* @param string $uuid A string representation of a UUID
|
90 |
+
* @return UuidInterface
|
91 |
+
* @throws InvalidUuidStringException
|
92 |
+
*/
|
93 |
+
public function fromString($uuid);
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Creates a `Uuid` from an integer representation
|
97 |
+
*
|
98 |
+
* The integer representation may be a real integer, a string integer, or
|
99 |
+
* an integer representation supported by a configured number converter.
|
100 |
+
*
|
101 |
+
* @param mixed $integer The integer to use when creating a `Uuid` from an
|
102 |
+
* integer; may be of any type understood by the configured number converter
|
103 |
+
* @return UuidInterface
|
104 |
+
* @throws UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present
|
105 |
+
* @throws InvalidUuidStringException
|
106 |
+
*/
|
107 |
+
public function fromInteger($integer);
|
108 |
+
}
|
src/lib/vendor/ramsey/uuid/src/UuidInterface.php
ADDED
@@ -0,0 +1,274 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* This file is part of the ramsey/uuid library
|
4 |
+
*
|
5 |
+
* For the full copyright and license information, please view the LICENSE
|
6 |
+
* file that was distributed with this source code.
|
7 |
+
*
|
8 |
+
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
|
9 |
+
* @license http://opensource.org/licenses/MIT MIT
|
10 |
+
* @link https://benramsey.com/projects/ramsey-uuid/ Documentation
|
11 |
+
* @link https://packagist.org/packages/ramsey/uuid Packagist
|
12 |
+
* @link https://github.com/ramsey/uuid GitHub
|
13 |
+
*/
|
14 |
+
|
15 |
+
namespace Ramsey\Uuid;
|
16 |
+
|
17 |
+
use DateTime;
|
18 |
+
use JsonSerializable;
|
19 |
+
use Ramsey\Uuid\Converter\NumberConverterInterface;
|
20 |
+
use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
|
21 |
+
use Ramsey\Uuid\Exception\UnsupportedOperationException;
|
22 |
+
use Serializable;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* UuidInterface defines common functionality for all universally unique
|
26 |
+
* identifiers (UUIDs)
|
27 |
+
*/
|
28 |
+
interface UuidInterface extends JsonSerializable, Serializable
|
29 |
+
{
|
30 |
+
/**
|
31 |
+
* Compares this UUID to the specified UUID.
|
32 |
+
*
|
33 |
+
* The first of two UUIDs is greater than the second if the most
|
34 |
+
* significant field in which the UUIDs differ is greater for the first
|
35 |
+
* UUID.
|
36 |
+
*
|
37 |
+
* * Q. What's the value of being able to sort UUIDs?
|
38 |
+
* * A. Use them as keys in a B-Tree or similar mapping.
|
39 |
+
*
|
40 |
+
* @param UuidInterface $other UUID to which this UUID is compared
|
41 |
+
* @return int -1, 0 or 1 as this UUID is less than, equal to, or greater than `$uuid`
|
42 |
+
*/
|
43 |
+
public function compareTo(UuidInterface $other);
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Compares this object to the specified object.
|
47 |
+
*
|
48 |
+
* The result is true if and only if the argument is not null, is a UUID
|
49 |
+
* object, has the same variant, and contains the same value, bit for bit,
|
50 |
+
* as this UUID.
|
51 |
+
*
|
52 |
+
* @param object $other
|
53 |
+
* @return bool True if `$other` is equal to this UUID
|
54 |
+
*/
|
55 |
+
public function equals($other);
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Returns the UUID as a 16-byte string (containing the six integer fields
|
59 |
+
* in big-endian byte order).
|
60 |
+
*
|
61 |
+
* @return string
|
62 |
+
*/
|
63 |
+
public function getBytes();
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Returns the number converter to use for converting hex values to/from integers.
|
67 |
+
*
|
68 |
+
* @return NumberConverterInterface
|
69 |
+
*/
|
70 |
+
public function getNumberConverter();
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Returns the hexadecimal value of the UUID.
|
74 |
+
*
|
75 |
+
* @return string
|
76 |
+
*/
|
77 |
+
public function getHex();
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Returns an array of the fields of this UUID, with keys named according
|
81 |
+
* to the RFC 4122 names for the fields.
|
82 |
+
*
|
83 |
+
* * **time_low**: The low field of the timestamp, an unsigned 32-bit integer
|
84 |
+
* * **time_mid**: The middle field of the timestamp, an unsigned 16-bit integer
|
85 |
+
* * **time_hi_and_version**: The high field of the timestamp multiplexed with
|
86 |
+
* the version number, an unsigned 16-bit integer
|
87 |
+
* * **clock_seq_hi_and_reserved**: The high field of the clock sequence
|
88 |
+
* multiplexed with the variant, an unsigned 8-bit integer
|
89 |
+
* * **clock_seq_low**: The low field of the clock sequence, an unsigned
|
90 |
+
* 8-bit integer
|
91 |
+
* * **node**: The spatially unique node identifier, an unsigned 48-bit
|
92 |
+
* integer
|
93 |
+
*
|
94 |
+
* @return array The UUID fields represented as hexadecimal values
|
95 |
+
*/
|
96 |
+
public function getFieldsHex();
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Returns the high field of the clock sequence multiplexed with the variant
|
100 |
+
* (bits 65-72 of the UUID).
|
101 |
+
*
|
102 |
+
* @return string Hexadecimal value of clock_seq_hi_and_reserved
|
103 |
+
*/
|
104 |
+
public function getClockSeqHiAndReservedHex();
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Returns the low field of the clock sequence (bits 73-80 of the UUID).
|
108 |
+
*
|
109 |
+
* @return string Hexadecimal value of clock_seq_low
|
110 |
+
*/
|
111 |
+
public function getClockSeqLowHex();
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Returns the clock sequence value associated with this UUID.
|
115 |
+
*
|
116 |
+
* @return string Hexadecimal value of clock sequence
|
117 |
+
*/
|
118 |
+
public function getClockSequenceHex();
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Returns a PHP `DateTime` object representing the timestamp associated
|
122 |
+
* with this UUID.
|
123 |
+
*
|
124 |
+
* The timestamp value is only meaningful in a time-based UUID, which
|
125 |
+
* has version type 1. If this UUID is not a time-based UUID then
|
126 |
+
* this method throws `UnsupportedOperationException`.
|
127 |
+
*
|
128 |
+
* @return DateTime A PHP DateTime representation of the date
|
129 |
+
* @throws UnsupportedOperationException If this UUID is not a version 1 UUID
|
130 |
+
* @throws UnsatisfiedDependencyException if called in a 32-bit system and
|
131 |
+
* `Moontoast\Math\BigNumber` is not present
|
132 |
+
*/
|
133 |
+
public function getDateTime();
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Returns the integer value of the UUID, converted to an appropriate number
|
137 |
+
* representation.
|
138 |
+
*
|
139 |
+
* @return mixed Converted representation of the unsigned 128-bit integer value
|
140 |
+
* @throws UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present
|
141 |
+
*/
|
142 |
+
public function getInteger();
|
143 |
+
|
144 |
+
/**
|
145 |
+
* Returns the least significant 64 bits of this UUID's 128 bit value.
|
146 |
+
*
|
147 |
+
* @return string Hexadecimal value of least significant bits
|
148 |
+
*/
|
149 |
+
public function getLeastSignificantBitsHex();
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Returns the most significant 64 bits of this UUID's 128 bit value.
|
153 |
+
*
|
154 |
+
* @return string Hexadecimal value of most significant bits
|
155 |
+
*/
|
156 |
+
public function getMostSignificantBitsHex();
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Returns the node value associated with this UUID
|
160 |
+
*
|
161 |
+
* For UUID version 1, the node field consists of an IEEE 802 MAC
|
162 |
+
* address, usually the host address. For systems with multiple IEEE
|
163 |
+
* 802 addresses, any available one can be used. The lowest addressed
|
164 |
+
* octet (octet number 10) contains the global/local bit and the
|
165 |
+
* unicast/multicast bit, and is the first octet of the address
|
166 |
+
* transmitted on an 802.3 LAN.
|
167 |
+
*
|
168 |
+
* For systems with no IEEE address, a randomly or pseudo-randomly
|
169 |
+
* generated value may be used; see RFC 4122, Section 4.5. The
|
170 |
+
* multicast bit must be set in such addresses, in order that they
|
171 |
+
* will never conflict with addresses obtained from network cards.
|
172 |
+
*
|
173 |
+
* For UUID version 3 or 5, the node field is a 48-bit value constructed
|
174 |
+
* from a name as described in RFC 4122, Section 4.3.
|
175 |
+
*
|
176 |
+
* For UUID version 4, the node field is a randomly or pseudo-randomly
|
177 |
+
* generated 48-bit value as described in RFC 4122, Section 4.4.
|
178 |
+
*
|
179 |
+
* @return string Hexadecimal value of node
|
180 |
+
* @link http://tools.ietf.org/html/rfc4122#section-4.1.6
|
181 |
+
*/
|
182 |
+
public function getNodeHex();
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Returns the high field of the timestamp multiplexed with the version
|
186 |
+
* number (bits 49-64 of the UUID).
|
187 |
+
*
|
188 |
+
* @return string Hexadecimal value of time_hi_and_version
|
189 |
+
*/
|
190 |
+
public function getTimeHiAndVersionHex();
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Returns the low field of the timestamp (the first 32 bits of the UUID).
|
194 |
+
*
|
195 |
+
* @return string Hexadecimal value of time_low
|
196 |
+
*/
|
197 |
+
public function getTimeLowHex();
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Returns the middle field of the timestamp (bits 33-48 of the UUID).
|
201 |
+
*
|
202 |
+
* @return string Hexadecimal value of time_mid
|
203 |
+
*/
|
204 |
+
public function getTimeMidHex();
|
205 |
+
|
206 |
+
/**
|
207 |
+
* Returns the timestamp value associated with this UUID.
|
208 |
+
*
|
209 |
+
* The 60 bit timestamp value is constructed from the time_low,
|
210 |
+
* time_mid, and time_hi fields of this UUID. The resulting
|
211 |
+
* timestamp is measured in 100-nanosecond units since midnight,
|
212 |
+
* October 15, 1582 UTC.
|
213 |
+
*
|
214 |
+
* The timestamp value is only meaningful in a time-based UUID, which
|
215 |
+
* has version type 1. If this UUID is not a time-based UUID then
|
216 |
+
* this method throws UnsupportedOperationException.
|
217 |
+
*
|
218 |
+
* @return string Hexadecimal value of the timestamp
|
219 |
+
* @throws UnsupportedOperationException If this UUID is not a version 1 UUID
|
220 |
+
* @link http://tools.ietf.org/html/rfc4122#section-4.1.4
|
221 |
+
*/
|
222 |
+
public function getTimestampHex();
|
223 |
+
|
224 |
+
/**
|
225 |
+
* Returns the string representation of the UUID as a URN.
|
226 |
+
*
|
227 |
+
* @return string
|
228 |
+
* @link http://en.wikipedia.org/wiki/Uniform_Resource_Name
|
229 |
+
*/
|
230 |
+
public function getUrn();
|
231 |
+
|
232 |
+
/**
|
233 |
+
* Returns the variant number associated with this UUID.
|
234 |
+
*
|
235 |
+
* The variant number describes the layout of the UUID. The variant
|
236 |
+
* number has the following meaning:
|
237 |
+
*
|
238 |
+
* * 0 - Reserved for NCS backward compatibility
|
239 |
+
* * 2 - The RFC 4122 variant (used by this class)
|
240 |
+
* * 6 - Reserved, Microsoft Corporation backward compatibility
|
241 |
+
* * 7 - Reserved for future definition
|
242 |
+
*
|
243 |
+
* @return int
|
244 |
+
* @link http://tools.ietf.org/html/rfc4122#section-4.1.1
|
245 |
+
*/
|
246 |
+
public function getVariant();
|
247 |
+
|
248 |
+
/**
|
249 |
+
* Returns the version number associated with this UUID.
|
250 |
+
*
|
251 |
+
* The version number describes how this UUID was generated and has the
|
252 |
+
* following meaning:
|
253 |
+
*
|
254 |
+
* * 1 - Time-based UUID
|
255 |
+
* * 2 - DCE security UUID
|
256 |
+
* * 3 - Name-based UUID hashed with MD5
|
257 |
+
* * 4 - Randomly generated UUID
|
258 |
+
* * 5 - Name-based UUID hashed with SHA-1
|
259 |
+
*
|
260 |
+
* Returns null if this UUID is not an RFC 4122 variant, since version
|
261 |
+
* is only meaningful for this variant.
|
262 |
+
*
|
263 |
+
* @return int|null
|
264 |
+
* @link http://tools.ietf.org/html/rfc4122#section-4.1.3
|
265 |
+
*/
|
266 |
+
public function getVersion();
|
267 |
+
|
268 |
+
/**
|
269 |
+
* Converts this UUID into a string representation.
|
270 |
+
*
|
271 |
+
* @return string
|
272 |
+
*/
|
273 |
+
public function toString();
|
274 |
+
}
|
src/lib/vendor/ramsey/uuid/src/functions.php
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 <ben@benramsey.com>
|
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 |
+
}
|
src/lib/vendor/symfony/polyfill-ctype/bootstrap.php
CHANGED
@@ -13,14 +13,34 @@ use Symfony\Polyfill\Ctype as p;
|
|
13 |
|
14 |
if (!function_exists('ctype_alnum')) {
|
15 |
function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); }
|
|
|
|
|
16 |
function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); }
|
|
|
|
|
17 |
function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); }
|
|
|
|
|
18 |
function ctype_digit($text) { return p\Ctype::ctype_digit($text); }
|
|
|
|
|
19 |
function ctype_graph($text) { return p\Ctype::ctype_graph($text); }
|
|
|
|
|
20 |
function ctype_lower($text) { return p\Ctype::ctype_lower($text); }
|
|
|
|
|
21 |
function ctype_print($text) { return p\Ctype::ctype_print($text); }
|
|
|
|
|
22 |
function ctype_punct($text) { return p\Ctype::ctype_punct($text); }
|
|
|
|
|
23 |
function ctype_space($text) { return p\Ctype::ctype_space($text); }
|
|
|
|
|
24 |
function ctype_upper($text) { return p\Ctype::ctype_upper($text); }
|
|
|
|
|
25 |
function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); }
|
26 |
}
|
13 |
|
14 |
if (!function_exists('ctype_alnum')) {
|
15 |
function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); }
|
16 |
+
}
|
17 |
+
if (!function_exists('ctype_alpha')) {
|
18 |
function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); }
|
19 |
+
}
|
20 |
+
if (!function_exists('ctype_cntrl')) {
|
21 |
function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); }
|
22 |
+
}
|
23 |
+
if (!function_exists('ctype_digit')) {
|
24 |
function ctype_digit($text) { return p\Ctype::ctype_digit($text); }
|
25 |
+
}
|
26 |
+
if (!function_exists('ctype_graph')) {
|
27 |
function ctype_graph($text) { return p\Ctype::ctype_graph($text); }
|
28 |
+
}
|
29 |
+
if (!function_exists('ctype_lower')) {
|
30 |
function ctype_lower($text) { return p\Ctype::ctype_lower($text); }
|
31 |
+
}
|
32 |
+
if (!function_exists('ctype_print')) {
|
33 |
function ctype_print($text) { return p\Ctype::ctype_print($text); }
|
34 |
+
}
|
35 |
+
if (!function_exists('ctype_punct')) {
|
36 |
function ctype_punct($text) { return p\Ctype::ctype_punct($text); }
|
37 |
+
}
|
38 |
+
if (!function_exists('ctype_space')) {
|
39 |
function ctype_space($text) { return p\Ctype::ctype_space($text); }
|
40 |
+
}
|
41 |
+
if (!function_exists('ctype_upper')) {
|
42 |
function ctype_upper($text) { return p\Ctype::ctype_upper($text); }
|
43 |
+
}
|
44 |
+
if (!function_exists('ctype_xdigit')) {
|
45 |
function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); }
|
46 |
}
|
src/lib/vendor/symfony/polyfill-mbstring/bootstrap.php
CHANGED
@@ -11,54 +11,131 @@
|
|
11 |
|
12 |
use Symfony\Polyfill\Mbstring as p;
|
13 |
|
14 |
-
if (!
|
15 |
-
define('MB_CASE_UPPER', 0);
|
16 |
-
define('MB_CASE_LOWER', 1);
|
17 |
-
define('MB_CASE_TITLE', 2);
|
18 |
-
}
|
19 |
-
|
20 |
-
if (!function_exists('mb_strlen')) {
|
21 |
function mb_convert_encoding($s, $to, $from = null) { return p\Mbstring::mb_convert_encoding($s, $to, $from); }
|
|
|
|
|
22 |
function mb_decode_mimeheader($s) { return p\Mbstring::mb_decode_mimeheader($s); }
|
|
|
|
|
23 |
function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); }
|
|
|
|
|
24 |
function mb_decode_numericentity($s, $convmap, $enc = null) { return p\Mbstring::mb_decode_numericentity($s, $convmap, $enc); }
|
|
|
|
|
25 |
function mb_encode_numericentity($s, $convmap, $enc = null, $is_hex = false) { return p\Mbstring::mb_encode_numericentity($s, $convmap, $enc, $is_hex); }
|
|
|
|
|
26 |
function mb_convert_case($s, $mode, $enc = null) { return p\Mbstring::mb_convert_case($s, $mode, $enc); }
|
|
|
|
|
27 |
function mb_internal_encoding($enc = null) { return p\Mbstring::mb_internal_encoding($enc); }
|
|
|
|
|
28 |
function mb_language($lang = null) { return p\Mbstring::mb_language($lang); }
|
|
|
|
|
29 |
function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); }
|
|
|
|
|
30 |
function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); }
|
|
|
|
|
31 |
function mb_check_encoding($var = null, $encoding = null) { return p\Mbstring::mb_check_encoding($var, $encoding); }
|
|
|
|
|
32 |
function mb_detect_encoding($str, $encodingList = null, $strict = false) { return p\Mbstring::mb_detect_encoding($str, $encodingList, $strict); }
|
|
|
|
|
33 |
function mb_detect_order($encodingList = null) { return p\Mbstring::mb_detect_order($encodingList); }
|
|
|
|
|
34 |
function mb_parse_str($s, &$result = array()) { parse_str($s, $result); }
|
|
|
|
|
35 |
function mb_strlen($s, $enc = null) { return p\Mbstring::mb_strlen($s, $enc); }
|
|
|
|
|
36 |
function mb_strpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strpos($s, $needle, $offset, $enc); }
|
|
|
|
|
37 |
function mb_strtolower($s, $enc = null) { return p\Mbstring::mb_strtolower($s, $enc); }
|
|
|
|
|
38 |
function mb_strtoupper($s, $enc = null) { return p\Mbstring::mb_strtoupper($s, $enc); }
|
|
|
|
|
39 |
function mb_substitute_character($char = null) { return p\Mbstring::mb_substitute_character($char); }
|
|
|
|
|
40 |
function mb_substr($s, $start, $length = 2147483647, $enc = null) { return p\Mbstring::mb_substr($s, $start, $length, $enc); }
|
|
|
|
|
41 |
function mb_stripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_stripos($s, $needle, $offset, $enc); }
|
|
|
|
|
42 |
function mb_stristr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_stristr($s, $needle, $part, $enc); }
|
|
|
|
|
43 |
function mb_strrchr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrchr($s, $needle, $part, $enc); }
|
|
|
|
|
44 |
function mb_strrichr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrichr($s, $needle, $part, $enc); }
|
|
|
|
|
45 |
function mb_strripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strripos($s, $needle, $offset, $enc); }
|
|
|
|
|
46 |
function mb_strrpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strrpos($s, $needle, $offset, $enc); }
|
|
|
|
|
47 |
function mb_strstr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strstr($s, $needle, $part, $enc); }
|
|
|
|
|
48 |
function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); }
|
|
|
|
|
49 |
function mb_http_output($enc = null) { return p\Mbstring::mb_http_output($enc); }
|
|
|
|
|
50 |
function mb_strwidth($s, $enc = null) { return p\Mbstring::mb_strwidth($s, $enc); }
|
|
|
|
|
51 |
function mb_substr_count($haystack, $needle, $enc = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $enc); }
|
|
|
|
|
52 |
function mb_output_handler($contents, $status) { return p\Mbstring::mb_output_handler($contents, $status); }
|
|
|
|
|
53 |
function mb_http_input($type = '') { return p\Mbstring::mb_http_input($type); }
|
|
|
|
|
54 |
function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) { return p\Mbstring::mb_convert_variables($toEncoding, $fromEncoding, $a, $b, $c, $d, $e, $f); }
|
55 |
}
|
56 |
-
if (!function_exists('
|
57 |
function mb_ord($s, $enc = null) { return p\Mbstring::mb_ord($s, $enc); }
|
|
|
|
|
58 |
function mb_chr($code, $enc = null) { return p\Mbstring::mb_chr($code, $enc); }
|
|
|
|
|
59 |
function mb_scrub($s, $enc = null) { $enc = null === $enc ? mb_internal_encoding() : $enc; return mb_convert_encoding($s, $enc, $enc); }
|
60 |
}
|
61 |
-
|
62 |
if (!function_exists('mb_str_split')) {
|
63 |
function mb_str_split($string, $split_length = 1, $encoding = null) { return p\Mbstring::mb_str_split($string, $split_length, $encoding); }
|
64 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
use Symfony\Polyfill\Mbstring as p;
|
13 |
|
14 |
+
if (!function_exists('mb_convert_encoding')) {
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
function mb_convert_encoding($s, $to, $from = null) { return p\Mbstring::mb_convert_encoding($s, $to, $from); }
|
16 |
+
}
|
17 |
+
if (!function_exists('mb_decode_mimeheader')) {
|
18 |
function mb_decode_mimeheader($s) { return p\Mbstring::mb_decode_mimeheader($s); }
|
19 |
+
}
|
20 |
+
if (!function_exists('mb_encode_mimeheader')) {
|
21 |
function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); }
|
22 |
+
}
|
23 |
+
if (!function_exists('mb_decode_numericentity')) {
|
24 |
function mb_decode_numericentity($s, $convmap, $enc = null) { return p\Mbstring::mb_decode_numericentity($s, $convmap, $enc); }
|
25 |
+
}
|
26 |
+
if (!function_exists('mb_encode_numericentity')) {
|
27 |
function mb_encode_numericentity($s, $convmap, $enc = null, $is_hex = false) { return p\Mbstring::mb_encode_numericentity($s, $convmap, $enc, $is_hex); }
|
28 |
+
}
|
29 |
+
if (!function_exists('mb_convert_case')) {
|
30 |
function mb_convert_case($s, $mode, $enc = null) { return p\Mbstring::mb_convert_case($s, $mode, $enc); }
|
31 |
+
}
|
32 |
+
if (!function_exists('mb_internal_encoding')) {
|
33 |
function mb_internal_encoding($enc = null) { return p\Mbstring::mb_internal_encoding($enc); }
|
34 |
+
}
|
35 |
+
if (!function_exists('mb_language')) {
|
36 |
function mb_language($lang = null) { return p\Mbstring::mb_language($lang); }
|
37 |
+
}
|
38 |
+
if (!function_exists('mb_list_encodings')) {
|
39 |
function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); }
|
40 |
+
}
|
41 |
+
if (!function_exists('mb_encoding_aliases')) {
|
42 |
function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); }
|
43 |
+
}
|
44 |
+
if (!function_exists('mb_check_encoding')) {
|
45 |
function mb_check_encoding($var = null, $encoding = null) { return p\Mbstring::mb_check_encoding($var, $encoding); }
|
46 |
+
}
|
47 |
+
if (!function_exists('mb_detect_encoding')) {
|
48 |
function mb_detect_encoding($str, $encodingList = null, $strict = false) { return p\Mbstring::mb_detect_encoding($str, $encodingList, $strict); }
|
49 |
+
}
|
50 |
+
if (!function_exists('mb_detect_order')) {
|
51 |
function mb_detect_order($encodingList = null) { return p\Mbstring::mb_detect_order($encodingList); }
|
52 |
+
}
|
53 |
+
if (!function_exists('mb_parse_str')) {
|
54 |
function mb_parse_str($s, &$result = array()) { parse_str($s, $result); }
|
55 |
+
}
|
56 |
+
if (!function_exists('mb_strlen')) {
|
57 |
function mb_strlen($s, $enc = null) { return p\Mbstring::mb_strlen($s, $enc); }
|
58 |
+
}
|
59 |
+
if (!function_exists('mb_strpos')) {
|
60 |
function mb_strpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strpos($s, $needle, $offset, $enc); }
|
61 |
+
}
|
62 |
+
if (!function_exists('mb_strtolower')) {
|
63 |
function mb_strtolower($s, $enc = null) { return p\Mbstring::mb_strtolower($s, $enc); }
|
64 |
+
}
|
65 |
+
if (!function_exists('mb_strtoupper')) {
|
66 |
function mb_strtoupper($s, $enc = null) { return p\Mbstring::mb_strtoupper($s, $enc); }
|
67 |
+
}
|
68 |
+
if (!function_exists('mb_substitute_character')) {
|
69 |
function mb_substitute_character($char = null) { return p\Mbstring::mb_substitute_character($char); }
|
70 |
+
}
|
71 |
+
if (!function_exists('mb_substr')) {
|
72 |
function mb_substr($s, $start, $length = 2147483647, $enc = null) { return p\Mbstring::mb_substr($s, $start, $length, $enc); }
|
73 |
+
}
|
74 |
+
if (!function_exists('mb_stripos')) {
|
75 |
function mb_stripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_stripos($s, $needle, $offset, $enc); }
|
76 |
+
}
|
77 |
+
if (!function_exists('mb_stristr')) {
|
78 |
function mb_stristr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_stristr($s, $needle, $part, $enc); }
|
79 |
+
}
|
80 |
+
if (!function_exists('mb_strrchr')) {
|
81 |
function mb_strrchr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrchr($s, $needle, $part, $enc); }
|
82 |
+
}
|
83 |
+
if (!function_exists('mb_strrichr')) {
|
84 |
function mb_strrichr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrichr($s, $needle, $part, $enc); }
|
85 |
+
}
|
86 |
+
if (!function_exists('mb_strripos')) {
|
87 |
function mb_strripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strripos($s, $needle, $offset, $enc); }
|
88 |
+
}
|
89 |
+
if (!function_exists('mb_strrpos')) {
|
90 |
function mb_strrpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strrpos($s, $needle, $offset, $enc); }
|
91 |
+
}
|
92 |
+
if (!function_exists('mb_strstr')) {
|
93 |
function mb_strstr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strstr($s, $needle, $part, $enc); }
|
94 |
+
}
|
95 |
+
if (!function_exists('mb_get_info')) {
|
96 |
function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); }
|
97 |
+
}
|
98 |
+
if (!function_exists('mb_http_output')) {
|
99 |
function mb_http_output($enc = null) { return p\Mbstring::mb_http_output($enc); }
|
100 |
+
}
|
101 |
+
if (!function_exists('mb_strwidth')) {
|
102 |
function mb_strwidth($s, $enc = null) { return p\Mbstring::mb_strwidth($s, $enc); }
|
103 |
+
}
|
104 |
+
if (!function_exists('mb_substr_count')) {
|
105 |
function mb_substr_count($haystack, $needle, $enc = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $enc); }
|
106 |
+
}
|
107 |
+
if (!function_exists('mb_output_handler')) {
|
108 |
function mb_output_handler($contents, $status) { return p\Mbstring::mb_output_handler($contents, $status); }
|
109 |
+
}
|
110 |
+
if (!function_exists('mb_http_input')) {
|
111 |
function mb_http_input($type = '') { return p\Mbstring::mb_http_input($type); }
|
112 |
+
}
|
113 |
+
if (!function_exists('mb_convert_variables')) {
|
114 |
function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) { return p\Mbstring::mb_convert_variables($toEncoding, $fromEncoding, $a, $b, $c, $d, $e, $f); }
|
115 |
}
|
116 |
+
if (!function_exists('mb_ord')) {
|
117 |
function mb_ord($s, $enc = null) { return p\Mbstring::mb_ord($s, $enc); }
|
118 |
+
}
|
119 |
+
if (!function_exists('mb_chr')) {
|
120 |
function mb_chr($code, $enc = null) { return p\Mbstring::mb_chr($code, $enc); }
|
121 |
+
}
|
122 |
+
if (!function_exists('mb_scrub')) {
|
123 |
function mb_scrub($s, $enc = null) { $enc = null === $enc ? mb_internal_encoding() : $enc; return mb_convert_encoding($s, $enc, $enc); }
|
124 |
}
|
|
|
125 |
if (!function_exists('mb_str_split')) {
|
126 |
function mb_str_split($string, $split_length = 1, $encoding = null) { return p\Mbstring::mb_str_split($string, $split_length, $encoding); }
|
127 |
}
|
128 |
+
|
129 |
+
if (extension_loaded('mbstring')) {
|
130 |
+
return;
|
131 |
+
}
|
132 |
+
|
133 |
+
if (!defined('MB_CASE_UPPER')) {
|
134 |
+
define('MB_CASE_UPPER', 0);
|
135 |
+
}
|
136 |
+
if (!defined('MB_CASE_LOWER')) {
|
137 |
+
define('MB_CASE_LOWER', 1);
|
138 |
+
}
|
139 |
+
if (!defined('MB_CASE_TITLE')) {
|
140 |
+
define('MB_CASE_TITLE', 2);
|
141 |
+
}
|
src/processors/email.php
CHANGED
@@ -83,10 +83,14 @@ class ICWP_WPSF_Processor_Email extends Modules\BaseShield\ShieldProcessor {
|
|
83 |
* @return bool
|
84 |
*/
|
85 |
public function sendEmailWithWrap( $sAddress = '', $sSubject = '', $aMessage = [] ) {
|
|
|
86 |
return $this->send(
|
87 |
$sAddress,
|
88 |
-
|
89 |
-
'<html
|
|
|
|
|
|
|
90 |
);
|
91 |
}
|
92 |
|
@@ -167,10 +171,7 @@ class ICWP_WPSF_Processor_Email extends Modules\BaseShield\ShieldProcessor {
|
|
167 |
$sFromName = $sProposedFromName;
|
168 |
}
|
169 |
else {
|
170 |
-
$sFromName = sprintf( '%s - %s',
|
171 |
-
Services::WpGeneral()->getSiteName(),
|
172 |
-
$this->getCon()->getHumanName()
|
173 |
-
);
|
174 |
}
|
175 |
return $sFromName;
|
176 |
}
|
83 |
* @return bool
|
84 |
*/
|
85 |
public function sendEmailWithWrap( $sAddress = '', $sSubject = '', $aMessage = [] ) {
|
86 |
+
$oWP = Services::WpGeneral();
|
87 |
return $this->send(
|
88 |
$sAddress,
|
89 |
+
sprintf( '[%s] %s', html_entity_decode( $oWP->getSiteName(), ENT_QUOTES ), $sSubject ),
|
90 |
+
sprintf( '<html lang="%s">%s</html>',
|
91 |
+
$oWP->getLocale( '-' ),
|
92 |
+
implode( "<br />", array_merge( $this->getEmailHeader(), $aMessage, $this->getEmailFooter() ) )
|
93 |
+
)
|
94 |
);
|
95 |
}
|
96 |
|
171 |
$sFromName = $sProposedFromName;
|
172 |
}
|
173 |
else {
|
174 |
+
$sFromName = sprintf( '%s - %s', $sFromName, $this->getCon()->getHumanName() );
|
|
|
|
|
|
|
175 |
}
|
176 |
return $sFromName;
|
177 |
}
|
templates/twig/wpadmin_pages/insights/config/module_summaries.twig
CHANGED
@@ -36,7 +36,7 @@
|
|
36 |
<td>
|
37 |
{% if opt.href is defined %}
|
38 |
<a href="{{ opt.href }}" target="_blank"
|
39 |
-
title="{{ strings.go_to_options }}"
|
40 |
{% endif %}
|
41 |
</td>
|
42 |
</tr>
|
36 |
<td>
|
37 |
{% if opt.href is defined %}
|
38 |
<a href="{{ opt.href }}" target="_blank"
|
39 |
+
title="{{ strings.go_to_options }}"></a>
|
40 |
{% endif %}
|
41 |
</td>
|
42 |
</tr>
|