private function generateRoutes($directory)
    {
        $dirPath = $directory . 'app/routes/';

        if( ! file_exists($dirPath) )
            return;

        // get all files recursively

        /** @var \Iterator $iterator */
        $iterator = Finder::create()
            ->files()
            ->ignoreDotFiles(true)
            ->sortByName()
            ->in($dirPath);

        // iterate to array
        $files = iterator_to_array($iterator, true);

        $finalContent = '<?php' . "\r\n";

        foreach ( $files as $file ) {
            $finalContent .= "\r\n";
            $finalContent .= '//' . implode('/', array_slice(explode('/', $file), -6)) . "\r\n";
            $finalContent .= str_replace('<?php', '', file_get_contents((string)$file)) . "\r\n";
        }

        file_put_contents($directory . HCRoutes::ROUTES_PATH, $finalContent);

        $this->comment($directory . HCRoutes::ROUTES_PATH . ' file generated');
    }
private function generateRoutes($directory)
    {
        $dirPath = $directory . 'app/routes/';

        if( ! file_exists($dirPath) )
            return;

        // get all files recursively

        /** @var \Iterator $iterator */
        $iterator = Finder::create()
            ->files()
            ->ignoreDotFiles(true)
            ->sortByName()
            ->in($dirPath);

        // iterate to array
        $files = iterator_to_array($iterator, true);

        $finalContent = '<?php' . "\r\n";

        foreach ( $files as $file ) {
            $finalContent .= "\r\n";
            $finalContent .= '//' . implode('/', array_slice(explode('/', $file), -6)) . "\r\n";
            $finalContent .= str_replace('<?php', '', file_get_contents((string)$file)) . "\r\n";
        }

        file_put_contents($directory . HCRoutes::ROUTES_PATH, $finalContent);

        $this->comment($directory . HCRoutes::ROUTES_PATH . ' file generated');
    }
private function generateRoutes ( $ directory ) { $ dirPath = $ directory . 'app/routes/' ; if ( ! file_exists ( $ dirPath ) ) return ; // get all files recursively /** @var \Iterator $iterator */ $ iterator = Finder :: create ( ) -> files ( ) -> ignoreDotFiles ( true ) -> sortByName ( ) -> in ( $ dirPath ) ; // iterate to array $ files = iterator_to_array ( $ iterator , true ) ; $ finalContent = '<?php' . "\r\n" ; foreach ( $ files as $ file ) { $ finalContent .= "\r\n" ; $ finalContent .= '//' . implode ( '/' , array_slice ( explode ( '/' , $ file ) , - 6 ) ) . "\r\n" ; $ finalContent .= str_replace ( '<?php' , '' , file_get_contents ( ( string ) $ file ) ) . "\r\n" ; } file_put_contents ( $ directory . HCRoutes :: ROUTES_PATH , $ finalContent ) ; $ this -> comment ( $ directory . HCRoutes :: ROUTES_PATH . ' file generated' ) ; }
Generating final routes file for package

@param $directory
Generating final routes file for package