/** * {@inheritdoc} */ public function create($requestedType, array $arguments = []) { $this->log->startCreating($requestedType); $result = $this->subject->create($requestedType, $arguments); $loggerClassName = get_class($result) . "\\Logger"; $wrappedResult = new $loggerClassName($result, $this->log); $this->log->stopCreating($result); return $wrappedResult; }
/** * Retrieve cached object instance * * @param string $type * @return mixed */ public function get($type) { $type = ltrim($type, '\\'); $type = $this->_config->getPreference($type); if (!isset($this->_sharedInstances[$type])) { $this->_sharedInstances[$type] = $this->_factory->create($type); } return $this->_sharedInstances[$type]; }
/** * @param string $startingClass * @param string $terminationClass * @dataProvider circularDataProvider */ public function testCircular($startingClass, $terminationClass) { $this->setExpectedException('\\LogicException', sprintf('Circular dependency: %s depends on %s and vice versa.', $startingClass, $terminationClass)); $this->factory->create($startingClass); }