当前位置: 首页>>代码示例>>PHP>>正文


PHP Uuid::uuid3方法代码示例

本文整理汇总了PHP中Ramsey\Uuid\Uuid::uuid3方法的典型用法代码示例。如果您正苦于以下问题:PHP Uuid::uuid3方法的具体用法?PHP Uuid::uuid3怎么用?PHP Uuid::uuid3使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Ramsey\Uuid\Uuid的用法示例。


在下文中一共展示了Uuid::uuid3方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generateId

 /**
  * Generate ID
  * @return String
  */
 public function generateId($version = 4, $includeDash = false)
 {
     try {
         switch ($version) {
             case 1:
                 $uuid = Uuid::uuid1();
                 break;
             case 3:
                 $uuid = Uuid::uuid3(Uuid::NAMESPACE_DNS, php_uname('n'));
                 break;
             case 5:
                 $uuid = Uuid::uuid5(Uuid::NAMESPACE_DNS, php_uname('n'));
                 break;
             default:
                 $uuid = Uuid::uuid4();
                 break;
         }
         return $includeDash ? $uuid->toString() : str_replace('-', '', $uuid->toString());
     } catch (UnsatisfiedDependencyException $e) {
         // Some dependency was not met. Either the method cannot be called on a
         // 32-bit system, or it can, but it relies on Moontoast\Math to be present.
         echo 'Caught exception: ' . $e->getMessage() . "\n";
         exit;
     }
 }
开发者ID:transformatika,项目名称:utility,代码行数:29,代码来源:Str.php

示例2: generateFromString

 /**
  * @param $string
  *
  * @return string
  *
  * @throws UUIDGeneratorException
  */
 public function generateFromString($string)
 {
     try {
         return Uuid::uuid3(Uuid::NAMESPACE_OID, $string)->toString();
     } catch (UnsatisfiedDependencyException $e) {
         throw new UUIDGeneratorException($e->getMessage());
     }
 }
开发者ID:da-vinci-studio,项目名称:uuid-generator,代码行数:15,代码来源:RamseyUUID.php

示例3: boot

 protected static function boot()
 {
     parent::boot();
     self::creating(function ($registro) {
         $uuid = Uuid::uuid3(Uuid::NAMESPACE_DNS, $registro->title_oaca);
         // name-based uuid
         $registro->id = $uuid->toString();
         return true;
     });
 }
开发者ID:jcaicedo,项目名称:sisgenoaca,代码行数:10,代码来源:RegistroOaca.php

示例4: uuid3

 /**
  * @see \Ramsey\Uuid\Uuid::uuid3()
  *
  * @param string $ns
  * @param string $name
  * @return \Ramsey\Uuid\UuidInterface
  */
 public function uuid3($ns, $name)
 {
     return \Ramsey\Uuid\Uuid::uuid3($ns, $name);
 }
开发者ID:ollieday,项目名称:yii2-uuid,代码行数:11,代码来源:Uuid.php

示例5: v3

 /**
  * UUID v3 generator.
  *
  * @since 150424 Initial release.
  *
  * @param string $namespace  Namespace.
  * @param string $identifier Identifier.
  * @param bool   $optimize   Optimize?
  *
  * @return string Version 3 UUID (32 bytes optimized).
  *                Or 36 bytes unoptimized; i.e., w/ dashes.
  *
  * @internal {@link v5()} is a suggested alternative, as this version uses MD5.
  */
 public function v3(string $namespace, string $identifier, bool $optimize = true) : string
 {
     switch ($namespace) {
         case 'dns':
             $namespace = UuidGen::NAMESPACE_DNS;
             break;
             // Stop here.
         // Stop here.
         case 'url':
             $namespace = UuidGen::NAMESPACE_URL;
             break;
             // Stop here.
         // Stop here.
         case 'oid':
             $namespace = UuidGen::NAMESPACE_OID;
             break;
             // Stop here.
         // Stop here.
         case 'x500':
             $namespace = UuidGen::NAMESPACE_X500;
             break;
             // Stop here.
         // Stop here.
         default:
             $this->c::issue('Invalid namespace.');
     }
     $uuid = UuidGen::uuid3($namespace, $identifier)->toString();
     return $optimize ? str_replace('-', '', $uuid) : $uuid;
 }
开发者ID:websharks,项目名称:core,代码行数:43,代码来源:Uuid.php

示例6:

 function uuid3($ns, $name)
 {
     $uuid = Uuid::uuid3($ns, $name);
     return $uuid->toString();
 }
开发者ID:DraperStudio,项目名称:Support,代码行数:5,代码来源:Uuid.php

示例7: generateUuid3

 /**
  * @param string $namespace
  * @param string $name
  *
  * @return $this
  */
 public function generateUuid3($namespace, $name)
 {
     $this->uuid = Uuid::uuid3($namespace, $name);
     return $this;
 }
开发者ID:scr-be,项目名称:arthur-doctrine-entity-traits-library,代码行数:11,代码来源:UuidMutableTrait.php

示例8: generateUuid

 /**
  * Generate a uuid for the site based on it's port.
  *
  * @param $site
  *
  * @return string
  */
 protected function generateUuid($site)
 {
     $uuid3 = Uuid::uuid3(Uuid::NAMESPACE_DNS, $site['port']);
     $uuid = $uuid3->toString();
     return $uuid;
 }
开发者ID:NukaCode,项目名称:dasher,代码行数:13,代码来源:BaseCreate.php

示例9: uuid3

 public static function uuid3($ns, $name)
 {
     return self::fromRamseyUuid(parent::uuid3($ns, $name));
 }
开发者ID:MattKetmo,项目名称:uuid-2x-bridge,代码行数:4,代码来源:Uuid.php

示例10: p2uuid3

 public static function p2uuid3($subDomain = self::SUBDOMAIN_UUID)
 {
     return Uuid::uuid3(Uuid::uuid1(), self::fullReverseDomain($subDomain));
 }
开发者ID:p2made,项目名称:yii2-uuid,代码行数:4,代码来源:UuidHelpers.php

示例11: uuidProvider

 public function uuidProvider()
 {
     return array(array(Uuid::uuid1()), array(Uuid::uuid3(Uuid::NAMESPACE_DNS, 'php.net')), array(Uuid::uuid4()), array(Uuid::uuid5(Uuid::NAMESPACE_DNS, 'php.net')), array(Uuid::fromString(self::UUID_SAMPLE)));
 }
开发者ID:gbprod,项目名称:uuid-normalizer,代码行数:4,代码来源:UuidNormalizerTest.php

示例12: createUuid

 /**
  * Creates the requested UUID
  *
  * @param int $version
  * @param string $namespace
  * @param string $name
  * @return Uuid
  */
 protected function createUuid($version, $namespace = null, $name = null)
 {
     switch ((int) $version) {
         case 1:
             $uuid = Uuid::uuid1();
             break;
         case 4:
             $uuid = Uuid::uuid4();
             break;
         case 3:
         case 5:
             $ns = $this->validateNamespace($namespace);
             if (empty($name)) {
                 throw new Exception('The name argument is required for version 3 or 5 UUIDs');
             }
             if ($version == 3) {
                 $uuid = Uuid::uuid3($ns, $name);
             } else {
                 $uuid = Uuid::uuid5($ns, $name);
             }
             break;
         default:
             throw new Exception('Invalid UUID version. Supported are version "1", "3", "4", and "5".');
     }
     return $uuid;
 }
开发者ID:ramsey,项目名称:uuid-console,代码行数:34,代码来源:GenerateCommand.php

示例13: generateUuid

 /**
  * Generate a uuid for the site based on it's port.
  *
  * @param $unique
  *
  * @return string
  */
 public function generateUuid($unique)
 {
     $uuid3 = Uuid::uuid3(Uuid::NAMESPACE_DNS, $unique);
     $uuid = $uuid3->toString();
     return $uuid;
 }
开发者ID:NukaCode,项目名称:dasher,代码行数:13,代码来源:Site.php

示例14: testShouldAcceptUuid3

 public function testShouldAcceptUuid3()
 {
     $uuid = new Uuid(BaseUuid::uuid3(BaseUuid::NAMESPACE_DNS, 'user'));
     $this->assertInstanceOf('App\\Domain\\Identity\\Uuid', $uuid);
 }
开发者ID:xtreamwayz,项目名称:zend-expressive-app-poc,代码行数:5,代码来源:UuidTest.php


注:本文中的Ramsey\Uuid\Uuid::uuid3方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。