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


PHP Uuid::uuid1方法代碼示例

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


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

示例1: __construct

 /**
  * Initialize the saga. If an identifier is provided it will be used, otherwise a random UUID will be generated.
  * 
  * @param string $identifier
  */
 public function __construct($identifier = null)
 {
     $this->identifier = null === $identifier ? Uuid::uuid1()->toString() : $identifier;
     $this->associationValues = new AssociationValuesImpl();
     $this->inspector = new SagaMethodMessageHandlerInspector($this);
     $this->associationValues->add(new AssociationValue('sagaIdentifier', $this->identifier));
 }
開發者ID:babarinde,項目名稱:GovernorFramework,代碼行數:12,代碼來源:AbstractAnnotatedSaga.php

示例2: 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:tunandras,項目名稱:webtrees,代碼行數:34,代碼來源:GenerateCommand.php

示例3: __construct

 /**
  * @param mixed $payload
  * @param MetaData $metaData
  * @param string|null $id
  * @param string|null $commandName
  */
 public function __construct($payload, MetaData $metaData = null, $id = null, $commandName = null)
 {
     $this->id = null === $id ? Uuid::uuid1()->toString() : $id;
     $this->commandName = null === $commandName ? get_class($payload) : $commandName;
     $this->payload = $payload;
     $this->metaData = null === $metaData ? MetaData::emptyInstance() : $metaData;
 }
開發者ID:peanohan,項目名稱:GovernorFramework,代碼行數:13,代碼來源:GenericCommandMessage.php

示例4: login

 public function login()
 {
     try {
         $passwordMatch = false;
         $userDeviceUpdated = false;
         $access_token = '';
         $input = Request::all();
         $user = User::where('email', $input['email'])->first();
         if ($user) {
             if (crypt($input['password'], $user->password) == $user->password) {
                 $passwordMatch = true;
             }
         }
         if ($passwordMatch) {
             $userDevice = UserDevice::where('device_id', $input['device_id'])->first();
             $access_token = Uuid::uuid1()->toString();
             if ($userDevice) {
                 $userDeviceUpdated = $userDevice->update(['device_id' => $input['device_id'], 'rest_access_token' => $access_token, 'rest_access_token_expires' => Carbon::now()->addDays(360), 'rest_notification_id' => $input['notification_id'], 'os_type' => $input['os_type'], 'os_version' => $input['os_version'], 'hardware' => $input['hardware'], 'rest_app_version' => $input['app_version'], 'user_id' => $user->id]);
             } else {
                 $userDeviceUpdated = UserDevice::create(['device_id' => $input['device_id'], 'rest_access_token' => $access_token, 'rest_access_token_expires' => Carbon::now()->addDays(360), 'rest_notification_id' => $input['notification_id'], 'os_type' => $input['os_type'], 'os_version' => $input['os_version'], 'hardware' => $input['hardware'], 'rest_app_version' => $input['app_version'], 'user_id' => $user->id]);
             }
         }
         if ($userDeviceUpdated) {
             $vendorLocationContact = VendorLocationContact::where('user_id', $user->id)->first();
             $vendorLocation = VendorLocation::where('id', $vendorLocationContact->vendor_location_id)->first();
             $vendor = Vendor::where('id', $vendorLocation->vendor_id)->first();
             return response()->json(['id' => $user->id, 'access_token' => $access_token, 'full_name' => $user->full_name, 'email' => $user->email, 'phone_number' => $user->phone_number, 'role' => $user->role->name, 'vendor_name' => $vendor->name], 200);
         } else {
             return response()->json(['action' => 'Check if the email address and password match', 'message' => 'There is an email password mismatch. Please check and try again'], 227);
         }
     } catch (\Exception $e) {
         return response()->json(['message' => 'An application error occured.', 'error' => $e->getMessage()], 500);
     }
 }
開發者ID:Charu91,項目名稱:Wowtables1,代碼行數:34,代碼來源:UserController.php

示例5: generate

 public static function generate($ver = 4, $node = null, $clockSeq = null, $ns = null, $name = null)
 {
     $uuid = null;
     /* Create a new UUID based on provided data. */
     switch ((int) $ver) {
         case 1:
             $uuid = Uuid::uuid1($node, $clockSeq);
             break;
         case 2:
             // Version 2 is not supported
             throw new \RuntimeException('UUID version 2 is unsupported.');
         case 3:
             $uuid = Uuid::uuid3($ns, $name);
             break;
         case 4:
             $uuid = Uuid::uuid4();
             break;
         case 5:
             $uuid = Uuid::uuid5($ns, $name);
             break;
         default:
             throw new \RuntimeException('Selected UUID version is invalid or unsupported.');
     }
     if (function_exists('gmp_strval')) {
         return gmp_strval(gmp_init($uuid->getHex(), 16), 62);
     }
     return Base62::encode((string) $uuid->getInteger());
 }
開發者ID:gponster,項目名稱:laravel-url62-uuid,代碼行數:28,代碼來源:Url62UuidGenerator.php

示例6: boot

 /**
  * Model boot method, sets guid on create.
  *
  * @return void
  */
 public static function boot()
 {
     parent::boot();
     static::creating(function ($model) {
         $model->guid = Uuid::uuid1();
     });
 }
開發者ID:nich-mctishe,項目名稱:laravel-framework,代碼行數:12,代碼來源:Hashed.php

示例7: testNextReadBeyondEnd

 /**
  * @expectedException \OutOfBoundsException
  */
 public function testNextReadBeyondEnd()
 {
     $event1 = new GenericDomainEventMessage(Uuid::uuid1(), 0, new \stdClass(), new MetaData());
     $testSubject = new SimpleDomainEventStream(array($event1));
     $testSubject->next();
     $testSubject->next();
 }
開發者ID:peanohan,項目名稱:GovernorFramework,代碼行數:10,代碼來源:SimpleDomainEventStreamTest.php

示例8: testResolveTarget_WithAnnotatedFields

 public function testResolveTarget_WithAnnotatedFields()
 {
     $aggregateIdentifier = Uuid::uuid1();
     $version = 1;
     $actual = $this->testSubject->resolveTarget(GenericCommandMessage::asCommandMessage(new FieldAnnotatedCommand($aggregateIdentifier, $version)));
     $this->assertEquals($aggregateIdentifier, $actual->getIdentifier());
     $this->assertEquals($version, $actual->getVersion());
 }
開發者ID:babarinde,項目名稱:GovernorFramework,代碼行數:8,代碼來源:AnnotationCommandTargetResolverTest.php

示例9: testRegisterCallbackInvokedWithAllRegisteredEvents

 public function testRegisterCallbackInvokedWithAllRegisteredEvents()
 {
     $container = new EventContainer(Uuid::uuid1()->toString());
     $container->addEvent(MetaData::emptyInstance(), new Event());
     $this->assertFalse(current($container->getEventList())->getMetaData()->has("key"));
     $container->addEventRegistrationCallback(new TestEventRegistrationCallback());
     $this->assertEquals("value", current($container->getEventList())->getMetadata()->get("key"));
 }
開發者ID:peanohan,項目名稱:GovernorFramework,代碼行數:8,代碼來源:EventContainerTest.php

示例10: schedule

 /**
  * schedule.
  *
  * Schedule $command for later execution
  * Returns a unique identifier for the scheduled execution
  * If an $id was passed it'll overwrite the scheduled execution
  *
  * @since 1.0
  *
  * @param ScheduledCommandInterface $command
  * @param string                    $id      - optional
  *
  * @return string
  */
 public function schedule(ScheduledCommandInterface $command, $id = null)
 {
     $fileName = isset($id) ? $id : Uuid::uuid1()->toString();
     file_put_contents($this->path . DIRECTORY_SEPARATOR . $fileName, serialize($command));
     $this->register[$fileName] = $command->getTimestamp();
     file_put_contents($this->path . DIRECTORY_SEPARATOR . 'register', serialize($this->register));
     return $fileName;
 }
開發者ID:connectholland,項目名稱:tactician-scheduler-plugin,代碼行數:22,代碼來源:FileBasedScheduler.php

示例11: createVoucher

 /**
  * createVoucher function.
  *
  * @access public
  *
  * @param string $campaignUrn
  *
  * @return Voucher
  */
 public function createVoucher($campaignUrn)
 {
     // Check for valid campaign
     if ($campaign = $this->campaignRepo->loadCampaign($campaignUrn)) {
         $voucher = $this->model->create(['campaign_id' => $campaign->id, 'hash' => Uuid::uuid1()->toString()]);
         return $voucher;
     }
     return false;
 }
開發者ID:fastwebmedia,項目名稱:laravel-vouchering,代碼行數:18,代碼來源:VoucherFactory.php

示例12: __construct

 /**
  * @param mixed $payload
  * @param MetaData $metadata
  * @param string $id
  */
 public function __construct($payload, MetaData $metadata = null, $id = null)
 {
     if (!is_object($payload)) {
         throw new \InvalidArgumentException("Payload needs to be an object.");
     }
     $this->id = isset($id) ? $id : Uuid::uuid1()->toString();
     $this->metadata = isset($metadata) ? $metadata : MetaData::emptyInstance();
     $this->payload = $payload;
 }
開發者ID:peanohan,項目名稱:GovernorFramework,代碼行數:14,代碼來源:GenericMessage.php

示例13: set

 /**
  * Set object with Auto document_id
  * @param mixed $object Receive object to store
  * @return string Return string with $document_id
  */
 public function set($object, $document_id = null)
 {
     if (is_null($document_id) || !Uuid::isValid($document_id)) {
         $document_id = strtoupper(Uuid::uuid1());
     }
     $this->resolvePath($this->dataPath);
     file_put_contents($this->dataPath . DIRECTORY_SEPARATOR . $document_id, json_encode($object, JSON_PRETTY_PRINT), LOCK_EX);
     return $document_id;
 }
開發者ID:wallacesilva,項目名稱:phpjsonlite,代碼行數:14,代碼來源:JSONlite.php

示例14: v1

 /**
  * UUID1,基於時間戳
  *
  * @param int|string $node
  * @param int        $clockSeq
  * @return string
  */
 public static function v1($node = null, $clockSeq = null)
 {
     try {
         $uuid1 = VendorUUID::uuid1($node, $clockSeq);
         return $uuid1->toString();
     } catch (UnsatisfiedDependencyException $e) {
         return false;
     }
 }
開發者ID:tourze,項目名稱:security,代碼行數:16,代碼來源:UUID.php

示例15: testCommandReply

 public function testCommandReply()
 {
     $commandId1 = Uuid::uuid1()->toString();
     $commandId2 = Uuid::uuid1()->toString();
     $this->testSubject->writeCommandReply($commandId1, $commandId1);
     $data = $this->testSubject->readCommandReply($commandId1);
     $this->assertEquals($commandId1, $data[1]);
     $data = $this->testSubject->readCommandReply($commandId2, 1);
     $this->assertNull($data);
 }
開發者ID:peanohan,項目名稱:GovernorFramework,代碼行數:10,代碼來源:RedisTemplateTest.php


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