Commit dbc418c0 authored by Taylor Otwell's avatar Taylor Otwell

changed Request::is to Request::route_is.

parent 2b4093f7
...@@ -74,17 +74,6 @@ class Request { ...@@ -74,17 +74,6 @@ class Request {
return ($uri == '') ? '/' : Str::lower($uri); return ($uri == '') ? '/' : Str::lower($uri);
} }
/**
* Determine if the route handling the request is a given name.
*
* @param string $name
* @return bool
*/
public static function is($name)
{
return (is_array(static::$route->callback) and isset(static::$route->callback['name']) and static::$route->callback['name'] === $name);
}
/** /**
* Get the request method. * Get the request method.
* *
...@@ -125,7 +114,7 @@ class Request { ...@@ -125,7 +114,7 @@ class Request {
* *
* @return bool * @return bool
*/ */
public static function secure() public static function is_secure()
{ {
return (static::protocol() == 'https'); return (static::protocol() == 'https');
} }
...@@ -145,11 +134,22 @@ class Request { ...@@ -145,11 +134,22 @@ class Request {
* *
* @return bool * @return bool
*/ */
public static function ajax() public static function is_ajax()
{ {
return (isset($_SERVER['HTTP_X_REQUESTED_WITH']) and Str::lower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest'); return (isset($_SERVER['HTTP_X_REQUESTED_WITH']) and Str::lower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest');
} }
/**
* Determine if the route handling the request is a given name.
*
* @param string $name
* @return bool
*/
public static function route_is($name)
{
return (is_array(static::$route->callback) and isset(static::$route->callback['name']) and static::$route->callback['name'] === $name);
}
/** /**
* Magic Method to handle dynamic static methods. * Magic Method to handle dynamic static methods.
*/ */
...@@ -160,9 +160,9 @@ class Request { ...@@ -160,9 +160,9 @@ class Request {
// //
// Example: Request::is_login() // Example: Request::is_login()
// -------------------------------------------------------------- // --------------------------------------------------------------
if (strpos($method, 'is_') === 0) if (strpos($method, 'route_is_') === 0)
{ {
return static::is(substr($method, 3)); return static::route_is(substr($method, 9));
} }
} }
......
...@@ -56,7 +56,7 @@ class Router { ...@@ -56,7 +56,7 @@ class Router {
if (preg_match('#^'.$key.'$#', $method.' '.$uri)) if (preg_match('#^'.$key.'$#', $method.' '.$uri))
{ {
return Request::$route = new Route($key, $callback, Route\Parser::parameters($uri, $key)); return Request::$route = new Route($keys, $callback, Route\Parser::parameters($uri, $key));
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment