-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
13 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
// +---------------------------------------------------------------------- | ||
// | Author: liu21st <[email protected]> | ||
// +---------------------------------------------------------------------- | ||
declare(strict_types=1); | ||
declare (strict_types = 1); | ||
|
||
namespace think; | ||
|
||
|
@@ -51,7 +51,7 @@ class Cookie | |
*/ | ||
public function __construct(protected Request $request, array $config = []) | ||
{ | ||
$this->config = array_merge($this->config, array_change_key_case($config)); | ||
$this->config = array_merge($this->config, array_change_key_case($config)); | ||
} | ||
|
||
public static function __make(Request $request, Config $config) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
// +---------------------------------------------------------------------- | ||
// | Author: liu21st <[email protected]> | ||
// +---------------------------------------------------------------------- | ||
declare(strict_types=1); | ||
declare (strict_types = 1); | ||
|
||
namespace think; | ||
|
||
|
@@ -285,7 +285,7 @@ public function option(array $option) | |
* @param mixed $rule 路由规则 | ||
* @return Domain | ||
*/ | ||
public function domain(string|array $name, $rule = null): Domain | ||
public function domain(string | array $name, $rule = null): Domain | ||
{ | ||
// 支持多个域名使用相同路由规则 | ||
$domainName = is_array($name) ? array_shift($name) : $name; | ||
|
@@ -513,7 +513,7 @@ public function setCrossDomainRule(Rule $rule) | |
* @param mixed $route 分组路由 | ||
* @return RuleGroup | ||
*/ | ||
public function group(string|Closure $name, $route = null): RuleGroup | ||
public function group(string | Closure $name, $route = null): RuleGroup | ||
{ | ||
if ($name instanceof Closure) { | ||
$route = $name; | ||
|
@@ -688,7 +688,7 @@ public function redirect(string $rule, string $route = '', int $status = 301): R | |
* @param array|bool $resource 资源 | ||
* @return $this | ||
*/ | ||
public function rest(string|array $name, array|bool $resource = []) | ||
public function rest(string | array $name, array | bool $resource = []) | ||
{ | ||
if (is_array($name)) { | ||
$this->rest = $resource ? $name : array_merge($this->rest, $name); | ||
|
@@ -721,7 +721,7 @@ public function getRest(string $name = null) | |
* @param string $method 请求类型 | ||
* @return RuleItem | ||
*/ | ||
public function miss(string|Closure $route, string $method = '*'): RuleItem | ||
public function miss(string | Closure $route, string $method = '*'): RuleItem | ||
{ | ||
return $this->group->miss($route, $method); | ||
} | ||
|
@@ -732,7 +732,7 @@ public function miss(string|Closure $route, string $method = '*'): RuleItem | |
* @param Closure|bool $withRoute | ||
* @return Response | ||
*/ | ||
public function dispatch(Request $request, Closure|bool $withRoute = true) | ||
public function dispatch(Request $request, Closure | bool $withRoute = true) | ||
{ | ||
$this->request = $request; | ||
$this->host = $this->request->host(true); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
// +---------------------------------------------------------------------- | ||
// | Author: liu21st <[email protected]> | ||
// +---------------------------------------------------------------------- | ||
declare(strict_types=1); | ||
declare (strict_types = 1); | ||
|
||
namespace think\route; | ||
|
||
|
@@ -170,9 +170,7 @@ public function check(Request $request, string $url, bool $completeMatch = false | |
} | ||
} | ||
|
||
if (!empty($option['dispatcher'])) { | ||
$result = $this->parseRule($request, '', $option['dispatcher'], $url, $option); | ||
} elseif ($miss = $this->getMissRule($method)) { | ||
if ($miss = $this->getMissRule($method)) { | ||
// 未匹配所有路由的路由规则处理 | ||
$result = $miss->parseRule($request, '', $miss->getRoute(), $url, $miss->getOption()); | ||
} else { | ||
|
@@ -355,11 +353,11 @@ protected function checkMergeRuleRegex(Request $request, array &$rules, string $ | |
* @param string $method 请求类型 | ||
* @return RuleItem | ||
*/ | ||
public function miss(string|Closure $route, string $method = '*'): RuleItem | ||
public function miss(string | Closure $route, string $method = '*'): RuleItem | ||
{ | ||
// 创建路由规则实例 | ||
$method = strtolower($method); | ||
$ruleItem = new RuleItem($this->router, $this, null, '', $route, $method); | ||
$method = strtolower($method); | ||
$ruleItem = new RuleItem($this->router, $this, null, '', $route, $method); | ||
|
||
$this->miss[$method] = $ruleItem->setMiss(); | ||
|
||
|