Commit bf6313e5 authored by Taylor Otwell's avatar Taylor Otwell

cleaning up code.

parent ba3f62f7
......@@ -161,8 +161,7 @@ class File {
// The MIME configuration file contains an array of file extensions and
// their associated MIME types. We will spin through each extension the
// developer wants to check to determine if the file's MIME type is in
// the list of MIMEs we have for that extension.
// developer wants to check and look for the MIME type.
foreach ((array) $extensions as $extension)
{
if (isset($mimes[$extension]) and in_array($mime, (array) $mimes[$extension]))
......
......@@ -177,18 +177,6 @@ function array_first($array, $callback, $default = null)
return value($default);
}
/**
* Spin through the array, executing a callback with each key and element.
*
* @param array $array
* @param mixed $callback
* @return array
*/
function array_spin($array, $callback)
{
return array_map($callback, array_keys($array), array_values($array));
}
/**
* Recursively remove slashes from array keys and values.
*
......
......@@ -129,11 +129,7 @@ class IoC {
// If the resolver is registering as a singleton resolver, we will cache
// the instance of the object in the container so we can resolve it next
// time without having to instantiate a new instance of the object.
//
// This allows the developer to reuse objects that do not need to be
// instantiated each time they are needed, such as a SwiftMailer or
// Twig object that can be shared.
// time without having to instantiate a brand new instance.
if (isset(static::$registry[$name]['singleton']))
{
return static::$singletons[$name] = $object;
......
......@@ -53,9 +53,10 @@ error_reporting(-1);
ini_set('display_errors', Config::get('error.display'));
/**
* Determine if we need to set the application key to a random
* string for the developer. This provides the developer with
* a zero configuration install process.
* Determine if we need to set the application key to a very random
* string so we can provide a zero configuration installation but
* still ensure that the key is set to something random. It is
* possible to disable this feature.
*/
$auto_key = Config::get('application.auto_key');
......
......@@ -697,14 +697,15 @@ class Validator {
protected function size_message($bundle, $attribute, $rule)
{
// There are three different types of size validations. The attribute
// may be either a number, file, or a string. If the attribute has a
// numeric rule attached to it, we can assume it is a number. If the
// attribute is in the file array, it is a file, otherwise we can
// assume the attribute is simply a string.
// may be either a number, file, or a string, so we'll check a few
// things to figure out which one it is.
if ($this->has_rule($attribute, $this->numeric_rules))
{
$line = 'numeric';
}
// We assume that attributes present in the $_FILES array are files,
// which makes sense. If the attribute doesn't have numeric rules
// and isn't as file, it's a string.
elseif (array_key_exists($attribute, Input::file()))
{
$line = 'file';
......@@ -877,15 +878,19 @@ class Validator {
// More reader friendly versions of the attribute names may be stored
// in the validation language file, allowing a more readable version
// of the attribute name to be used in the message.
//
// If no language line has been specified for the attribute, all of
// the underscores will be removed from the attribute name and that
// will be used as the attribtue name.
$line = "{$bundle}validation.attributes.{$attribute}";
$display = Lang::line($line)->get($this->language);
return (is_null($display)) ? str_replace('_', ' ', $attribute) : $display;
// If no language line has been specified for the attribute, all of
// the underscores are removed from the attribute name and that
// will be used as the attribtue name.
if (is_null($display))
{
return str_replace('_', ' ', $attribute);
}
return $display;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment