/** * */ protected function initialize() { if ($this->initialized) { return; } $this->initialized = true; if ($this->definition->isArray()) { $this->collection =& $this->definition->extract($this->origin); } if ($this->definition->isObject()) { $this->object =& $this->definition->extract($this->origin); if ($this->object === null) { $this->object = $this->definition->create($this->origin); } } }
/** * @param \XMLWriter $writer * @param mixed $origin * @param Definition $definition */ protected function writeScalar(\XMLWriter $writer, $origin, Definition $definition) { $content = $definition->extract($origin); if (strpbrk($content, '></&![]\\') === false) { $writer->writeRaw($content); } else { $writer->writeCdata($content); } }
/** * @param string $property * @return $this */ public function property($property) { $this->definition->setPropertyPath($property); return $this; }
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'); }