/** * @param resource $connection * @param Config $config * @return resource * @throws ConnectionFailed */ private function authenticateConnection($connection, Config $config) { $auth = @ssh2_auth_password($connection, $config->getUserName(), $config->getPassWord()); if (!$auth) { throw new ConnectionFailed('Authentication with ZyXEL failed'); } return $connection; }