refactoring container for speed.

This commit is contained in:
Taylor Otwell
2011-10-05 18:32:48 -05:00
parent 4263203dda
commit 71b0ab8b8d
32 changed files with 1221 additions and 1486 deletions

View File

@@ -4,6 +4,7 @@ use Closure;
use Laravel\IoC;
use Laravel\Str;
use Laravel\Lang;
use Laravel\Input;
use Laravel\Database\Manager as DB;
class Validator {
@@ -304,9 +305,7 @@ class Validator {
$value = $this->attributes[$attribute];
$files = IoC::container()->resolve('laravel.input')->file();
return (array_key_exists($attribute, $files)) ? $value['size'] / 1024 : Str::length(trim($value));
return (array_key_exists($attribute, Input::file())) ? $value['size'] / 1024 : Str::length(trim($value));
}
/**
@@ -478,7 +477,7 @@ class Validator {
// the default error message for the appropriate units.
if (in_array($rule, $this->size_rules) and ! $this->has_rule($attribute, $this->numeric_rules))
{
return (array_key_exists($attribute, IoC::container()->resolve('laravel.input')->file()))
return (array_key_exists($attribute, Input::file()))
? rtrim($message, '.').' '.Lang::line('validation.kilobytes')->get($this->language).'.'
: rtrim($message, '.').' '.Lang::line('validation.characters')->get($this->language).'.';
}