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


PHP Uuid::fromBytes方法代码示例

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


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

示例1: convertToPHPValue

 /**
  * {@inheritdoc}
  *
  * @param string|null                               $value
  * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
  */
 public function convertToPHPValue($value, AbstractPlatform $platform)
 {
     if (empty($value)) {
         return null;
     }
     if ($value instanceof Uuid) {
         return $value;
     }
     try {
         $uuid = Uuid::fromBytes($value);
     } catch (InvalidArgumentException $e) {
         throw ConversionException::conversionFailed($value, self::NAME);
     }
     return $uuid;
 }
开发者ID:EdgarPE,项目名称:uuid-doctrine,代码行数:21,代码来源:UuidBinaryType.php

示例2: convertToDatabaseValue

 /**
  * {@inheritdoc}
  *
  * @param mixed            $value
  * @param AbstractPlatform $platform
  *
  * @throws ConversionException
  *
  * @return null|string
  */
 public function convertToDatabaseValue($value, AbstractPlatform $platform)
 {
     if (empty($value)) {
         return null;
     }
     if ($value instanceof Uuid) {
         return $value->getBytes();
     }
     if (Uuid::isValid($value)) {
         return Uuid::fromString($value)->getBytes();
     }
     try {
         return Uuid::fromBytes($value)->getBytes();
     } catch (\InvalidArgumentException $exception) {
         throw OrmTypeConversionException::create()->with($value, self::NAME);
     }
 }
开发者ID:scr-be,项目名称:arthur-doctrine-uuid-library,代码行数:27,代码来源:BinaryUuidType.php

示例3: convertToPHPValue

 /**
  * Converts a value from its database representation to its PHP representation of this type.
  *
  * @param mixed $value The value to convert.
  *
  * @return Uuid
  */
 public function convertToPHPValue($value)
 {
     if (null === $value) {
         return null;
     }
     if ($value instanceof Uuid) {
         return $value;
     }
     if ($value instanceof MongoBinData) {
         $value = $value->bin;
     }
     try {
         $uuid = Uuid::fromBytes($value);
     } catch (InvalidArgumentException $e) {
         throw ConversionException::conversionFailed($value, self::NAME);
     }
     return $uuid;
 }
开发者ID:johanderuijter,项目名称:uuid-doctrine-odm,代码行数:25,代码来源:UuidBinaryType.php

示例4: convertStorageValueToIdentifier

 private function convertStorageValueToIdentifier($id)
 {
     if ($this->useBinary) {
         try {
             return Uuid::fromBytes($id)->toString();
         } catch (\Exception $e) {
             throw new InvalidIdentifierException('Could not convert binary storage value to UUID.');
         }
     }
     return $id;
 }
开发者ID:Edwin-Luijten,项目名称:broadway,代码行数:11,代码来源:DBALEventStore.php

示例5: fromBytes

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

示例6: generate

 public function generate(int $name) : string
 {
     $generated = UuidLibrary::fromBytes($this->getIdentifier());
     return UuidLibrary::uuid5($generated, $name);
 }
开发者ID:compufour,项目名称:uuid,代码行数:5,代码来源:Uuid.php

示例7: compareTo

 /**
  * @param UuidInterface $other
  * @return int -1, 0 or 1
  */
 public function compareTo(UuidInterface $other)
 {
     $ramseyOther = RamseyUuid::fromBytes($other->getBytes());
     return $this->ramseyUuid->compareTo($ramseyOther);
 }
开发者ID:inklabs,项目名称:kommerce-core,代码行数:9,代码来源:Uuid.php


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