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


PHP Uuid::fromString方法代碼示例

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


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

示例1: it_should_generate_a_version_4_uuid

 /**
  * @test
  */
 public function it_should_generate_a_version_4_uuid()
 {
     $generator = new Version4Generator();
     $uuid = $generator->generate();
     $uuidObject = Uuid::fromString($uuid);
     $this->assertEquals(4, $uuidObject->getVersion());
 }
開發者ID:fritsjanb,項目名稱:broadway-uuid-generator,代碼行數:10,代碼來源:Version4GeneratorTest.php

示例2: setUpBeforeClass

 /**
  * @inheritdoc
  */
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     foreach (self::$uuids as $i => $uuid) {
         self::$uuids[$i] = Uuid::fromString($uuid);
     }
 }
開發者ID:a-mayer,項目名稱:boekkooi-broadway,代碼行數:10,代碼來源:MockUuidSequenceGeneratorTest.php

示例3: testParseWithUuidTagHandler

 function testParseWithUuidTagHandler()
 {
     $expected = [Uuid::fromString('f81d4fae-7dec-11d0-a765-00a0c91e6bf6')];
     $edn = '#uuid "f81d4fae-7dec-11d0-a765-00a0c91e6bf6"';
     $data = igorw\edn\parse($edn);
     $this->assertEquals($expected, $data);
 }
開發者ID:igorw,項目名稱:edn,代碼行數:7,代碼來源:ParserTest.php

示例4: testUuidConvertsToDatabaseValue

 /**
  * @covers Rhumsaa\Uuid\Doctrine\UuidType::convertToDatabaseValue
  */
 public function testUuidConvertsToDatabaseValue()
 {
     $uuid = Uuid::fromString('ff6f8cb0-c57d-11e1-9b21-0800200c9a66');
     $expected = $uuid->toString();
     $actual = $this->type->convertToDatabaseValue($uuid, $this->platform);
     $this->assertEquals($expected, $actual);
 }
開發者ID:joemar-tagpuno,項目名稱:uuid,代碼行數:10,代碼來源:UuidTypeTest.php

示例5: fromString

 /**
  * {@inheritdoc}
  *
  * @return static
  */
 public static function fromString($id)
 {
     if (null === $id) {
         return null;
     }
     return new static(Uuid::fromString($id));
 }
開發者ID:borobudur-php,項目名稱:borobudur-cqrs,代碼行數:12,代碼來源:UuidIdentifier.php

示例6: testDenormalize

 public function testDenormalize()
 {
     $obj = Uuid::fromString('6d6f9c73-1f59-4235-ace1-3bccd789315d');
     $str = '6d6f9c73-1f59-4235-ace1-3bccd789315d';
     self::assertEquals($obj, $this->normalizer->denormalize($str, 'json'));
     self::assertEquals($obj, $this->normalizer->denormalize($str, 'xml'));
 }
開發者ID:a-mayer,項目名稱:boekkooi-broadway,代碼行數:7,代碼來源:UuidNormalizerTest.php

示例7: getIdentifier

 /**
  * Get identifier
  *
  * @return Uuid
  */
 public function getIdentifier()
 {
     if (is_null($this->identifier)) {
         return Uuid::fromString(Uuid::NIL);
     }
     return $this->identifier;
 }
開發者ID:T-REX-XP,項目名稱:SSDPFinder,代碼行數:12,代碼來源:UniqueServiceName.php

示例8: denormalize

 /**
  * @inheritdoc
  */
 public function denormalize($data, $class, $format = null, array $context = [])
 {
     if ($data === null) {
         return null;
     }
     return Uuid::fromString($data);
 }
開發者ID:a-mayer,項目名稱:boekkooi-broadway,代碼行數:10,代碼來源:UuidNormalizer.php

示例9: execute

 public function execute()
 {
     parent::execute();
     try {
         $id = Uuid::fromString($this->getParameter('id', 'string'));
         $teamMember = $this->get('team_repository')->find($id);
     } catch (\Exception $e) {
         return $this->redirect(Model::createURLForAction('Index') . '&error=non-existing');
     }
     $form = new TeamType('edit', $teamMember);
     if ($form->handle()) {
         $teamMember = $form->getData();
         $this->get('team_repository')->save($teamMember);
         return $this->redirect(Model::createURLForAction('Index') . '&report=edited' . '&highlight=row-' . $teamMember->getId());
     }
     // assign the detail url to the template if available
     $url = Model::getURLForBlock($this->URL->getModule(), 'Detail');
     if (Model::getURL(404) != $url) {
         $this->tpl->assign('detailURL', SITE_URL . $url);
     }
     $form->parse($this->tpl);
     $this->tpl->assign('teamMember', $teamMember->toArray());
     $this->parse();
     $this->display();
 }
開發者ID:WouterSioen,項目名稱:fork-cms-module-team,代碼行數:25,代碼來源:Edit.php

示例10: get

 /**
  * @param string $id
  * @return mixed
  */
 public function get($id)
 {
     $message = $this->messageLogger->getEntryForMessageId(Uuid::fromString($id));
     if (is_null($message)) {
         return new ApiProblemResponse(new ApiProblem(404, "Message can not be found"));
     }
     return ["message" => $message->toArray()];
 }
開發者ID:prooph,項目名稱:link-processor-proxy,代碼行數:12,代碼來源:Message.php

示例11: fromString

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

示例12: array

 function it_is_equal_to_statement_ids_with_equal_value()
 {
     $value = '39e24cc4-69af-4b01-a824-1fdc6ea8a3af';
     $uuid = Uuid::fromString($value);
     $this->beConstructedThrough('fromUuid', array($uuid));
     $this->equals(StatementId::fromString($value))->shouldReturn(true);
     $this->equals(StatementId::fromUuid(Uuid::fromString($value)))->shouldReturn(true);
     $this->equals(StatementId::fromUuid($uuid))->shouldReturn(true);
 }
開發者ID:php-xapi,項目名稱:model,代碼行數:9,代碼來源:StatementIdSpec.php

示例13: __construct

 /**
  * @param string
  */
 public final function __construct($uuid)
 {
     if (!is_string($uuid)) {
         throw new InvalidArgumentException('Uuid expected a string.');
     }
     if (!\Rhumsaa\Uuid\Uuid::isValid($uuid)) {
         throw new InvalidArgumentException('Invalid Uuid format.');
     }
     $this->uuid = \Rhumsaa\Uuid\Uuid::fromString($uuid);
 }
開發者ID:rayrutjes,項目名稱:domain,代碼行數:13,代碼來源:Uuid.php

示例14: deserializeUuid

 public function deserializeUuid(VisitorInterface $visitor, $data, array $type, Context $context)
 {
     if (null === $data) {
         return null;
     }
     if (!preg_match('/^' . self::UUID_V4_PATTERN . '$/', $data)) {
         throw new Exception\RuntimeException('Invalid UUID version 4 format');
     }
     $uuid = Uuid::fromString($data);
     return $uuid;
 }
開發者ID:curzio-della-santa,項目名稱:dfw-normalization,代碼行數:11,代碼來源:UuidHandler.php

示例15: refundReturnAction

 /**
  * @Route("/returns/refund", name="refund_return")
  * @Method("POST")
  */
 public function refundReturnAction(Request $request)
 {
     $returnNumber = new ReturnNumber(Uuid::fromString($request->request->get('return_number')));
     if ('credit' == $request->request->get('return_type')) {
         $command = new RefundForCredit($returnNumber);
     } else {
         $command = new RefundForCash($returnNumber);
     }
     $this->get('symfony_live.pos.command_bus')->dispatch($command);
     return $this->redirect($this->generateUrl('outstanding'));
 }
開發者ID:jkanclerz,項目名稱:symfony-live-ddd-2015,代碼行數:15,代碼來源:RefundController.php


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