host = $host; $this->username = $username; $this->password = $password; $this->port = $port; } public function provideConnection(): SFTP { if ( ! $this->connection instanceof SFTP) { $connection = new SftpStub($this->host, $this->port); $connection->login($this->username, $this->password); $this->connection = $connection; } return $this->connection; } }