/**
  * {@inheritdoc}
  *
  * @param array $data subset of PHP data coming from the parser (does not contains any parameters)
  *
  * @example
  *  $data = [
  *      'Nelmio\Alice\Entity\User' => [
  *          'user0' => [
  *              'username' => 'bob',
  *          ],
  *      ],
  *  ];
  *
  * @return FixtureBag
  */
 public function denormalize(array $data) : FixtureBag
 {
     $fixtures = new FixtureBag();
     foreach ($data as $fqcnWithFlags => $rawFixtureSet) {
         $flags = $this->flagParser->parse($fqcnWithFlags);
         $fqcn = $flags->getKey();
         foreach ($rawFixtureSet as $reference => $specs) {
             $fixtures = $this->fixtureDenormalizer->denormalize($fixtures, $fqcn, $reference, $specs, $flags);
         }
     }
     return $fixtures;
 }
 /**
  * Helper method which uses the denormalizer to denormalize a fixture with the given properties but with a random
  * ID. The ID used and with the fixtures are returned.
  *
  * This helper is used to optimize the number of call made on the decorated denormalizer: instead of building the
  * IDs from the list or the range, and then denormalizing as many time as needed, the denormalization is done only
  * once.
  */
 private function denormalizeTemporaryFixture(FixtureBag $builtFixtures, string $className, array $specs, FlagBag $flags) : array
 {
     $tempFixtureId = uniqid('temporary_id');
     $builtFixtures = $this->denormalizer->denormalize($builtFixtures, $className, $tempFixtureId, $specs, $flags);
     $tempFixture = $builtFixtures->get($tempFixtureId);
     $builtFixtures = $builtFixtures->without($tempFixture);
     return [$tempFixture, $builtFixtures];
 }
 private final function denormalizeFixture(FixtureBag $builtFixtures, string $className, string $fixtureId, array $specs, FlagBag $flags, string $valueForCurrent) : FixtureBag
 {
     $builtFixtures = $this->denormalizer->denormalize($builtFixtures, $className, $fixtureId, $specs, $flags);
     // At this point we remove the denormalized fixture to re-create a new one with this time its value for current
     // set. The process is a bit awkward, but this is due to the fact that the value for current cannot be passed
     // to the decorated denormalizers in a simple way.
     $builtFixture = $builtFixtures->get($fixtureId);
     $builtFixtures = $builtFixtures->without($builtFixture);
     return $builtFixtures->with(new TemplatingFixture(new SimpleFixtureWithFlags(new SimpleFixture($fixtureId, $builtFixture->getClassName(), $builtFixture->getSpecs(), $valueForCurrent), $flags->withKey($fixtureId))));
 }