reverting di refactoring.

This commit is contained in:
Taylor Otwell
2011-10-29 22:31:50 -05:00
parent f5680e4537
commit ef9e4dfd61
12 changed files with 101 additions and 181 deletions

View File

@@ -7,14 +7,7 @@ class Input {
*
* @var array
*/
protected $input;
/**
* The $_FILES array for the request.
*
* @var array
*/
protected $files;
public static $input;
/**
* The key used to store old input in the session.
@@ -23,19 +16,6 @@ class Input {
*/
const old_input = 'laravel_old_input';
/**
* Create a new instance of the Input manager.
*
* @param array $input
* @param array $files
* @return void
*/
public function __construct($input, $files)
{
$this->input = $input;
$this->files = $files;
}
/**
* Get all of the input data for the request.
*
@@ -43,9 +23,9 @@ class Input {
*
* @return array
*/
public function all()
public static function all()
{
return array_merge($this->get(), $this->file());
return array_merge(static::get(), static::file());
}
/**
@@ -56,9 +36,9 @@ class Input {
* @param string $key
* @return bool
*/
public function has($key)
public static function has($key)
{
return ( ! is_null($this->get($key)) and trim((string) $this->get($key)) !== '');
return ( ! is_null(static::get($key)) and trim((string) static::get($key)) !== '');
}
/**
@@ -78,9 +58,9 @@ class Input {
* @param mixed $default
* @return mixed
*/
public function get($key = null, $default = null)
public static function get($key = null, $default = null)
{
return Arr::get($this->input, $key, $default);
return Arr::get(static::$input, $key, $default);
}
/**
@@ -89,9 +69,9 @@ class Input {
* @param string $key
* @return bool
*/
public function had($key)
public static function had($key)
{
return ( ! is_null($this->old($key)) and trim((string) $this->old($key)) !== '');
return ( ! is_null(static::old($key)) and trim((string) static::old($key)) !== '');
}
/**
@@ -109,7 +89,7 @@ class Input {
* @param mixed $default
* @return string
*/
public function old($key = null, $default = null)
public static function old($key = null, $default = null)
{
if (Config::get('session.driver') == '')
{
@@ -134,9 +114,9 @@ class Input {
* @param mixed $default
* @return array
*/
public function file($key = null, $default = null)
public static function file($key = null, $default = null)
{
return Arr::get($this->files, $key, $default);
return Arr::get($_FILES, $key, $default);
}
/**
@@ -153,9 +133,9 @@ class Input {
* @param string $path
* @return bool
*/
public function upload($key, $path)
public static function upload($key, $path)
{
return array_key_exists($key, $this->files) ? File::upload($key, $path, $this->files) : false;
return array_key_exists($key, $_FILES) ? File::upload($key, $path, $_FILES) : false;
}
}