createForExpectedMethodToBeCalledIfHasAParser() public static method

public static createForExpectedMethodToBeCalledIfHasAParser ( string $method ) : FlagParserNotFoundException
$method string
return FlagParserNotFoundException
コード例 #1
0
ファイル: SimpleDenormalizer.php プロジェクト: nelmio/alice
 /**
  * @inheritdoc
  */
 public function denormalize(FixtureBag $builtFixtures, string $className, string $unparsedFixtureId, array $specs, FlagBag $flags) : FixtureBag
 {
     if (null === $this->flagParser) {
         throw FlagParserExceptionFactory::createForExpectedMethodToBeCalledIfHasAParser(__METHOD__);
     }
     $idFlags = $this->flagParser->parse($unparsedFixtureId);
     $fixture = new SimpleFixture($idFlags->getKey(), $className, new SpecificationBag(null, new PropertyBag(), new MethodCallBag()));
     $fixture = $fixture->withSpecs($this->specsDenormalizer->denormalize($fixture, $this->flagParser, $specs));
     return $builtFixtures->with(new TemplatingFixture(new SimpleFixtureWithFlags($fixture, $idFlags->mergeWith($flags))));
 }
コード例 #2
0
 /**
  * @inheritdoc
  */
 public function denormalize(FixtureBag $builtFixtures, string $className, string $fixtureId, array $specs, FlagBag $flags) : FixtureBag
 {
     if (null === $this->denormalizer) {
         throw DenormalizerExceptionFactory::createDenormalizerNotFoundUnexpectedCall(__METHOD__);
     }
     if (null === $this->parser) {
         throw FlagParserExceptionFactory::createForExpectedMethodToBeCalledIfHasAParser(__METHOD__);
     }
     $flags = $this->parser->parse($fixtureId)->mergeWith($flags, false);
     $fixtureId = $flags->getKey();
     /**
      * @var FixtureInterface $tempFixture
      * @var FixtureBag       $builtFixtures
      */
     list($tempFixture, $builtFixtures) = $this->denormalizeTemporaryFixture($builtFixtures, $className, $specs, $flags);
     $fixtureIds = $this->buildIds($fixtureId);
     foreach ($fixtureIds as $fixtureId => $valueForCurrent) {
         $builtFixtures = $builtFixtures->with(new TemplatingFixture(new SimpleFixtureWithFlags(new SimpleFixture($fixtureId, $tempFixture->getClassName(), $tempFixture->getSpecs(), (string) $valueForCurrent), $flags->withKey($fixtureId))));
     }
     return $builtFixtures;
 }
コード例 #3
0
 /**
  * @inheritdoc
  */
 public function denormalize(FixtureBag $builtFixtures, string $className, string $fixtureId, array $specs, FlagBag $flags) : FixtureBag
 {
     try {
         return $this->collectionDenormalizer->denormalize($builtFixtures, $className, $fixtureId, $specs, $flags);
     } catch (InvalidScopeException $exception) {
         // Continue to fallback on a more conventional way
     }
     if (null === $this->denormalizer) {
         throw DenormalizerExceptionFactory::createDenormalizerNotFoundUnexpectedCall(__METHOD__);
     }
     if (null === $this->parser) {
         throw FlagParserExceptionFactory::createForExpectedMethodToBeCalledIfHasAParser(__METHOD__);
     }
     $flags = $this->parser->parse($fixtureId)->mergeWith($flags, false);
     $fixtureId = $flags->getKey();
     $fixtureIds = $this->buildIds($fixtureId);
     foreach ($fixtureIds as $fixtureId => $valueForCurrent) {
         $builtFixtures = $this->denormalizeFixture($builtFixtures, $className, $fixtureId, $specs, $flags, (string) $valueForCurrent);
     }
     return $builtFixtures;
 }