mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-13 19:04:03 +00:00
minor improvements for phpstan
This commit is contained in:
parent
62d19c5f5d
commit
f941df3a82
4 changed files with 18 additions and 9 deletions
|
|
@ -15,11 +15,16 @@ class CrossDomainRedirect implements Feature
|
|||
RedirectResponse::macro('domain', function (string $domain) {
|
||||
/** @var RedirectResponse $this */
|
||||
|
||||
// Replace first occurrence of the hostname fragment with $domain
|
||||
$url = $this->getTargetUrl();
|
||||
|
||||
/**
|
||||
* The original hostname in the redirect response.
|
||||
*
|
||||
* @var string $hostname
|
||||
*/
|
||||
$hostname = parse_url($url, PHP_URL_HOST);
|
||||
$position = strpos($url, $hostname);
|
||||
$this->setTargetUrl(substr_replace($url, $domain, $position, strlen($hostname)));
|
||||
|
||||
$this->setTargetUrl((string) str($url)->replace($hostname, $domain));
|
||||
|
||||
return $this;
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue