credentialsAreConfigured($credentials)) { throw new PluginNotConfiguredException('Username and/or password is missing'); } // Return cached initialized client if there is one. if (!empty($this->initializedClients[$credentials->getUsername()])) { return $this->initializedClients[$credentials->getUsername()]; } $this->initializedClients[$credentials->getUsername()] = new Client( [ 'auth' => [ $credentials->getUsername(), $credentials->getPassword(), ], ] ); return $this->initializedClients[$credentials->getUsername()]; } protected function credentialsAreConfigured(CredentialsInterface $credentials): bool { return $credentials->getUsername() && $credentials->getPassword(); } }