Nelmio\Alice\FixtureBuilder\Denormalizer\Fixture\SpecificationBagDenormalizer\SimpleSpecificationsDenormalizer::denormalize PHP Method

denormalize() public method

public denormalize ( Nelmio\Alice\FixtureInterface $scope, Nelmio\Alice\FixtureBuilder\Denormalizer\FlagParserInterface $parser, array $unparsedSpecs ) : SpecificationBag
$scope Nelmio\Alice\FixtureInterface
$parser Nelmio\Alice\FixtureBuilder\Denormalizer\FlagParserInterface
$unparsedSpecs array
return Nelmio\Alice\Definition\SpecificationBag
    public function denormalize(FixtureInterface $scope, FlagParserInterface $parser, array $unparsedSpecs) : SpecificationBag
    {
        $constructor = null;
        $properties = new PropertyBag();
        $calls = new MethodCallBag();
        foreach ($unparsedSpecs as $unparsedPropertyName => $value) {
            if ('__construct' === $unparsedPropertyName) {
                $constructor = $this->denormalizeConstructor($value, $scope, $parser);
                continue;
            }
            if ('__calls' === $unparsedPropertyName) {
                $calls = $this->denormalizeCall($this->callsDenormalizer, $value, $calls, $scope, $parser);
                continue;
            }
            $properties = $this->denormalizeProperty($this->propertyDenormalizer, $parser, $unparsedPropertyName, $value, $properties, $scope);
        }
        return new SpecificationBag($constructor, $properties, $calls);
    }

Usage Example

 /**
  * @expectedException \TypeError
  * @expectedExceptionMessage Expected method call value to be an array, got "NULL" instead.
  */
 public function testDenormalizeWithInvalidMethodCalls()
 {
     $specs = ['__calls' => [null]];
     $denormalizer = new SimpleSpecificationsDenormalizer(new FakeConstructorDenormalizer(), new FakePropertyDenormalizer(), new FakeCallsDenormalizer());
     $denormalizer->denormalize(new FakeFixture(), new FakeFlagParser(), $specs);
 }