public function generate(string $outputDir) : array
    {
        $generatedFiles = [];

        foreach ($this->generators as $generator) {

            $this->logger->info('Running generator ' . get_class($generator));
            $result = $generator->generate();

            foreach ($result->all() as $phpFile) {

                $path = str_replace(
                    ['/', "\\"],
                    DIRECTORY_SEPARATOR,
                    $outputDir . '/' . $phpFile->getFqcn()->getNamespace()
                );

                BaseUtil::ensureDirectory($path, 0711);

                $filePath = $path . DIRECTORY_SEPARATOR . $phpFile->getFqcn()->getName() . '.php';
                $this->logger->info('Writing to file ' . $filePath);

                file_put_contents($filePath, $phpFile->getText());

                $generatedFiles[] = new GeneratedFile($filePath, $phpFile);
            }
        }

        return $generatedFiles;
    }
public function generate(string $outputDir) : array
    {
        $generatedFiles = [];

        foreach ($this->generators as $generator) {

            $this->logger->info('Running generator ' . get_class($generator));
            $result = $generator->generate();

            foreach ($result->all() as $phpFile) {

                $path = str_replace(
                    ['/', "\\"],
                    DIRECTORY_SEPARATOR,
                    $outputDir . '/' . $phpFile->getFqcn()->getNamespace()
                );

                BaseUtil::ensureDirectory($path, 0711);

                $filePath = $path . DIRECTORY_SEPARATOR . $phpFile->getFqcn()->getName() . '.php';
                $this->logger->info('Writing to file ' . $filePath);

                file_put_contents($filePath, $phpFile->getText());

                $generatedFiles[] = new GeneratedFile($filePath, $phpFile);
            }
        }

        return $generatedFiles;
    }
public function generate ( string $ outputDir ) : array { $ generatedFiles = [ ] ; foreach ( $ this -> generators as $ generator ) { $ this -> logger -> info ( 'Running generator ' . get_class ( $ generator ) ) ; $ result = $ generator -> generate ( ) ; foreach ( $ result -> all ( ) as $ phpFile ) { $ path = str_replace ( [ '/' , "\\" ] , DIRECTORY_SEPARATOR , $ outputDir . '/' . $ phpFile -> getFqcn ( ) -> getNamespace ( ) ) ; BaseUtil :: ensureDirectory ( $ path , 0711 ) ; $ filePath = $ path . DIRECTORY_SEPARATOR . $ phpFile -> getFqcn ( ) -> getName ( ) . '.php' ; $ this -> logger -> info ( 'Writing to file ' . $ filePath ) ; file_put_contents ( $ filePath , $ phpFile -> getText ( ) ) ; $ generatedFiles [ ] = new GeneratedFile ( $ filePath , $ phpFile ) ; } } return $ generatedFiles ; }
Run all registered code generators and writes the code to files

@param string $outputDir

@return array|GeneratedFile[]
Run all registered code generators and writes the code to files