Use parse_url instead of manual parsing
parent
8b7a64ab28
commit
60fddb2c09
|
@ -161,7 +161,7 @@ class RemoteFilesystem
|
|||
throw new \RuntimeException($mess);
|
||||
}
|
||||
|
||||
$this->io->overwrite(' Authorization required (<info>' .$this->getHostname($this->fileUrl).'</info>):');
|
||||
$this->io->overwrite(' Authorization required (<info>'.parse_url($this->fileUrl, PHP_URL_HOST).'</info>):');
|
||||
$username = $this->io->ask(' Username: ');
|
||||
$password = $this->io->askAndHideAnswer(' Password: ');
|
||||
$this->io->setAuthorization($this->originUrl, $username, $password);
|
||||
|
@ -195,19 +195,4 @@ class RemoteFilesystem
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the hostname.
|
||||
*
|
||||
* @param string $url The file URL
|
||||
*
|
||||
* @return string The hostname
|
||||
*/
|
||||
protected function getHostname($url)
|
||||
{
|
||||
$host = substr($url, strpos($url, '://') + 3);
|
||||
$host = substr($host, 0, strpos($host, '/'));
|
||||
|
||||
return $host;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue