refactoring for better dependency injection on a few classes.

This commit is contained in:
Taylor Otwell
2011-10-29 22:24:32 -05:00
parent faaea17fd3
commit 932a70b6cf
13 changed files with 248 additions and 105 deletions

View File

@@ -341,7 +341,7 @@ class Validator {
{
return $this->attributes[$attribute];
}
elseif (array_key_exists($attribute, Input::file()))
elseif (array_key_exists($attribute, IoC::container()->core('input')->file()))
{
return $value['size'] / 1024;
}
@@ -529,7 +529,9 @@ class Validator {
// type of attribute being validated, either a file or a string.
elseif (in_array($rule, $this->size_rules) and ! $this->has_rule($attribute, $this->numeric_rules))
{
$line = (array_key_exists($attribute, Input::file())) ? "file" : "string";
$files = IoC::container()->core('input')->file();
$line = (array_key_exists($attribute, $files)) ? "file" : "string";
return Lang::line("validation.{$rule}.{$line}")->get($this->language);
}