src/classes/Console/Commands/MakeCommandCommand.php
private function makeTemplate($command)
    {
        $file = __DIR__ . "/../templates/command.php.dist";

        try {
            if (!file_exists($file)) throw new \Exception("{$file} file is not exist.", 1);

            $template = strtr(file_get_contents($file), [
                '{{namespace}}' => get_app_namespace(),
                '{{command}}' => $command,
                '{{command_name}}' => strtolower($command)
            ]);

            if (!file_exists(app_path("Commands")))
            {
                mkdir(app_path("Commands"), 0755, true);
            }

            $file_path = app_path("Commands/{$command}.php");

            $file = fopen($file_path, "w");
            fwrite($file, $template);
            fclose($file);

            return file_exists($file_path);

        } catch (Exception $e) {
            $output->writeln($e->getMessage());
        }

        return false;
    }
private function makeTemplate($command)
    {
        $file = __DIR__ . "/../templates/command.php.dist";

        try {
            if (!file_exists($file)) throw new \Exception("{$file} file is not exist.", 1);

            $template = strtr(file_get_contents($file), [
                '{{namespace}}' => get_app_namespace(),
                '{{command}}' => $command,
                '{{command_name}}' => strtolower($command)
            ]);

            if (!file_exists(app_path("Commands")))
            {
                mkdir(app_path("Commands"), 0755, true);
            }

            $file_path = app_path("Commands/{$command}.php");

            $file = fopen($file_path, "w");
            fwrite($file, $template);
            fclose($file);

            return file_exists($file_path);

        } catch (Exception $e) {
            $output->writeln($e->getMessage());
        }

        return false;
    }
private function makeTemplate ( $ command ) { $ file = __DIR__ . "/../templates/command.php.dist" ; try { if ( ! file_exists ( $ file ) ) throw new \ Exception ( "{$file} file is not exist." , 1 ) ; $ template = strtr ( file_get_contents ( $ file ) , [ '{{namespace}}' => get_app_namespace ( ) , '{{command}}' => $ command , '{{command_name}}' => strtolower ( $ command ) ] ) ; if ( ! file_exists ( app_path ( "Commands" ) ) ) { mkdir ( app_path ( "Commands" ) , 0755 , true ) ; } $ file_path = app_path ( "Commands/{$command}.php" ) ; $ file = fopen ( $ file_path , "w" ) ; fwrite ( $ file , $ template ) ; fclose ( $ file ) ; return file_exists ( $ file_path ) ; } catch ( Exception $ e ) { $ output -> writeln ( $ e -> getMessage ( ) ) ; } return false ; }
Create the command template.

@depends handle
@param  string $command
@return boolean
Create the command template .