Skip to content

Commit b9f4269

Browse files
committed
Merge pull request #45 from skipperbent/development
Development
2 parents 925b976 + f1f5faa commit b9f4269

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

src/Pecee/SimpleRouter/RouterGroup.php

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,33 @@ public function __construct() {
1313
protected function matchDomain() {
1414
if($this->domain !== null) {
1515

16+
if(is_array($this->domain)) {
17+
18+
$max = count($this->domain);
19+
20+
for($i = 0; $i < $max; $i++) {
21+
$domain = $this->domain[$i];
22+
23+
$parameters = $this->parseParameters($domain, request()->getHost(), '[^.]*');
24+
25+
if($parameters !== null) {
26+
$this->parameters = $parameters;
27+
return true;
28+
}
29+
}
30+
31+
return null;
32+
}
33+
1634
$parameters = $this->parseParameters($this->domain, request()->getHost(), '[^.]*');
1735

18-
if($parameters !== null) {
36+
if ($parameters !== null) {
1937
$this->parameters = $parameters;
38+
return true;
2039
}
2140
}
41+
42+
return null;
2243
}
2344

2445
public function renderRoute(Request $request) {
@@ -37,7 +58,9 @@ public function renderRoute(Request $request) {
3758
throw new RouterException('Method not allowed');
3859
}
3960

40-
$this->matchDomain();
61+
if($this->matchDomain() === null) {
62+
return null;
63+
}
4164

4265
return parent::renderRoute($request);
4366
}

0 commit comments

Comments
 (0)