/** * @param object $object * @param array $args * @param array $setter * @param CompilationLogger $logger * @param bool $isSingleton */ public function __construct($object, array $args, array $setter, CompilationLogger $logger, $isSingleton) { $this->class = get_class($object); $this->hash = $logger->getObjectHash($object); $this->args = $args; $this->setters = $setter; $this->logger = $logger; $this->isSingleton = $isSingleton; }
public function get() { if ($this->instance !== null) { return $this->instance; } try { $this->instance = $this->logger->newInstance($this->refId); return $this->instance; } catch (Compile $e) { $msg = sprintf('ref:%s class:%s logger:%s', $this->refId, $this->type, (string) $this->logger); throw new Compile($msg); } }
/** * @param callable $moduleProvider * @param Cache $cache * @param string $cacheKey * @param string $tmpDir * * @return DiCompiler */ private static function createInstance($moduleProvider, Cache $cache, $cacheKey, $tmpDir) { $config = new Config(new Annotation(new Definition(), new AnnotationReader())); $logger = new CompilationLogger(new Logger()); $logger->setConfig($config); $injector = self::createInjector($moduleProvider, $tmpDir, $config, $logger); $diCompiler = new DiCompiler($injector, $logger, $cache, $cacheKey); return $diCompiler; }