REBELinBLUE\Deployer\Console\Commands\InstallApp::getEmailInformation PHP Метод

getEmailInformation() приватный Метод

Prompts the user for the details for the email setup.
private getEmailInformation ( ) : array
Результат array
    private function getEmailInformation()
    {
        $this->header('Email details');
        $email = [];
        $driver = $this->choice('Type', ['smtp', 'sendmail', 'mail'], 0);
        if ($driver === 'smtp') {
            $host = $this->ask('Host', 'localhost');
            $port = $this->askAndValidate('Port', [], function ($answer) {
                $validator = Validator::make(['port' => $answer], ['port' => 'integer']);
                if (!$validator->passes()) {
                    throw new \RuntimeException($validator->errors()->first('port'));
                }
                return $answer;
            }, 25);
            $user = $this->ask('Username');
            $pass = $this->secret('Password');
            $email['host'] = $host;
            $email['port'] = $port;
            $email['username'] = $user;
            $email['password'] = $pass;
        }
        $from_name = $this->ask('From name', 'Deployer');
        $from_address = $this->askAndValidate('From address', [], function ($answer) {
            $validator = Validator::make(['from_address' => $answer], ['from_address' => 'email']);
            if (!$validator->passes()) {
                throw new \RuntimeException($validator->errors()->first('from_address'));
            }
            return $answer;
        }, '[email protected]');
        $email['from_name'] = $from_name;
        $email['from_address'] = $from_address;
        $email['driver'] = $driver;
        return $email;
    }