protected function getSize($attribute, $value)
{
$hasNumeric = $this->hasRule($attribute, $this->numericRules);
// This method will determine if the attribute is a number, string, or file and
// return the proper size accordingly. If it is a number, then number itself
// is the size. If it is a file, we take kilobytes, and for a string the
// entire length of the string will be considered the attribute size.
if (is_numeric($value) && $hasNumeric) {
return array_get($this->data, $attribute);
} elseif (is_array($value)) {
return count($value);
} elseif (in_array($value, $_FILES, true)) {
return $value->getSize() / 1024;
} else {
return $this->getStringSize($value);
}
}