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


PHP Uuid::getFactory方法代碼示例

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


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

示例1: execute

 /**
  * {@inheritDoc}
  *
  * @param InputInterface $input
  * @param OutputInterface $output
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $uuids = array();
     $count = filter_var($input->getOption('count'), FILTER_VALIDATE_INT, array('default' => 1, 'min_range' => 1));
     if ((bool) $input->getOption('guid') == true) {
         $features = new FeatureSet(true);
         Uuid::setFactory(new UuidFactory($features));
     }
     if ((bool) $input->getOption('comb') === true) {
         Uuid::getFactory()->setRandomGenerator(new CombGenerator(Uuid::getFactory()->getRandomGenerator(), Uuid::getFactory()->getNumberConverter()));
     }
     for ($i = 0; $i < $count; $i++) {
         $uuids[] = $this->createUuid($input->getArgument('version'), $input->getArgument('namespace'), $input->getArgument('name'));
     }
     foreach ($uuids as $uuid) {
         $output->writeln((string) $uuid);
     }
 }
開發者ID:ramsey,項目名稱:uuid-console,代碼行數:24,代碼來源:GenerateCommand.php

示例2: testGlobalFactory

 /**
  * Verify that the factory is made global.
  *
  * @covers ::boot
  */
 public function testGlobalFactory()
 {
     $this->load(['uuid_factory' => ['global' => true]]);
     $this->bundle->boot();
     self::assertSame($this->container->get('kherge_uuid.uuid_factory'), Uuid::getFactory());
 }
開發者ID:kherge,項目名稱:uuid-bundle,代碼行數:11,代碼來源:KHerGeUuidBundleTest.php

示例3: fromRamseyUuid

 /**
  * Make sure the returned instance is a Rhumsaa\Uuid\Uuid which inherit
  * from the Ramsey namespace.
  *
  * This is mandatory when using type hint in function and you want your
  * function works with both namespaces.
  *
  * @param \Ramsey\Uuid\Uuid $uuid
  *
  * @return Uuid
  */
 private static function fromRamseyUuid(\Ramsey\Uuid\Uuid $uuid)
 {
     return new self($uuid->getFieldsHex(), $uuid->getNumberConverter(), \Ramsey\Uuid\Uuid::getFactory()->getCodec());
 }
開發者ID:MattKetmo,項目名稱:uuid-2x-bridge,代碼行數:15,代碼來源:Uuid.php


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