/**
  * {@inheritdoc}
  */
 public function boot()
 {
     /*
      * Set the factory for the `Uuid` singleton.
      *
      * This will allow you to make calls directly to `Uuid` static methods
      * (`uuid1`, `uuid2`, etc.) without using the factory class directly.
      * This type of usage is not recommended as it can make testing more
      * difficult.
      */
     if ($this->container->getParameter('kherge_uuid.uuid_factory.global')) {
         Uuid::setFactory($this->container->get('kherge_uuid.uuid_factory'));
     }
 }
 /**
  * {@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);
     }
 }
Exemple #3
0
<?php

use Symfony\Component\ClassLoader\ApcClassLoader;
use Symfony\Component\HttpFoundation\Request;
use LoginCidadao\CoreBundle\Security\Compatibility\RamseyUuidFeatureSet;
$loader = (require_once __DIR__ . '/../app/bootstrap.php.cache');
// Use APC for autoloading to improve performance.
// Change 'sf2' to a unique prefix in order to prevent cache key conflicts
// with other applications also using APC.
/*
$loader = new ApcClassLoader('sf2', $loader);
$loader->register(true);
*/
require_once __DIR__ . '/../app/AppKernel.php';
//require_once __DIR__.'/../app/AppCache.php';
$kernel = new AppKernel('prod', false);
$uuidFactory = new \Ramsey\Uuid\UuidFactory(new RamseyUuidFeatureSet());
\Ramsey\Uuid\Uuid::setFactory($uuidFactory);
$generator = new \Qandidate\Stack\UuidRequestIdGenerator();
$stack = new \Qandidate\Stack\RequestId($kernel, $generator);
$kernel->loadClassCache();
//$kernel = new AppCache($kernel);
$request = Request::createFromGlobals();
$response = $stack->handle($request);
$response->send();
$kernel->terminate($request, $response);