|
|
@@ -617,6 +617,9 @@ class Request implements ArrayAccess
|
|
|
*/
|
|
|
public function is($type)
|
|
|
{
|
|
|
+ $args = func_get_args();
|
|
|
+ array_shift($args);
|
|
|
+
|
|
|
if (is_array($type)) {
|
|
|
$result = array_map([$this, 'is'], $type);
|
|
|
return count(array_filter($result)) > 0;
|
|
|
@@ -628,7 +631,7 @@ class Request implements ArrayAccess
|
|
|
}
|
|
|
|
|
|
if (!isset($this->_detectorCache[$type])) {
|
|
|
- $this->_detectorCache[$type] = $this->_is($type);
|
|
|
+ $this->_detectorCache[$type] = $this->_is($type, $args);
|
|
|
}
|
|
|
|
|
|
return $this->_detectorCache[$type];
|
|
|
@@ -651,11 +654,12 @@ class Request implements ArrayAccess
|
|
|
* this method will return true if the request matches any type.
|
|
|
* @return bool Whether or not the request is the type you are checking.
|
|
|
*/
|
|
|
- protected function _is($type)
|
|
|
+ protected function _is($type, $args)
|
|
|
{
|
|
|
$detect = static::$_detectors[$type];
|
|
|
if (is_callable($detect)) {
|
|
|
- return call_user_func($detect, $this);
|
|
|
+ array_unshift($args, $this);
|
|
|
+ return call_user_func_array($detect, $args);
|
|
|
}
|
|
|
if (isset($detect['env']) && $this->_environmentDetector($detect)) {
|
|
|
return true;
|