This commit is contained in:
2020-09-07 02:15:51 +08:00
parent db6497f256
commit 0b3036e082
3 changed files with 74 additions and 2 deletions
+31
View File
@@ -39,6 +39,7 @@ class Node extends Application
public $callback = [];
private $_interceptors = [];
private $_limits = [];
/**
* @param $handler
@@ -73,6 +74,15 @@ class Node extends Application
}
/**
* @return bool
*/
public function hasLimits()
{
return count($this->_limits) > 0;
}
/**
* @return array
*/
@@ -81,6 +91,16 @@ class Node extends Application
return $this->_interceptors;
}
/**
* @return array
*/
public function getLimits()
{
return $this->_limits;
}
/**
* @param $request
* @return bool
@@ -174,6 +194,17 @@ class Node extends Application
}
/**
* @param Closure|array|string $handler
* @throws Exception
*/
public function addLimits($handler)
{
$this->_limits[] = $handler;
$this->restructure();
}
/**
* @return string
* 错误信息