merged skunkworks into develop.

This commit is contained in:
Taylor Otwell
2012-01-16 13:59:24 -06:00
parent 610d8827c4
commit b5442c67fc
117 changed files with 7268 additions and 3999 deletions

View File

@@ -1,7 +1,6 @@
<?php namespace Laravel;
use Closure;
use Laravel\Session\Payload as Session;
class Request {
@@ -22,10 +21,6 @@ class Request {
/**
* Get the URI for the current request.
*
* If the request is to the root of the application, a single forward slash
* will be returned. Otherwise, the URI will be returned with all of the
* leading and trailing slashes removed.
*
* @return string
*/
public static function uri()
@@ -36,10 +31,6 @@ class Request {
/**
* Get the request method.
*
* This will usually be the value of the REQUEST_METHOD $_SERVER variable
* However, when the request method is spoofed using a hidden form value,
* the method will be stored in the $_POST array.
*
* @return string
*/
public static function method()
@@ -50,15 +41,13 @@ class Request {
/**
* Get an item from the $_SERVER array.
*
* Like most array retrieval methods, a default value may be specified.
*
* @param string $key
* @param mixed $default
* @return string
*/
public static function server($key = null, $default = null)
{
return Arr::get($_SERVER, strtoupper($key), $default);
return array_get($_SERVER, strtoupper($key), $default);
}
/**
@@ -92,7 +81,7 @@ class Request {
return $_SERVER['REMOTE_ADDR'];
}
return ($default instanceof Closure) ? call_user_func($default) : $default;
return value($default);
}
/**
@@ -102,7 +91,7 @@ class Request {
*/
public static function protocol()
{
return Arr::get($_SERVER, 'SERVER_PROTOCOL', 'HTTP/1.1');
return array_get($_SERVER, 'SERVER_PROTOCOL', 'HTTP/1.1');
}
/**
@@ -124,7 +113,7 @@ class Request {
*/
public static function forged()
{
return Input::get(Session::csrf_token) !== IoC::core('session')->token();
return Input::get(Session::csrf_token) !== Session::token();
}
/**
@@ -139,6 +128,16 @@ class Request {
return strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest';
}
/**
* Determine if the current request is via the command line.
*
* @return bool
*/
public static function cli()
{
return defined('STDIN');
}
/**
* Get the route handling the current request.
*