Inheritance: implements Ramsey\Uuid\UuidFactoryInterface
Ejemplo n.º 1
0
 /**
  * Verify that a valid parameter is converted.
  *
  * @covers ::apply
  */
 public function testAppliedToValidUuid()
 {
     $uuid = $this->factory->uuid4();
     $request = Request::create('');
     $request->attributes->set('uuid', $uuid);
     $configuration = new ParamConverter(['name' => 'uuid', 'options' => ['uuid' => true]]);
     self::assertTrue($this->converter->apply($request, $configuration));
     self::assertInstanceOf('Ramsey\\Uuid\\Uuid', $request->attributes->get('uuid'));
     self::assertEquals($uuid, $request->attributes->get('uuid')->toString());
 }
Ejemplo n.º 2
0
 /**
  * @param resource $stream
  * @return array
  */
 public function merge($stream)
 {
     $items = [];
     $header = fgetcsv($stream);
     while (($data = fgetcsv($stream)) !== false) {
         $data = array_combine($header, $data);
         $currentId = $data['trip_id'];
         $newId = $this->uuidProvider->uuid4()->toString();
         $data['trip_id'] = $newId;
         $data['route_id'] = $this->getRouteId($data['route_id']);
         $data['service_id'] = $this->getServiceId($data['service_id']);
         $this->idsCache->save($currentId, $newId);
         $items[] = $data;
     }
     return $items;
 }
Ejemplo n.º 3
0
 /**
  * @param resource $stream
  * @return array
  */
 public function merge($stream)
 {
     $items = [];
     $header = fgetcsv($stream);
     while (($data = fgetcsv($stream)) !== false) {
         $data = array_combine($header, $data);
         $currentId = $data['stop_id'];
         $newId = $this->idsCache->load($currentId);
         if ($newId === null) {
             $newId = $this->uuidProvider->uuid4()->toString();
             $this->idsCache->save($currentId, $newId);
         }
         $data['stop_id'] = $newId;
         $items[] = $data;
     }
     return $items;
 }
Ejemplo n.º 4
0
 /**
  * @param resource $stream
  * @return array
  */
 public function merge($stream)
 {
     $items = [];
     $header = fgetcsv($stream);
     while (($data = fgetcsv($stream)) !== false) {
         $data = array_combine($header, $data);
         $key = $data['route_short_name'] . ';' . $data['route_long_name'];
         $currentId = $data['route_id'];
         $newId = $this->namesCache->load($key);
         if ($newId === null) {
             $newId = $this->uuidProvider->uuid4()->toString();
             $this->idsCache->save($currentId, $newId);
             $this->namesCache->save($key, $newId);
             $data['route_id'] = $newId;
             $data['agency_id'] = $this->getAgencyId($data['agency_id']);
             $items[] = $data;
         } else {
             $this->idsCache->save($currentId, $newId);
         }
     }
     return $items;
 }
Ejemplo n.º 5
0
 /**
  * @return string
  */
 public function generate()
 {
     return $this->factory->uuid4()->toString();
 }