Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/ExtractorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,14 @@ public function createExtractor(UriInterface $uri, RequestInterface $request, Re
$class = $this->default;

foreach ($this->adapters as $adapterHost => $adapter) {
if (substr($host, -strlen($adapterHost)) === $adapterHost) {
// Check if $host is the same domain as $adapterHost.
if ($host === $adapterHost) {
$class = $adapter;
break;
}

// Check if $host is a subdomain of $adapterHost.
if (preg_match('/^([a-z0-9-]+)\.' . preg_quote($adapterHost, '/') . '$/i', $host, $matches)) {
$class = $adapter;
break;
}
Expand Down
Loading