change is_callable checks to instanceof Closure.
This commit is contained in:
parent
429c9cee84
commit
fb3a0df0dd
|
|
@ -27,7 +27,7 @@ public static function get($array, $key, $default = null)
|
|||
{
|
||||
if ( ! is_array($array) or ! array_key_exists($segment, $array))
|
||||
{
|
||||
return is_callable($default) ? call_user_func($default) : $default;
|
||||
return ($default instanceof \Closure) ? call_user_func($default) : $default;
|
||||
}
|
||||
|
||||
$array = $array[$segment];
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public function get($key, $default = null)
|
|||
{
|
||||
if ( ! is_null($item = $this->retrieve($key))) return $item;
|
||||
|
||||
return (is_callable($default)) ? call_user_func($default) : $default;
|
||||
return ($default instanceof \Closure) ? call_user_func($default) : $default;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -82,7 +82,7 @@ public function remember($key, $value, $minutes)
|
|||
{
|
||||
if ( ! is_null($item = $this->get($key, null))) return $item;
|
||||
|
||||
$default = is_callable($default) ? call_user_func($default) : $default;
|
||||
$default = ($default instanceof \Closure) ? call_user_func($default) : $default;
|
||||
|
||||
$this->put($key, $default, $minutes);
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public static function get($key, $default = null)
|
|||
|
||||
if ( ! static::load($file))
|
||||
{
|
||||
return is_callable($default) ? call_user_func($default) : $default;
|
||||
return ($default instanceof \Closure) ? call_user_func($default) : $default;
|
||||
}
|
||||
|
||||
if (is_null($key)) return static::$items[$file];
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ public function get($default = null)
|
|||
|
||||
if ( ! $this->load($file))
|
||||
{
|
||||
return is_callable($default) ? call_user_func($default) : $default;
|
||||
return ($default instanceof \Closure) ? call_user_func($default) : $default;
|
||||
}
|
||||
|
||||
$line = Arr::get(static::$lines[$this->language.$file], $line, $default);
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ protected function find_route_closure(Route $route)
|
|||
{
|
||||
if (isset($route->callback['do'])) return $route->callback['do'];
|
||||
|
||||
foreach ($route->callback as $value) { if (is_callable($value)) return $value; }
|
||||
foreach ($route->callback as $value) { if ($value instanceof Closure) return $value; }
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ public function get($key, $default = null)
|
|||
if (array_key_exists($possibility, $this->session['data'])) return $this->session['data'][$possibility];
|
||||
}
|
||||
|
||||
return is_callable($default) ? call_user_func($default) : $default;
|
||||
return ($default instanceof \Closure) ? call_user_func($default) : $default;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ protected function compose()
|
|||
{
|
||||
foreach ((array) $composers[$this->view] as $key => $value)
|
||||
{
|
||||
if (is_callable($value)) return call_user_func($value, $this);
|
||||
if ($value instanceof \Closure) return call_user_func($value, $this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue