/** @internal */ public function generateCode() { if (func_num_args()) { trigger_error(__METHOD__ . ' arguments are deprecated, use Compiler::setClassName().', E_USER_DEPRECATED); $this->className = func_get_arg(0) ?: $this->className; } $this->builder->prepareClassList(); foreach ($this->extensions as $extension) { $extension->beforeCompile(); $this->dependencies->add([(new \ReflectionClass($extension))->getFileName()]); } $generator = new PhpGenerator($this->builder); $classes = $generator->generate($this->className); $classes[0]->addMethod('initialize'); $this->dependencies->add($this->builder->getDependencies()); foreach ($this->extensions as $extension) { $extension->afterCompile($classes[0]); } return $classes; }
private function isExpired($file) { if ($this->autoRebuild) { $meta = @unserialize(file_get_contents("{$file}.meta")); // @ - file may not exist return empty($meta[0]) || DependencyChecker::isExpired(...$meta); } return FALSE; }