/** * */ 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); } } }
public function testCreateWithFactory() { $definition = new Definition(); $definition->setFactory(function ($origin) { return $origin; }); $this->assertEquals('foo', $definition->create('foo')); }