/** * Finalizes generator process * * @return void */ public function finalize() { $tMinifier = new Minifier(); $tBinder = new Binder(); $tBinder->addFilter("application/x-httpd-php", function ($uInput) use($tMinifier) { $tTokenStream = TokenStream::fromString($uInput); return $tMinifier->minifyPhpSource($tTokenStream); }); foreach ($this->classes as $tClass) { $tFilePath = Core::$instance->loader->findFile($tClass); if ($tFilePath === false) { // TODO exception throw new RuntimeException(""); } // $tBinder->addContent("<" . "?php if (!class_exists(\"{$tClass}\", false)) { ?" . ">"); $tBinder->addFile($tFilePath); // $tBinder->addContent("<" . "?php } ?" . ">"); } $tContent = str_replace(" ?" . "><" . "?php ", " ", $tBinder->compile()); $this->generatorRegistry->saveFile("compiled.php", $tContent); }
/** * Scans given file to search for classes * * @param string $uFile file * @param string $uNamespacePrefix namespace prefix * * @return void */ public function scanFile($uFile, $uNamespacePrefix) { $tFileContents = FileSystem::read($uFile); $tTokenStream = TokenStream::fromString($tFileContents); $this->annotationScanner->process($tTokenStream, $uNamespacePrefix); }