public function generate($_, $assoc_args)
    {
        $this->init_args(func_get_args());

        $updated = $this->update_salts($this->get_flag('force') ?: $this->salts_are_placeholders());

        if (! $this->env->save()) {
            WP_CLI::error('Failed to update salts.');
        }

        $skipped = $updated->pluck('skipped')->filter();
        $set = $this->salts->count() - $skipped->count();

        if ($set === count($this->salts)) {
            WP_CLI::success('Salts generated.');
        } elseif ($set) {
            WP_CLI::success("$set salts set.");
        }

        if (! $skipped->isEmpty()) {
            WP_CLI::line('Some keys were already defined in the environment file.');
            WP_CLI::line("Use 'dotenv salts regenerate' to update them.");
        }
    }
public function generate($_, $assoc_args)
    {
        $this->init_args(func_get_args());

        $updated = $this->update_salts($this->get_flag('force') ?: $this->salts_are_placeholders());

        if (! $this->env->save()) {
            WP_CLI::error('Failed to update salts.');
        }

        $skipped = $updated->pluck('skipped')->filter();
        $set = $this->salts->count() - $skipped->count();

        if ($set === count($this->salts)) {
            WP_CLI::success('Salts generated.');
        } elseif ($set) {
            WP_CLI::success("$set salts set.");
        }

        if (! $skipped->isEmpty()) {
            WP_CLI::line('Some keys were already defined in the environment file.');
            WP_CLI::line("Use 'dotenv salts regenerate' to update them.");
        }
    }
public function generate ( $ _ , $ assoc_args ) { $ this -> init_args ( func_get_args ( ) ) ; $ updated = $ this -> update_salts ( $ this -> get_flag ( 'force' ) ? : $ this -> salts_are_placeholders ( ) ) ; if ( ! $ this -> env -> save ( ) ) { WP_CLI :: error ( 'Failed to update salts.' ) ; } $ skipped = $ updated -> pluck ( 'skipped' ) -> filter ( ) ; $ set = $ this -> salts -> count ( ) - $ skipped -> count ( ) ; if ( $ set === count ( $ this -> salts ) ) { WP_CLI :: success ( 'Salts generated.' ) ; } elseif ( $ set ) { WP_CLI :: success ( "$set salts set." ) ; } if ( ! $ skipped -> isEmpty ( ) ) { WP_CLI :: line ( 'Some keys were already defined in the environment file.' ) ; WP_CLI :: line ( "Use 'dotenv salts regenerate' to update them." ) ; } }
Fetch some fresh salts and add them to the environment file if they do not already exist.

[--file=<path-to-dotenv>]
: Path to the environment file.  Default: '.env'

[--force]
: Overwrite any existing salts in the environment file.

@when before_wp_load

@param $_
@param $assoc_args
Fetch some fresh salts and add them to the environment file if they do not already exist .