/** * Fetch context content * * @return mixed */ public function fetch() { if ($this->definition->isScalar()) { $this->definition->settle($this->origin, $this->content); return $this->content; } if ($this->definition->isArray()) { $this->definition->settle($this->origin, $this->collection); return $this->collection; } if ($this->definition->isObject()) { $this->definition->settle($this->origin, $this->object); return $this->object; } return null; }
public function testSettleDenormalize() { $object = $this->getDocument(); $transformer = $this->getTransformerMock(); $transformer->expects($this->once())->method('denormalize')->with('baz')->will($this->returnValue('foo')); $accessor = $this->getAccessorMock(); $accessor->expects($this->once())->method('setValue')->with($object, 'path', 'foo'); $definition = new Definition(); $definition->setPropertyAccessor($accessor); $definition->setPropertyPath('path'); $definition->setTransformer($transformer); $definition->settle($object, 'baz'); }