改名
This commit is contained in:
+35
-12
@@ -53,19 +53,19 @@ class Node extends Application
|
|||||||
*/
|
*/
|
||||||
public function bindHandler($handler)
|
public function bindHandler($handler)
|
||||||
{
|
{
|
||||||
if ($handler instanceof Closure) {
|
// if ($handler instanceof Closure) {
|
||||||
|
// $this->handler = $handler;
|
||||||
|
// } else if (is_string($handler) && strpos($handler, '@') !== false) {
|
||||||
|
// list($controller, $action) = explode('@', $handler);
|
||||||
|
// if (!empty($this->namespace)) {
|
||||||
|
// $controller = implode('\\', $this->namespace) . '\\' . $controller;
|
||||||
|
// }
|
||||||
|
// $this->handler = $this->getReflect($controller, $action);
|
||||||
|
// } else if ($handler != null && !is_callable($handler, true)) {
|
||||||
|
// $this->_error = 'Controller is con\'t exec.';
|
||||||
|
// } else {
|
||||||
|
// }
|
||||||
$this->handler = $handler;
|
$this->handler = $handler;
|
||||||
} else if (is_string($handler) && strpos($handler, '@') !== false) {
|
|
||||||
list($controller, $action) = explode('@', $handler);
|
|
||||||
if (!empty($this->namespace)) {
|
|
||||||
$controller = implode('\\', $this->namespace) . '\\' . $controller;
|
|
||||||
}
|
|
||||||
$this->handler = $this->getReflect($controller, $action);
|
|
||||||
} else if ($handler != null && !is_callable($handler, true)) {
|
|
||||||
$this->_error = 'Controller is con\'t exec.';
|
|
||||||
} else {
|
|
||||||
$this->handler = $handler;
|
|
||||||
}
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -395,9 +395,11 @@ class Node extends Application
|
|||||||
*/
|
*/
|
||||||
private function restructure()
|
private function restructure()
|
||||||
{
|
{
|
||||||
|
$this->resolveHandler();
|
||||||
if (empty($this->handler)) {
|
if (empty($this->handler)) {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
/** @var Middleware $made */
|
||||||
$made = Snowflake::createObject(Middleware::class);
|
$made = Snowflake::createObject(Middleware::class);
|
||||||
$made->setMiddleWares($this->middleware);
|
$made->setMiddleWares($this->middleware);
|
||||||
$made->getGenerate($this);
|
$made->getGenerate($this);
|
||||||
@@ -405,6 +407,27 @@ class Node extends Application
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws Exception
|
||||||
|
* 解析回调函数
|
||||||
|
*/
|
||||||
|
private function resolveHandler()
|
||||||
|
{
|
||||||
|
if ($this->handler instanceof \Closure) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (is_string($this->handler) && strpos($this->handler, '@') !== false) {
|
||||||
|
list($controller, $action) = explode('@', $this->handler);
|
||||||
|
if (!empty($this->namespace)) {
|
||||||
|
$controller = implode('\\', $this->namespace) . '\\' . $controller;
|
||||||
|
}
|
||||||
|
$this->handler = $this->getReflect($controller, $action);
|
||||||
|
} else if ($this->handler != null && !is_callable($this->handler, true)) {
|
||||||
|
$this->_error = 'Controller is con\'t exec.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
|||||||
Reference in New Issue
Block a user