當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Uuid::fromBytes方法代碼示例

本文整理匯總了PHP中Rhumsaa\Uuid\Uuid::fromBytes方法的典型用法代碼示例。如果您正苦於以下問題:PHP Uuid::fromBytes方法的具體用法?PHP Uuid::fromBytes怎麽用?PHP Uuid::fromBytes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Rhumsaa\Uuid\Uuid的用法示例。


在下文中一共展示了Uuid::fromBytes方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testUuidToBinary

 public function testUuidToBinary()
 {
     $uuid = Uuid::uuid5(Uuid::NAMESPACE_OID, 1);
     $binary = UuidConverter::uuidToBinary($uuid->toString());
     $finalUuid = Uuid::fromBytes($binary);
     $this->assertSame($uuid->toString(), $finalUuid->toString());
 }
開發者ID:ellipsesynergie,項目名稱:backend-skeleton,代碼行數:7,代碼來源:UuidConverterTest.php

示例2: fromBytes

 /**
  * @param string $bytes
  * @return static
  */
 public static function fromBytes($bytes)
 {
     try {
         return new static(RamseyUuid::fromBytes($bytes));
     } catch (\InvalidArgumentException $e) {
         throw InvalidUuid::create(base64_encode($bytes) . ' (base64 encoded)', $e);
     }
 }
開發者ID:simple-es,項目名稱:ramsey-uuid-bridge,代碼行數:12,代碼來源:UuidCapabilities.php

示例3: 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:bartdezwaan,項目名稱:event-sourcing,代碼行數:11,代碼來源:EventRepository.php

示例4: getUuidAttribute

 /**
  * Accessor for uuid attribute
  *
  * @return string
  */
 public function getUuidAttribute()
 {
     if (!empty($this->attributes['uuid'])) {
         return Uuid::fromBytes($this->attributes['uuid'])->toString();
     }
 }
開發者ID:ellipsesynergie,項目名稱:backend-skeleton,代碼行數:11,代碼來源:AbstractEntity.php

示例5: fromArray

 public static function fromArray(array $teamMemberArray)
 {
     return new self(Uuid::fromBytes($teamMemberArray['id']), $teamMemberArray['meta_id'], $teamMemberArray['language'], $teamMemberArray['name'], $teamMemberArray['description'], (bool) $teamMemberArray['is_hidden'], \DateTime::createFromFormat('Y-m-d H:i:s', $teamMemberArray['edited_on']), \DateTime::createFromFormat('Y-m-d H:i:s', $teamMemberArray['created_on']));
 }
開發者ID:WouterSioen,項目名稱:fork-cms-module-team,代碼行數:4,代碼來源:TeamMember.php


注:本文中的Rhumsaa\Uuid\Uuid::fromBytes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。