moving some laravel classes around, switching alias to reflect changes. added some factories. removed system ioc container config file.

This commit is contained in:
Taylor Otwell
2011-11-11 21:27:30 -06:00
parent b625ebdcf3
commit b6ab0b08ce
23 changed files with 384 additions and 388 deletions

View File

@@ -75,6 +75,42 @@ class Arr {
$array[array_shift($keys)] = $value;
}
/**
* Remove an array item from a given array.
*
* The same "dot" syntax used by the "get" method may be used here.
*
* <code>
* // Remove the $array['user']['name'] item from the array
* Arr::forget($array, 'user.name');
* </code>
*
* @param array $array
* @param string $key
* @param mixed $value
* @return void
*/
public static function forget(&$array, $key)
{
if (is_null($key)) return;
$keys = explode('.', $key);
while (count($keys) > 1)
{
$key = array_shift($keys);
if ( ! isset($array[$key]) or ! is_array($array[$key]))
{
return;
}
$array =& $array[$key];
}
unset($array[array_shift($keys)]);
}
/**
* Return the first element in an array which passes a given truth test.
*