Skip to content

Commit bf6313e

Browse files
committed
cleaning up code.
1 parent ba3f62f commit bf6313e

File tree

5 files changed

+20
-31
lines changed

5 files changed

+20
-31
lines changed

laravel/file.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,7 @@ public static function is($extensions, $path)
161161

162162
// The MIME configuration file contains an array of file extensions and
163163
// their associated MIME types. We will spin through each extension the
164-
// developer wants to check to determine if the file's MIME type is in
165-
// the list of MIMEs we have for that extension.
164+
// developer wants to check and look for the MIME type.
166165
foreach ((array) $extensions as $extension)
167166
{
168167
if (isset($mimes[$extension]) and in_array($mime, (array) $mimes[$extension]))

laravel/helpers.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -177,18 +177,6 @@ function array_first($array, $callback, $default = null)
177177
return value($default);
178178
}
179179

180-
/**
181-
* Spin through the array, executing a callback with each key and element.
182-
*
183-
* @param array $array
184-
* @param mixed $callback
185-
* @return array
186-
*/
187-
function array_spin($array, $callback)
188-
{
189-
return array_map($callback, array_keys($array), array_values($array));
190-
}
191-
192180
/**
193181
* Recursively remove slashes from array keys and values.
194182
*

laravel/ioc.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,7 @@ public static function resolve($name, $parameters = array())
129129

130130
// If the resolver is registering as a singleton resolver, we will cache
131131
// the instance of the object in the container so we can resolve it next
132-
// time without having to instantiate a new instance of the object.
133-
//
134-
// This allows the developer to reuse objects that do not need to be
135-
// instantiated each time they are needed, such as a SwiftMailer or
136-
// Twig object that can be shared.
132+
// time without having to instantiate a brand new instance.
137133
if (isset(static::$registry[$name]['singleton']))
138134
{
139135
return static::$singletons[$name] = $object;

laravel/laravel.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@
5353
ini_set('display_errors', Config::get('error.display'));
5454

5555
/**
56-
* Determine if we need to set the application key to a random
57-
* string for the developer. This provides the developer with
58-
* a zero configuration install process.
56+
* Determine if we need to set the application key to a very random
57+
* string so we can provide a zero configuration installation but
58+
* still ensure that the key is set to something random. It is
59+
* possible to disable this feature.
5960
*/
6061
$auto_key = Config::get('application.auto_key');
6162

laravel/validator.php

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -697,14 +697,15 @@ protected function message($attribute, $rule)
697697
protected function size_message($bundle, $attribute, $rule)
698698
{
699699
// There are three different types of size validations. The attribute
700-
// may be either a number, file, or a string. If the attribute has a
701-
// numeric rule attached to it, we can assume it is a number. If the
702-
// attribute is in the file array, it is a file, otherwise we can
703-
// assume the attribute is simply a string.
700+
// may be either a number, file, or a string, so we'll check a few
701+
// things to figure out which one it is.
704702
if ($this->has_rule($attribute, $this->numeric_rules))
705703
{
706704
$line = 'numeric';
707705
}
706+
// We assume that attributes present in the $_FILES array are files,
707+
// which makes sense. If the attribute doesn't have numeric rules
708+
// and isn't as file, it's a string.
708709
elseif (array_key_exists($attribute, Input::file()))
709710
{
710711
$line = 'file';
@@ -877,15 +878,19 @@ protected function attribute($attribute)
877878
// More reader friendly versions of the attribute names may be stored
878879
// in the validation language file, allowing a more readable version
879880
// of the attribute name to be used in the message.
880-
//
881-
// If no language line has been specified for the attribute, all of
882-
// the underscores will be removed from the attribute name and that
883-
// will be used as the attribtue name.
884881
$line = "{$bundle}validation.attributes.{$attribute}";
885882

886883
$display = Lang::line($line)->get($this->language);
887884

888-
return (is_null($display)) ? str_replace('_', ' ', $attribute) : $display;
885+
// If no language line has been specified for the attribute, all of
886+
// the underscores are removed from the attribute name and that
887+
// will be used as the attribtue name.
888+
if (is_null($display))
889+
{
890+
return str_replace('_', ' ', $attribute);
891+
}
892+
893+
return $display;
889894
}
890895

891896
/**

0 commit comments

Comments
 (0)