<commit_before><?php

namespace Atnic\AdminLTE\Console\Commands;

use Illuminate\Console\Command;

/**
 * AdminLTE Make Command
 */
class AdminLTEMakeCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'make:admin-lte';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Scaffold basic make:auth with AdminLTE Template';

    /**
     * The views that need to be exported.
     *
     * @var array
     */
    protected $views = [
        'auth/login.stub' => 'auth/login.blade.php',
        'auth/register.stub' => 'auth/register.blade.php',
        'auth/passwords/email.stub' => 'auth/passwords/email.blade.php',
        'auth/passwords/reset.stub' => 'auth/passwords/reset.blade.php',
        'layouts/app.stub' => 'layouts/app.blade.php',
        'home.stub' => 'home.blade.php',
    ];

    /**
     * The assets that need to be exported.
     *
     * @var array
     */
    protected $assets = [
        'js/auth.stub' => 'js/auth.js',
        'js/admin-lte.stub' => 'js/admin-lte.js',
        'sass/auth.stub' => 'sass/auth.scss',
        'sass/admin-lte.stub' => 'sass/admin-lte.scss',
    ];

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $this->info('Execute make:auth');
        $this->call('make:auth', [ '--force' => true ]);

        $this->info('Start AdminLTE scaffolding');
        $this->info('Copying views...');
        foreach ($this->views as $key => $value) {
            copy(
                __DIR__.'/stubs/make/views/'.$key,
                resource_path('views/'.$value)
            );
        }
        $this->info('Copying assets...');
        foreach ($this->assets as $key => $value) {
            copy(
                __DIR__.'/stubs/make/assets/'.$key,
                resource_path('assets/'.$value)
            );
        }
        $this->info('Copying public...');
        $this->xcopy(__DIR__.'/stubs/make/public', base_path('public'));
        file_put_contents(
            base_path('webpack.mix.js'),
            file_get_contents(__DIR__.'/stubs/make/webpack.mix.stub'),
            FILE_APPEND
        );

        $this->info('AdminLTE scaffolding generated successfully.');
    }

    /**
     * Copy a file, or recursively copy a folder and its contents
     * @author      <NAME> <<EMAIL>>
     * @version     1.0.1
     * @link        http://aidanlister.com/2004/04/recursively-copying-directories-in-php/
     * @param       string   $source    Source path
     * @param       string   $dest      Destination path
     * @param       int      $permissions New folder creation permissions
     * @return      bool     Returns true on success, false on failure
     */
    private function xcopy($source, $dest, $permissions = 0755)
    {
        // Check for symlinks
        if (is_link($source)) {
            return symlink(readlink($source), $dest);
        }

        // Simple copy for a file
        if (is_file($source)) {<commit_msg>Add --views option<commit_after><?php

namespace Atnic\AdminLTE\Console\Commands;

use Illuminate\Console\Command;

/**
 * AdminLTE Make Command
 */
class AdminLTEMakeCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'make:admin-lte {--views : Only scaffold the views}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Scaffold basic make:auth with AdminLTE Template';

    /**
     * The views that need to be exported.
     *
     * @var array
     */
    protected $views = [
        'auth/login.stub' => 'auth/login.blade.php',
        'auth/register.stub' => 'auth/register.blade.php',
        'auth/passwords/email.stub' => 'auth/passwords/email.blade.php',
        'auth/passwords/reset.stub' => 'auth/passwords/reset.blade.php',
        'layouts/app.stub' => 'layouts/app.blade.php',
        'home.stub' => 'home.blade.php',
    ];

    /**
     * The assets that need to be exported.
     *
     * @var array
     */
    protected $assets = [
        'js/auth.stub' => 'js/auth.js',
        'js/admin-lte.stub' => 'js/admin-lte.js',
        'sass/auth.stub' => 'sass/auth.scss',
        'sass/admin-lte.stub' => 'sass/admin-lte.scss',
    ];

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $this->info('Execute make:auth');
        $this->call('make:auth', [ '--force' => true, '--views' => $this->option('views') ]);

        $this->info('Start AdminLTE scaffolding');
        $this->info('Copying views...');
        foreach ($this->views as $key => $value) {
            copy(
                __DIR__.'/stubs/make/views/'.$key,
                resource_path('views/'.$value)
            );
        }
        $this->info('Copying assets...');
        foreach ($this->assets as $key => $value) {
            copy(
                __DIR__.'/stubs/make/assets/'.$key,
                resource_path('assets/'.$value)
            );
        }
        $this->info('Copying public...');
        $this->xcopy(__DIR__.'/stubs/make/public', base_path('public'));

        if (!$this->option('views')) {
            file_put_contents(
                base_path('webpack.mix.js'),
                file_get_contents(__DIR__.'/stubs/make/webpack.mix.stub'),
                FILE_APPEND
            );
        }

        $this->info('AdminLTE scaffolding generated successfully.');
    }

    /**
     * Copy a file, or recursively copy a folder and its contents
     * @author      <NAME> <<EMAIL>>
     * @version     1.0.1
     * @link        http://aidanlister.com/2004/04/recursively-copying-directories-in-php/
     * @param       string   $source    Source path
     * @param       string   $dest      Destination path
     * @param       int      $permissions New folder creation permissions
     * @return      bool     Returns true on success, false on failure
     */
    private function xcopy($source, $dest, $permissions = 0755)
    {
        // Check for symlinks
        if (is_link($source)) {
            return symlink(readlink($source), $dest);
        }

        // Simple copy for a file
        if (is_file($source)) {
{'fraction_non_alphanumeric': 0.1515466983938132, 'fraction_numerical': 0.003866745984533016, 'mean_word_length': 1.8244435111297774, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 58, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6709768', 'n_tokens_mistral': 2084, 'n_tokens_neox': 2078, 'n_words': 423}