public function get($cacheKey, callable $factory) { if (!isset($this->cache[$cacheKey])) { $this->cache[$cacheKey] = $factory(); } return $this->cache[$cacheKey]; }
/** * @return mixed */ public function getSyntaxTree() { return $this->lazyFactory->get(self::CONTEXT_AST, function () { $parser = new Parser(new Emulative()); $stmts = $parser->parse($this->file->getSource()); return $stmts; }); }