Added vendor/ directory for Composer's installed files
This commit is contained in:
53
vendor/illuminate/support/AggregateServiceProvider.php
vendored
Executable file
53
vendor/illuminate/support/AggregateServiceProvider.php
vendored
Executable file
@ -0,0 +1,53 @@
|
||||
<?php namespace Illuminate\Support;
|
||||
|
||||
class AggregateServiceProvider extends ServiceProvider {
|
||||
|
||||
/**
|
||||
* The provider class names.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $providers = [];
|
||||
|
||||
/**
|
||||
* An array of the service provider instances.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $instances = [];
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->instances = [];
|
||||
|
||||
foreach ($this->providers as $provider)
|
||||
{
|
||||
$this->instances[] = $this->app->register($provider);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
$provides = [];
|
||||
|
||||
foreach ($this->providers as $provider)
|
||||
{
|
||||
$instance = $this->app->resolveProviderClass($provider);
|
||||
|
||||
$provides = array_merge($provides, $instance->provides());
|
||||
}
|
||||
|
||||
return $provides;
|
||||
}
|
||||
|
||||
}
|
410
vendor/illuminate/support/Arr.php
vendored
Executable file
410
vendor/illuminate/support/Arr.php
vendored
Executable file
@ -0,0 +1,410 @@
|
||||
<?php namespace Illuminate\Support;
|
||||
|
||||
use Illuminate\Support\Traits\Macroable;
|
||||
|
||||
class Arr {
|
||||
|
||||
use Macroable;
|
||||
|
||||
/**
|
||||
* Add an element to an array using "dot" notation if it doesn't exist.
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @return array
|
||||
*/
|
||||
public static function add($array, $key, $value)
|
||||
{
|
||||
if (is_null(static::get($array, $key)))
|
||||
{
|
||||
static::set($array, $key, $value);
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a new array using a callback.
|
||||
*
|
||||
* @param array $array
|
||||
* @param callable $callback
|
||||
* @return array
|
||||
*/
|
||||
public static function build($array, callable $callback)
|
||||
{
|
||||
$results = [];
|
||||
|
||||
foreach ($array as $key => $value)
|
||||
{
|
||||
list($innerKey, $innerValue) = call_user_func($callback, $key, $value);
|
||||
|
||||
$results[$innerKey] = $innerValue;
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Collapse an array of arrays into a single array.
|
||||
*
|
||||
* @param array|\ArrayAccess $array
|
||||
* @return array
|
||||
*/
|
||||
public static function collapse($array)
|
||||
{
|
||||
$results = [];
|
||||
|
||||
foreach ($array as $values)
|
||||
{
|
||||
if ($values instanceof Collection) $values = $values->all();
|
||||
|
||||
$results = array_merge($results, $values);
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Divide an array into two arrays. One with keys and the other with values.
|
||||
*
|
||||
* @param array $array
|
||||
* @return array
|
||||
*/
|
||||
public static function divide($array)
|
||||
{
|
||||
return [array_keys($array), array_values($array)];
|
||||
}
|
||||
|
||||
/**
|
||||
* Flatten a multi-dimensional associative array with dots.
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $prepend
|
||||
* @return array
|
||||
*/
|
||||
public static function dot($array, $prepend = '')
|
||||
{
|
||||
$results = [];
|
||||
|
||||
foreach ($array as $key => $value)
|
||||
{
|
||||
if (is_array($value))
|
||||
{
|
||||
$results = array_merge($results, static::dot($value, $prepend.$key.'.'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$results[$prepend.$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the given array except for a specified array of items.
|
||||
*
|
||||
* @param array $array
|
||||
* @param array|string $keys
|
||||
* @return array
|
||||
*/
|
||||
public static function except($array, $keys)
|
||||
{
|
||||
foreach ((array) $keys as $key)
|
||||
{
|
||||
static::forget($array, $key);
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a flattened array of a nested array element.
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $key
|
||||
* @return array
|
||||
*/
|
||||
public static function fetch($array, $key)
|
||||
{
|
||||
foreach (explode('.', $key) as $segment)
|
||||
{
|
||||
$results = [];
|
||||
|
||||
foreach ($array as $value)
|
||||
{
|
||||
if (array_key_exists($segment, $value = (array) $value))
|
||||
{
|
||||
$results[] = $value[$segment];
|
||||
}
|
||||
}
|
||||
|
||||
$array = array_values($results);
|
||||
}
|
||||
|
||||
return array_values($results);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the first element in an array passing a given truth test.
|
||||
*
|
||||
* @param array $array
|
||||
* @param callable $callback
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public static function first($array, callable $callback, $default = null)
|
||||
{
|
||||
foreach ($array as $key => $value)
|
||||
{
|
||||
if (call_user_func($callback, $key, $value)) return $value;
|
||||
}
|
||||
|
||||
return value($default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the last element in an array passing a given truth test.
|
||||
*
|
||||
* @param array $array
|
||||
* @param callable $callback
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public static function last($array, callable $callback, $default = null)
|
||||
{
|
||||
return static::first(array_reverse($array), $callback, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Flatten a multi-dimensional array into a single level.
|
||||
*
|
||||
* @param array $array
|
||||
* @return array
|
||||
*/
|
||||
public static function flatten($array)
|
||||
{
|
||||
$return = [];
|
||||
|
||||
array_walk_recursive($array, function($x) use (&$return) { $return[] = $x; });
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove one or many array items from a given array using "dot" notation.
|
||||
*
|
||||
* @param array $array
|
||||
* @param array|string $keys
|
||||
* @return void
|
||||
*/
|
||||
public static function forget(&$array, $keys)
|
||||
{
|
||||
$original =& $array;
|
||||
|
||||
foreach ((array) $keys as $key)
|
||||
{
|
||||
$parts = explode('.', $key);
|
||||
|
||||
while (count($parts) > 1)
|
||||
{
|
||||
$part = array_shift($parts);
|
||||
|
||||
if (isset($array[$part]) && is_array($array[$part]))
|
||||
{
|
||||
$array =& $array[$part];
|
||||
}
|
||||
}
|
||||
|
||||
unset($array[array_shift($parts)]);
|
||||
|
||||
// clean up after each pass
|
||||
$array =& $original;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an item from an array using "dot" notation.
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public static function get($array, $key, $default = null)
|
||||
{
|
||||
if (is_null($key)) return $array;
|
||||
|
||||
if (isset($array[$key])) return $array[$key];
|
||||
|
||||
foreach (explode('.', $key) as $segment)
|
||||
{
|
||||
if ( ! is_array($array) || ! array_key_exists($segment, $array))
|
||||
{
|
||||
return value($default);
|
||||
}
|
||||
|
||||
$array = $array[$segment];
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an item exists in an array using "dot" notation.
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $key
|
||||
* @return bool
|
||||
*/
|
||||
public static function has($array, $key)
|
||||
{
|
||||
if (empty($array) || is_null($key)) return false;
|
||||
|
||||
if (array_key_exists($key, $array)) return true;
|
||||
|
||||
foreach (explode('.', $key) as $segment)
|
||||
{
|
||||
if ( ! is_array($array) || ! array_key_exists($segment, $array))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$array = $array[$segment];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a subset of the items from the given array.
|
||||
*
|
||||
* @param array $array
|
||||
* @param array|string $keys
|
||||
* @return array
|
||||
*/
|
||||
public static function only($array, $keys)
|
||||
{
|
||||
return array_intersect_key($array, array_flip((array) $keys));
|
||||
}
|
||||
|
||||
/**
|
||||
* Pluck an array of values from an array.
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $value
|
||||
* @param string $key
|
||||
* @return array
|
||||
*/
|
||||
public static function pluck($array, $value, $key = null)
|
||||
{
|
||||
$results = [];
|
||||
|
||||
foreach ($array as $item)
|
||||
{
|
||||
$itemValue = data_get($item, $value);
|
||||
|
||||
// If the key is "null", we will just append the value to the array and keep
|
||||
// looping. Otherwise we will key the array using the value of the key we
|
||||
// received from the developer. Then we'll return the final array form.
|
||||
if (is_null($key))
|
||||
{
|
||||
$results[] = $itemValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
$itemKey = data_get($item, $key);
|
||||
|
||||
$results[$itemKey] = $itemValue;
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a value from the array, and remove it.
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public static function pull(&$array, $key, $default = null)
|
||||
{
|
||||
$value = static::get($array, $key, $default);
|
||||
|
||||
static::forget($array, $key);
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an array item to a given value using "dot" notation.
|
||||
*
|
||||
* If no key is given to the method, the entire array will be replaced.
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @return array
|
||||
*/
|
||||
public static function set(&$array, $key, $value)
|
||||
{
|
||||
if (is_null($key)) return $array = $value;
|
||||
|
||||
$keys = explode('.', $key);
|
||||
|
||||
while (count($keys) > 1)
|
||||
{
|
||||
$key = array_shift($keys);
|
||||
|
||||
// If the key doesn't exist at this depth, we will just create an empty array
|
||||
// to hold the next value, allowing us to create the arrays to hold final
|
||||
// values at the correct depth. Then we'll keep digging into the array.
|
||||
if ( ! isset($array[$key]) || ! is_array($array[$key]))
|
||||
{
|
||||
$array[$key] = [];
|
||||
}
|
||||
|
||||
$array =& $array[$key];
|
||||
}
|
||||
|
||||
$array[array_shift($keys)] = $value;
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort the array using the given callback.
|
||||
*
|
||||
* @param array $array
|
||||
* @param callable $callback
|
||||
* @return array
|
||||
*/
|
||||
public static function sort($array, callable $callback)
|
||||
{
|
||||
return Collection::make($array)->sortBy($callback)->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the array using the given callback.
|
||||
*
|
||||
* @param array $array
|
||||
* @param callable $callback
|
||||
* @return array
|
||||
*/
|
||||
public static function where($array, callable $callback)
|
||||
{
|
||||
$filtered = [];
|
||||
|
||||
foreach ($array as $key => $value)
|
||||
{
|
||||
if (call_user_func($callback, $key, $value)) $filtered[$key] = $value;
|
||||
}
|
||||
|
||||
return $filtered;
|
||||
}
|
||||
|
||||
}
|
107
vendor/illuminate/support/ClassLoader.php
vendored
Executable file
107
vendor/illuminate/support/ClassLoader.php
vendored
Executable file
@ -0,0 +1,107 @@
|
||||
<?php namespace Illuminate\Support;
|
||||
|
||||
class ClassLoader {
|
||||
|
||||
/**
|
||||
* The registered directories.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $directories = array();
|
||||
|
||||
/**
|
||||
* Indicates if a ClassLoader has been registered.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected static $registered = false;
|
||||
|
||||
/**
|
||||
* Load the given class file.
|
||||
*
|
||||
* @param string $class
|
||||
* @return bool
|
||||
*/
|
||||
public static function load($class)
|
||||
{
|
||||
$class = static::normalizeClass($class);
|
||||
|
||||
foreach (static::$directories as $directory)
|
||||
{
|
||||
if (file_exists($path = $directory.DIRECTORY_SEPARATOR.$class))
|
||||
{
|
||||
require_once $path;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the normal file name for a class.
|
||||
*
|
||||
* @param string $class
|
||||
* @return string
|
||||
*/
|
||||
public static function normalizeClass($class)
|
||||
{
|
||||
if ($class[0] == '\\') $class = substr($class, 1);
|
||||
|
||||
return str_replace(array('\\', '_'), DIRECTORY_SEPARATOR, $class).'.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the given class loader on the auto-loader stack.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function register()
|
||||
{
|
||||
if ( ! static::$registered)
|
||||
{
|
||||
static::$registered = spl_autoload_register(array('\Illuminate\Support\ClassLoader', 'load'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add directories to the class loader.
|
||||
*
|
||||
* @param string|array $directories
|
||||
* @return void
|
||||
*/
|
||||
public static function addDirectories($directories)
|
||||
{
|
||||
static::$directories = array_unique(array_merge(static::$directories, (array) $directories));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove directories from the class loader.
|
||||
*
|
||||
* @param string|array $directories
|
||||
* @return void
|
||||
*/
|
||||
public static function removeDirectories($directories = null)
|
||||
{
|
||||
if (is_null($directories))
|
||||
{
|
||||
static::$directories = array();
|
||||
}
|
||||
else
|
||||
{
|
||||
static::$directories = array_diff(static::$directories, (array) $directories);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all the directories registered with the loader.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getDirectories()
|
||||
{
|
||||
return static::$directories;
|
||||
}
|
||||
|
||||
}
|
907
vendor/illuminate/support/Collection.php
vendored
Executable file
907
vendor/illuminate/support/Collection.php
vendored
Executable file
@ -0,0 +1,907 @@
|
||||
<?php namespace Illuminate\Support;
|
||||
|
||||
use Closure;
|
||||
use Countable;
|
||||
use ArrayAccess;
|
||||
use ArrayIterator;
|
||||
use CachingIterator;
|
||||
use JsonSerializable;
|
||||
use IteratorAggregate;
|
||||
use Illuminate\Contracts\Support\Jsonable;
|
||||
use Illuminate\Contracts\Support\Arrayable;
|
||||
|
||||
class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate, Jsonable, JsonSerializable {
|
||||
|
||||
/**
|
||||
* The items contained in the collection.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $items = array();
|
||||
|
||||
/**
|
||||
* Create a new collection.
|
||||
*
|
||||
* @param mixed $items
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($items = array())
|
||||
{
|
||||
$items = is_null($items) ? [] : $this->getArrayableItems($items);
|
||||
|
||||
$this->items = (array) $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new collection instance if the value isn't one already.
|
||||
*
|
||||
* @param mixed $items
|
||||
* @return static
|
||||
*/
|
||||
public static function make($items = null)
|
||||
{
|
||||
return new static($items);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the items in the collection.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
return $this->items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Collapse the collection of items into a single array.
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function collapse()
|
||||
{
|
||||
return new static(array_collapse($this->items));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if an item exists in the collection.
|
||||
*
|
||||
* @param mixed $key
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public function contains($key, $value = null)
|
||||
{
|
||||
if (func_num_args() == 2)
|
||||
{
|
||||
return $this->contains(function($k, $item) use ($key, $value)
|
||||
{
|
||||
return data_get($item, $key) == $value;
|
||||
});
|
||||
}
|
||||
|
||||
if ($this->useAsCallable($key))
|
||||
{
|
||||
return ! is_null($this->first($key));
|
||||
}
|
||||
|
||||
return in_array($key, $this->items);
|
||||
}
|
||||
|
||||
/**
|
||||
* Diff the collection with the given items.
|
||||
*
|
||||
* @param \Illuminate\Support\Collection|\Illuminate\Contracts\Support\Arrayable|array $items
|
||||
* @return static
|
||||
*/
|
||||
public function diff($items)
|
||||
{
|
||||
return new static(array_diff($this->items, $this->getArrayableItems($items)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a callback over each item.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return $this
|
||||
*/
|
||||
public function each(callable $callback)
|
||||
{
|
||||
array_map($callback, $this->items);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a nested element of the collection.
|
||||
*
|
||||
* @param string $key
|
||||
* @return static
|
||||
*/
|
||||
public function fetch($key)
|
||||
{
|
||||
return new static(array_fetch($this->items, $key));
|
||||
}
|
||||
|
||||
/**
|
||||
* Run a filter over each of the items.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return static
|
||||
*/
|
||||
public function filter(callable $callback)
|
||||
{
|
||||
return new static(array_filter($this->items, $callback));
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter items by the given key value pair.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @param bool $strict
|
||||
* @return static
|
||||
*/
|
||||
public function where($key, $value, $strict = true)
|
||||
{
|
||||
return $this->filter(function($item) use ($key, $value, $strict)
|
||||
{
|
||||
return $strict ? data_get($item, $key) === $value
|
||||
: data_get($item, $key) == $value;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter items by the given key value pair using loose comparison.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @return static
|
||||
*/
|
||||
public function whereLoose($key, $value)
|
||||
{
|
||||
return $this->where($key, $value, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the first item from the collection.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @param mixed $default
|
||||
* @return mixed|null
|
||||
*/
|
||||
public function first(callable $callback = null, $default = null)
|
||||
{
|
||||
if (is_null($callback))
|
||||
{
|
||||
return count($this->items) > 0 ? reset($this->items) : null;
|
||||
}
|
||||
|
||||
return array_first($this->items, $callback, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a flattened array of the items in the collection.
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function flatten()
|
||||
{
|
||||
return new static(array_flatten($this->items));
|
||||
}
|
||||
|
||||
/**
|
||||
* Flip the items in the collection.
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function flip()
|
||||
{
|
||||
return new static(array_flip($this->items));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove an item from the collection by key.
|
||||
*
|
||||
* @param mixed $key
|
||||
* @return void
|
||||
*/
|
||||
public function forget($key)
|
||||
{
|
||||
$this->offsetUnset($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an item from the collection by key.
|
||||
*
|
||||
* @param mixed $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($key, $default = null)
|
||||
{
|
||||
if ($this->offsetExists($key))
|
||||
{
|
||||
return $this->items[$key];
|
||||
}
|
||||
|
||||
return value($default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Group an associative array by a field or using a callback.
|
||||
*
|
||||
* @param callable|string $groupBy
|
||||
* @return static
|
||||
*/
|
||||
public function groupBy($groupBy)
|
||||
{
|
||||
if ( ! $this->useAsCallable($groupBy))
|
||||
{
|
||||
return $this->groupBy($this->valueRetriever($groupBy));
|
||||
}
|
||||
|
||||
$results = [];
|
||||
|
||||
foreach ($this->items as $key => $value)
|
||||
{
|
||||
$results[$groupBy($value, $key)][] = $value;
|
||||
}
|
||||
|
||||
return new static($results);
|
||||
}
|
||||
|
||||
/**
|
||||
* Key an associative array by a field or using a callback.
|
||||
*
|
||||
* @param callable|string $keyBy
|
||||
* @return static
|
||||
*/
|
||||
public function keyBy($keyBy)
|
||||
{
|
||||
if ( ! $this->useAsCallable($keyBy))
|
||||
{
|
||||
return $this->keyBy($this->valueRetriever($keyBy));
|
||||
}
|
||||
|
||||
$results = [];
|
||||
|
||||
foreach ($this->items as $item)
|
||||
{
|
||||
$results[$keyBy($item)] = $item;
|
||||
}
|
||||
|
||||
return new static($results);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if an item exists in the collection by key.
|
||||
*
|
||||
* @param mixed $key
|
||||
* @return bool
|
||||
*/
|
||||
public function has($key)
|
||||
{
|
||||
return $this->offsetExists($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Concatenate values of a given key as a string.
|
||||
*
|
||||
* @param string $value
|
||||
* @param string $glue
|
||||
* @return string
|
||||
*/
|
||||
public function implode($value, $glue = null)
|
||||
{
|
||||
$first = $this->first();
|
||||
|
||||
if (is_array($first) || is_object($first))
|
||||
{
|
||||
return implode($glue, $this->lists($value));
|
||||
}
|
||||
|
||||
return implode($value, $this->items);
|
||||
}
|
||||
|
||||
/**
|
||||
* Intersect the collection with the given items.
|
||||
*
|
||||
* @param \Illuminate\Support\Collection|\Illuminate\Contracts\Support\Arrayable|array $items
|
||||
* @return static
|
||||
*/
|
||||
public function intersect($items)
|
||||
{
|
||||
return new static(array_intersect($this->items, $this->getArrayableItems($items)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the collection is empty or not.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isEmpty()
|
||||
{
|
||||
return empty($this->items);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given value is callable, but not a string.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
protected function useAsCallable($value)
|
||||
{
|
||||
return ! is_string($value) && is_callable($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the keys of the collection items.
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function keys()
|
||||
{
|
||||
return new static(array_keys($this->items));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the last item from the collection.
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
public function last()
|
||||
{
|
||||
return count($this->items) > 0 ? end($this->items) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array with the values of a given key.
|
||||
*
|
||||
* @param string $value
|
||||
* @param string $key
|
||||
* @return array
|
||||
*/
|
||||
public function lists($value, $key = null)
|
||||
{
|
||||
return array_pluck($this->items, $value, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Run a map over each of the items.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return static
|
||||
*/
|
||||
public function map(callable $callback)
|
||||
{
|
||||
return new static(array_map($callback, $this->items, array_keys($this->items)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge the collection with the given items.
|
||||
*
|
||||
* @param \Illuminate\Support\Collection|\Illuminate\Contracts\Support\Arrayable|array $items
|
||||
* @return static
|
||||
*/
|
||||
public function merge($items)
|
||||
{
|
||||
return new static(array_merge($this->items, $this->getArrayableItems($items)));
|
||||
}
|
||||
|
||||
/**
|
||||
* "Paginate" the collection by slicing it into a smaller collection.
|
||||
*
|
||||
* @param int $page
|
||||
* @param int $perPage
|
||||
* @return static
|
||||
*/
|
||||
public function forPage($page, $perPage)
|
||||
{
|
||||
return $this->slice(($page - 1) * $perPage, $perPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get and remove the last item from the collection.
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
public function pop()
|
||||
{
|
||||
return array_pop($this->items);
|
||||
}
|
||||
|
||||
/**
|
||||
* Push an item onto the beginning of the collection.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
*/
|
||||
public function prepend($value)
|
||||
{
|
||||
array_unshift($this->items, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Push an item onto the end of the collection.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
*/
|
||||
public function push($value)
|
||||
{
|
||||
$this->offsetSet(null, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pulls an item from the collection.
|
||||
*
|
||||
* @param mixed $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public function pull($key, $default = null)
|
||||
{
|
||||
return array_pull($this->items, $key, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Put an item in the collection by key.
|
||||
*
|
||||
* @param mixed $key
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
*/
|
||||
public function put($key, $value)
|
||||
{
|
||||
$this->offsetSet($key, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get one or more items randomly from the collection.
|
||||
*
|
||||
* @param int $amount
|
||||
* @return mixed
|
||||
*/
|
||||
public function random($amount = 1)
|
||||
{
|
||||
if ($this->isEmpty()) return;
|
||||
|
||||
$keys = array_rand($this->items, $amount);
|
||||
|
||||
return is_array($keys) ? array_intersect_key($this->items, array_flip($keys)) : $this->items[$keys];
|
||||
}
|
||||
|
||||
/**
|
||||
* Reduce the collection to a single value.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @param mixed $initial
|
||||
* @return mixed
|
||||
*/
|
||||
public function reduce(callable $callback, $initial = null)
|
||||
{
|
||||
return array_reduce($this->items, $callback, $initial);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a collection of all elements that do not pass a given truth test.
|
||||
*
|
||||
* @param callable|mixed $callback
|
||||
* @return static
|
||||
*/
|
||||
public function reject($callback)
|
||||
{
|
||||
if ($this->useAsCallable($callback))
|
||||
{
|
||||
return $this->filter(function($item) use ($callback)
|
||||
{
|
||||
return ! $callback($item);
|
||||
});
|
||||
}
|
||||
|
||||
return $this->filter(function($item) use ($callback)
|
||||
{
|
||||
return $item != $callback;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse items order.
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function reverse()
|
||||
{
|
||||
return new static(array_reverse($this->items));
|
||||
}
|
||||
|
||||
/**
|
||||
* Search the collection for a given value and return the corresponding key if successful.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param bool $strict
|
||||
* @return mixed
|
||||
*/
|
||||
public function search($value, $strict = false)
|
||||
{
|
||||
if ( ! $this->useAsCallable($value))
|
||||
{
|
||||
return array_search($value, $this->items, $strict);
|
||||
}
|
||||
|
||||
foreach ($this->items as $key => $item)
|
||||
{
|
||||
if ($value($item, $key)) return $key;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get and remove the first item from the collection.
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
public function shift()
|
||||
{
|
||||
return array_shift($this->items);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shuffle the items in the collection.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function shuffle()
|
||||
{
|
||||
shuffle($this->items);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Slice the underlying collection array.
|
||||
*
|
||||
* @param int $offset
|
||||
* @param int $length
|
||||
* @param bool $preserveKeys
|
||||
* @return static
|
||||
*/
|
||||
public function slice($offset, $length = null, $preserveKeys = false)
|
||||
{
|
||||
return new static(array_slice($this->items, $offset, $length, $preserveKeys));
|
||||
}
|
||||
|
||||
/**
|
||||
* Chunk the underlying collection array.
|
||||
*
|
||||
* @param int $size
|
||||
* @param bool $preserveKeys
|
||||
* @return static
|
||||
*/
|
||||
public function chunk($size, $preserveKeys = false)
|
||||
{
|
||||
$chunks = [];
|
||||
|
||||
foreach (array_chunk($this->items, $size, $preserveKeys) as $chunk)
|
||||
{
|
||||
$chunks[] = new static($chunk);
|
||||
}
|
||||
|
||||
return new static($chunks);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort through each item with a callback.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return $this
|
||||
*/
|
||||
public function sort(callable $callback)
|
||||
{
|
||||
uasort($this->items, $callback);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort the collection using the given callback.
|
||||
*
|
||||
* @param callable|string $callback
|
||||
* @param int $options
|
||||
* @param bool $descending
|
||||
* @return $this
|
||||
*/
|
||||
public function sortBy($callback, $options = SORT_REGULAR, $descending = false)
|
||||
{
|
||||
$results = [];
|
||||
|
||||
if ( ! $this->useAsCallable($callback))
|
||||
{
|
||||
$callback = $this->valueRetriever($callback);
|
||||
}
|
||||
|
||||
// First we will loop through the items and get the comparator from a callback
|
||||
// function which we were given. Then, we will sort the returned values and
|
||||
// and grab the corresponding values for the sorted keys from this array.
|
||||
foreach ($this->items as $key => $value)
|
||||
{
|
||||
$results[$key] = $callback($value, $key);
|
||||
}
|
||||
|
||||
$descending ? arsort($results, $options)
|
||||
: asort($results, $options);
|
||||
|
||||
// Once we have sorted all of the keys in the array, we will loop through them
|
||||
// and grab the corresponding model so we can set the underlying items list
|
||||
// to the sorted version. Then we'll just return the collection instance.
|
||||
foreach (array_keys($results) as $key)
|
||||
{
|
||||
$results[$key] = $this->items[$key];
|
||||
}
|
||||
|
||||
$this->items = $results;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort the collection in descending order using the given callback.
|
||||
*
|
||||
* @param callable|string $callback
|
||||
* @param int $options
|
||||
* @return $this
|
||||
*/
|
||||
public function sortByDesc($callback, $options = SORT_REGULAR)
|
||||
{
|
||||
return $this->sortBy($callback, $options, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Splice portion of the underlying collection array.
|
||||
*
|
||||
* @param int $offset
|
||||
* @param int $length
|
||||
* @param mixed $replacement
|
||||
* @return static
|
||||
*/
|
||||
public function splice($offset, $length = 0, $replacement = [])
|
||||
{
|
||||
return new static(array_splice($this->items, $offset, $length, $replacement));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the sum of the given values.
|
||||
*
|
||||
* @param callable|string|null $callback
|
||||
* @return mixed
|
||||
*/
|
||||
public function sum($callback = null)
|
||||
{
|
||||
if (is_null($callback))
|
||||
{
|
||||
return array_sum($this->items);
|
||||
}
|
||||
|
||||
if ( ! $this->useAsCallable($callback))
|
||||
{
|
||||
$callback = $this->valueRetriever($callback);
|
||||
}
|
||||
|
||||
return $this->reduce(function($result, $item) use ($callback)
|
||||
{
|
||||
return $result += $callback($item);
|
||||
}, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Take the first or last {$limit} items.
|
||||
*
|
||||
* @param int $limit
|
||||
* @return static
|
||||
*/
|
||||
public function take($limit = null)
|
||||
{
|
||||
if ($limit < 0) return $this->slice($limit, abs($limit));
|
||||
|
||||
return $this->slice(0, $limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform each item in the collection using a callback.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return $this
|
||||
*/
|
||||
public function transform(callable $callback)
|
||||
{
|
||||
$this->items = array_map($callback, $this->items);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return only unique items from the collection array.
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function unique()
|
||||
{
|
||||
return new static(array_unique($this->items));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the keys on the underlying array.
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function values()
|
||||
{
|
||||
return new static(array_values($this->items));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a value retrieving callback.
|
||||
*
|
||||
* @param string $value
|
||||
* @return \Closure
|
||||
*/
|
||||
protected function valueRetriever($value)
|
||||
{
|
||||
return function($item) use ($value)
|
||||
{
|
||||
return data_get($item, $value);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the collection of items as a plain array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray()
|
||||
{
|
||||
return array_map(function($value)
|
||||
{
|
||||
return $value instanceof Arrayable ? $value->toArray() : $value;
|
||||
|
||||
}, $this->items);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the object into something JSON serializable.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the collection of items as JSON.
|
||||
*
|
||||
* @param int $options
|
||||
* @return string
|
||||
*/
|
||||
public function toJson($options = 0)
|
||||
{
|
||||
return json_encode($this->toArray(), $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an iterator for the items.
|
||||
*
|
||||
* @return \ArrayIterator
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
return new ArrayIterator($this->items);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a CachingIterator instance.
|
||||
*
|
||||
* @param int $flags
|
||||
* @return \CachingIterator
|
||||
*/
|
||||
public function getCachingIterator($flags = CachingIterator::CALL_TOSTRING)
|
||||
{
|
||||
return new CachingIterator($this->getIterator(), $flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* Count the number of items in the collection.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
return count($this->items);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if an item exists at an offset.
|
||||
*
|
||||
* @param mixed $key
|
||||
* @return bool
|
||||
*/
|
||||
public function offsetExists($key)
|
||||
{
|
||||
return array_key_exists($key, $this->items);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an item at a given offset.
|
||||
*
|
||||
* @param mixed $key
|
||||
* @return mixed
|
||||
*/
|
||||
public function offsetGet($key)
|
||||
{
|
||||
return $this->items[$key];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the item at a given offset.
|
||||
*
|
||||
* @param mixed $key
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($key, $value)
|
||||
{
|
||||
if (is_null($key))
|
||||
{
|
||||
$this->items[] = $value;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->items[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unset the item at a given offset.
|
||||
*
|
||||
* @param string $key
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($key)
|
||||
{
|
||||
unset($this->items[$key]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the collection to its string representation.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->toJson();
|
||||
}
|
||||
|
||||
/**
|
||||
* Results array of items from Collection or Arrayable.
|
||||
*
|
||||
* @param \Illuminate\Support\Collection|\Illuminate\Contracts\Support\Arrayable|array $items
|
||||
* @return array
|
||||
*/
|
||||
protected function getArrayableItems($items)
|
||||
{
|
||||
if ($items instanceof Collection)
|
||||
{
|
||||
$items = $items->all();
|
||||
}
|
||||
elseif ($items instanceof Arrayable)
|
||||
{
|
||||
$items = $items->toArray();
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
}
|
21
vendor/illuminate/support/Debug/Dumper.php
vendored
Executable file
21
vendor/illuminate/support/Debug/Dumper.php
vendored
Executable file
@ -0,0 +1,21 @@
|
||||
<?php namespace Illuminate\Support\Debug;
|
||||
|
||||
use Symfony\Component\VarDumper\Dumper\CliDumper;
|
||||
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
||||
|
||||
class Dumper {
|
||||
|
||||
/**
|
||||
* Dump a value with elegance.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
*/
|
||||
public function dump($value)
|
||||
{
|
||||
$dumper = 'cli' === PHP_SAPI ? new CliDumper : new HtmlDumper;
|
||||
|
||||
$dumper->dump((new VarCloner)->cloneVar($value));
|
||||
}
|
||||
|
||||
}
|
28
vendor/illuminate/support/Debug/HtmlDumper.php
vendored
Executable file
28
vendor/illuminate/support/Debug/HtmlDumper.php
vendored
Executable file
@ -0,0 +1,28 @@
|
||||
<?php namespace Illuminate\Support\Debug;
|
||||
|
||||
use Symfony\Component\VarDumper\Dumper\HtmlDumper as SymfonyHtmlDumper;
|
||||
|
||||
class HtmlDumper extends SymfonyHtmlDumper {
|
||||
|
||||
/**
|
||||
* Colour definitions for output.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $styles = array(
|
||||
'default' => 'background-color:#fff; color:#222; line-height:1.2em; font-weight:normal; font:12px Monaco, Consolas, monospace; word-wrap: break-word; white-space: pre-wrap; position:relative; z-index:100000',
|
||||
'num' => 'color:#a71d5d',
|
||||
'const' => 'color:#795da3',
|
||||
'str' => 'color:#df5000',
|
||||
'cchr' => 'color:#222',
|
||||
'note' => 'color:#a71d5d',
|
||||
'ref' => 'color:#a0a0a0',
|
||||
'public' => 'color:#795da3',
|
||||
'protected' => 'color:#795da3',
|
||||
'private' => 'color:#795da3',
|
||||
'meta' => 'color:#b729d9',
|
||||
'key' => 'color:#df5000',
|
||||
'index' => 'color:#a71d5d',
|
||||
);
|
||||
|
||||
}
|
18
vendor/illuminate/support/Facades/App.php
vendored
Executable file
18
vendor/illuminate/support/Facades/App.php
vendored
Executable file
@ -0,0 +1,18 @@
|
||||
<?php namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @see \Illuminate\Foundation\Application
|
||||
*/
|
||||
class App extends Facade {
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'app';
|
||||
}
|
||||
|
||||
}
|
18
vendor/illuminate/support/Facades/Artisan.php
vendored
Executable file
18
vendor/illuminate/support/Facades/Artisan.php
vendored
Executable file
@ -0,0 +1,18 @@
|
||||
<?php namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @see \Illuminate\Foundation\Artisan
|
||||
*/
|
||||
class Artisan extends Facade {
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'Illuminate\Contracts\Console\Kernel';
|
||||
}
|
||||
|
||||
}
|
19
vendor/illuminate/support/Facades/Auth.php
vendored
Executable file
19
vendor/illuminate/support/Facades/Auth.php
vendored
Executable file
@ -0,0 +1,19 @@
|
||||
<?php namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @see \Illuminate\Auth\AuthManager
|
||||
* @see \Illuminate\Auth\Guard
|
||||
*/
|
||||
class Auth extends Facade {
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'auth';
|
||||
}
|
||||
|
||||
}
|
18
vendor/illuminate/support/Facades/Blade.php
vendored
Executable file
18
vendor/illuminate/support/Facades/Blade.php
vendored
Executable file
@ -0,0 +1,18 @@
|
||||
<?php namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @see \Illuminate\View\Compilers\BladeCompiler
|
||||
*/
|
||||
class Blade extends Facade {
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return static::$app['view']->getEngineResolver()->resolve('blade')->getCompiler();
|
||||
}
|
||||
|
||||
}
|
18
vendor/illuminate/support/Facades/Bus.php
vendored
Executable file
18
vendor/illuminate/support/Facades/Bus.php
vendored
Executable file
@ -0,0 +1,18 @@
|
||||
<?php namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @see \Illuminate\Bus\Dispatcher
|
||||
*/
|
||||
class Bus extends Facade {
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'Illuminate\Contracts\Bus\Dispatcher';
|
||||
}
|
||||
|
||||
}
|
19
vendor/illuminate/support/Facades/Cache.php
vendored
Executable file
19
vendor/illuminate/support/Facades/Cache.php
vendored
Executable file
@ -0,0 +1,19 @@
|
||||
<?php namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @see \Illuminate\Cache\CacheManager
|
||||
* @see \Illuminate\Cache\Repository
|
||||
*/
|
||||
class Cache extends Facade {
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'cache';
|
||||
}
|
||||
|
||||
}
|
18
vendor/illuminate/support/Facades/Config.php
vendored
Executable file
18
vendor/illuminate/support/Facades/Config.php
vendored
Executable file
@ -0,0 +1,18 @@
|
||||
<?php namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @see \Illuminate\Config\Repository
|
||||
*/
|
||||
class Config extends Facade {
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'config';
|
||||
}
|
||||
|
||||
}
|
41
vendor/illuminate/support/Facades/Cookie.php
vendored
Executable file
41
vendor/illuminate/support/Facades/Cookie.php
vendored
Executable file
@ -0,0 +1,41 @@
|
||||
<?php namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @see \Illuminate\Cookie\CookieJar
|
||||
*/
|
||||
class Cookie extends Facade {
|
||||
|
||||
/**
|
||||
* Determine if a cookie exists on the request.
|
||||
*
|
||||
* @param string $key
|
||||
* @return bool
|
||||
*/
|
||||
public static function has($key)
|
||||
{
|
||||
return ! is_null(static::$app['request']->cookie($key, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a cookie from the request.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
* @return string
|
||||
*/
|
||||
public static function get($key = null, $default = null)
|
||||
{
|
||||
return static::$app['request']->cookie($key, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'cookie';
|
||||
}
|
||||
|
||||
}
|
18
vendor/illuminate/support/Facades/Crypt.php
vendored
Executable file
18
vendor/illuminate/support/Facades/Crypt.php
vendored
Executable file
@ -0,0 +1,18 @@
|
||||
<?php namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @see \Illuminate\Encryption\Encrypter
|
||||
*/
|
||||
class Crypt extends Facade {
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'encrypter';
|
||||
}
|
||||
|
||||
}
|
19
vendor/illuminate/support/Facades/DB.php
vendored
Executable file
19
vendor/illuminate/support/Facades/DB.php
vendored
Executable file
@ -0,0 +1,19 @@
|
||||
<?php namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @see \Illuminate\Database\DatabaseManager
|
||||
* @see \Illuminate\Database\Connection
|
||||
*/
|
||||
class DB extends Facade {
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'db';
|
||||
}
|
||||
|
||||
}
|
18
vendor/illuminate/support/Facades/Event.php
vendored
Executable file
18
vendor/illuminate/support/Facades/Event.php
vendored
Executable file
@ -0,0 +1,18 @@
|
||||
<?php namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @see \Illuminate\Events\Dispatcher
|
||||
*/
|
||||
class Event extends Facade {
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'events';
|
||||
}
|
||||
|
||||
}
|
226
vendor/illuminate/support/Facades/Facade.php
vendored
Executable file
226
vendor/illuminate/support/Facades/Facade.php
vendored
Executable file
@ -0,0 +1,226 @@
|
||||
<?php namespace Illuminate\Support\Facades;
|
||||
|
||||
use Mockery;
|
||||
use RuntimeException;
|
||||
use Mockery\MockInterface;
|
||||
|
||||
abstract class Facade {
|
||||
|
||||
/**
|
||||
* The application instance being facaded.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Foundation\Application
|
||||
*/
|
||||
protected static $app;
|
||||
|
||||
/**
|
||||
* The resolved object instances.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $resolvedInstance;
|
||||
|
||||
/**
|
||||
* Hotswap the underlying instance behind the facade.
|
||||
*
|
||||
* @param mixed $instance
|
||||
* @return void
|
||||
*/
|
||||
public static function swap($instance)
|
||||
{
|
||||
static::$resolvedInstance[static::getFacadeAccessor()] = $instance;
|
||||
|
||||
static::$app->instance(static::getFacadeAccessor(), $instance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiate a mock expectation on the facade.
|
||||
*
|
||||
* @param mixed
|
||||
* @return \Mockery\Expectation
|
||||
*/
|
||||
public static function shouldReceive()
|
||||
{
|
||||
$name = static::getFacadeAccessor();
|
||||
|
||||
if (static::isMock())
|
||||
{
|
||||
$mock = static::$resolvedInstance[$name];
|
||||
}
|
||||
else
|
||||
{
|
||||
$mock = static::createFreshMockInstance($name);
|
||||
}
|
||||
|
||||
return call_user_func_array(array($mock, 'shouldReceive'), func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a fresh mock instance for the given class.
|
||||
*
|
||||
* @param string $name
|
||||
* @return \Mockery\Expectation
|
||||
*/
|
||||
protected static function createFreshMockInstance($name)
|
||||
{
|
||||
static::$resolvedInstance[$name] = $mock = static::createMockByName($name);
|
||||
|
||||
if (isset(static::$app))
|
||||
{
|
||||
static::$app->instance($name, $mock);
|
||||
}
|
||||
|
||||
return $mock;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a fresh mock instance for the given class.
|
||||
*
|
||||
* @param string $name
|
||||
* @return \Mockery\Expectation
|
||||
*/
|
||||
protected static function createMockByName($name)
|
||||
{
|
||||
$class = static::getMockableClass($name);
|
||||
|
||||
return $class ? Mockery::mock($class) : Mockery::mock();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether a mock is set as the instance of the facade.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected static function isMock()
|
||||
{
|
||||
$name = static::getFacadeAccessor();
|
||||
|
||||
return isset(static::$resolvedInstance[$name]) && static::$resolvedInstance[$name] instanceof MockInterface;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mockable class for the bound instance.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getMockableClass()
|
||||
{
|
||||
if ($root = static::getFacadeRoot()) return get_class($root);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the root object behind the facade.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function getFacadeRoot()
|
||||
{
|
||||
return static::resolveFacadeInstance(static::getFacadeAccessor());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
throw new RuntimeException("Facade does not implement getFacadeAccessor method.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the facade root instance from the container.
|
||||
*
|
||||
* @param string $name
|
||||
* @return mixed
|
||||
*/
|
||||
protected static function resolveFacadeInstance($name)
|
||||
{
|
||||
if (is_object($name)) return $name;
|
||||
|
||||
if (isset(static::$resolvedInstance[$name]))
|
||||
{
|
||||
return static::$resolvedInstance[$name];
|
||||
}
|
||||
|
||||
return static::$resolvedInstance[$name] = static::$app[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear a resolved facade instance.
|
||||
*
|
||||
* @param string $name
|
||||
* @return void
|
||||
*/
|
||||
public static function clearResolvedInstance($name)
|
||||
{
|
||||
unset(static::$resolvedInstance[$name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all of the resolved instances.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function clearResolvedInstances()
|
||||
{
|
||||
static::$resolvedInstance = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the application instance behind the facade.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Foundation\Application
|
||||
*/
|
||||
public static function getFacadeApplication()
|
||||
{
|
||||
return static::$app;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the application instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Foundation\Application $app
|
||||
* @return void
|
||||
*/
|
||||
public static function setFacadeApplication($app)
|
||||
{
|
||||
static::$app = $app;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle dynamic, static calls to the object.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $args
|
||||
* @return mixed
|
||||
*/
|
||||
public static function __callStatic($method, $args)
|
||||
{
|
||||
$instance = static::getFacadeRoot();
|
||||
|
||||
switch (count($args))
|
||||
{
|
||||
case 0:
|
||||
return $instance->$method();
|
||||
|
||||
case 1:
|
||||
return $instance->$method($args[0]);
|
||||
|
||||
case 2:
|
||||
return $instance->$method($args[0], $args[1]);
|
||||
|
||||
case 3:
|
||||
return $instance->$method($args[0], $args[1], $args[2]);
|
||||
|
||||
case 4:
|
||||
return $instance->$method($args[0], $args[1], $args[2], $args[3]);
|
||||
|
||||
default:
|
||||
return call_user_func_array(array($instance, $method), $args);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
18
vendor/illuminate/support/Facades/File.php
vendored
Executable file
18
vendor/illuminate/support/Facades/File.php
vendored
Executable file
@ -0,0 +1,18 @@
|
||||
<?php namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @see \Illuminate\Filesystem\Filesystem
|
||||
*/
|
||||
class File extends Facade {
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'files';
|
||||
}
|
||||
|
||||
}
|
18
vendor/illuminate/support/Facades/Hash.php
vendored
Executable file
18
vendor/illuminate/support/Facades/Hash.php
vendored
Executable file
@ -0,0 +1,18 @@
|
||||
<?php namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @see \Illuminate\Hashing\BcryptHasher
|
||||
*/
|
||||
class Hash extends Facade {
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'hash';
|
||||
}
|
||||
|
||||
}
|
32
vendor/illuminate/support/Facades/Input.php
vendored
Executable file
32
vendor/illuminate/support/Facades/Input.php
vendored
Executable file
@ -0,0 +1,32 @@
|
||||
<?php namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @see \Illuminate\Http\Request
|
||||
*/
|
||||
class Input extends Facade {
|
||||
|
||||
/**
|
||||
* Get an item from the input data.
|
||||
*
|
||||
* This method is used for all request verbs (GET, POST, PUT, and DELETE)
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public static function get($key = null, $default = null)
|
||||
{
|
||||
return static::$app['request']->input($key, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'request';
|
||||
}
|
||||
|
||||
}
|
18
vendor/illuminate/support/Facades/Lang.php
vendored
Executable file
18
vendor/illuminate/support/Facades/Lang.php
vendored
Executable file
@ -0,0 +1,18 @@
|
||||
<?php namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @see \Illuminate\Translation\Translator
|
||||
*/
|
||||
class Lang extends Facade {
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'translator';
|
||||
}
|
||||
|
||||
}
|
18
vendor/illuminate/support/Facades/Log.php
vendored
Executable file
18
vendor/illuminate/support/Facades/Log.php
vendored
Executable file
@ -0,0 +1,18 @@
|
||||
<?php namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @see \Illuminate\Log\Writer
|
||||
*/
|
||||
class Log extends Facade {
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'log';
|
||||
}
|
||||
|
||||
}
|
18
vendor/illuminate/support/Facades/Mail.php
vendored
Executable file
18
vendor/illuminate/support/Facades/Mail.php
vendored
Executable file
@ -0,0 +1,18 @@
|
||||
<?php namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @see \Illuminate\Mail\Mailer
|
||||
*/
|
||||
class Mail extends Facade {
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'mailer';
|
||||
}
|
||||
|
||||
}
|
53
vendor/illuminate/support/Facades/Password.php
vendored
Executable file
53
vendor/illuminate/support/Facades/Password.php
vendored
Executable file
@ -0,0 +1,53 @@
|
||||
<?php namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @see \Illuminate\Auth\Passwords\PasswordBroker
|
||||
*/
|
||||
class Password extends Facade {
|
||||
|
||||
/**
|
||||
* Constant representing a successfully sent reminder.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const RESET_LINK_SENT = 'passwords.sent';
|
||||
|
||||
/**
|
||||
* Constant representing a successfully reset password.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const PASSWORD_RESET = 'passwords.reset';
|
||||
|
||||
/**
|
||||
* Constant representing the user not found response.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const INVALID_USER = 'passwords.user';
|
||||
|
||||
/**
|
||||
* Constant representing an invalid password.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const INVALID_PASSWORD = 'passwords.password';
|
||||
|
||||
/**
|
||||
* Constant representing an invalid token.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const INVALID_TOKEN = 'passwords.token';
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'auth.password';
|
||||
}
|
||||
|
||||
}
|
19
vendor/illuminate/support/Facades/Queue.php
vendored
Executable file
19
vendor/illuminate/support/Facades/Queue.php
vendored
Executable file
@ -0,0 +1,19 @@
|
||||
<?php namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @see \Illuminate\Queue\QueueManager
|
||||
* @see \Illuminate\Queue\Queue
|
||||
*/
|
||||
class Queue extends Facade {
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'queue';
|
||||
}
|
||||
|
||||
}
|
18
vendor/illuminate/support/Facades/Redirect.php
vendored
Executable file
18
vendor/illuminate/support/Facades/Redirect.php
vendored
Executable file
@ -0,0 +1,18 @@
|
||||
<?php namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @see \Illuminate\Routing\Redirector
|
||||
*/
|
||||
class Redirect extends Facade {
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'redirect';
|
||||
}
|
||||
|
||||
}
|
18
vendor/illuminate/support/Facades/Redis.php
vendored
Executable file
18
vendor/illuminate/support/Facades/Redis.php
vendored
Executable file
@ -0,0 +1,18 @@
|
||||
<?php namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @see \Illuminate\Redis\Database
|
||||
*/
|
||||
class Redis extends Facade {
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'redis';
|
||||
}
|
||||
|
||||
}
|
18
vendor/illuminate/support/Facades/Request.php
vendored
Executable file
18
vendor/illuminate/support/Facades/Request.php
vendored
Executable file
@ -0,0 +1,18 @@
|
||||
<?php namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @see \Illuminate\Http\Request
|
||||
*/
|
||||
class Request extends Facade {
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'request';
|
||||
}
|
||||
|
||||
}
|
18
vendor/illuminate/support/Facades/Response.php
vendored
Executable file
18
vendor/illuminate/support/Facades/Response.php
vendored
Executable file
@ -0,0 +1,18 @@
|
||||
<?php namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @see \Illuminate\Contracts\Routing\ResponseFactory
|
||||
*/
|
||||
class Response extends Facade {
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'Illuminate\Contracts\Routing\ResponseFactory';
|
||||
}
|
||||
|
||||
}
|
18
vendor/illuminate/support/Facades/Route.php
vendored
Executable file
18
vendor/illuminate/support/Facades/Route.php
vendored
Executable file
@ -0,0 +1,18 @@
|
||||
<?php namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @see \Illuminate\Routing\Router
|
||||
*/
|
||||
class Route extends Facade {
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'router';
|
||||
}
|
||||
|
||||
}
|
29
vendor/illuminate/support/Facades/Schema.php
vendored
Executable file
29
vendor/illuminate/support/Facades/Schema.php
vendored
Executable file
@ -0,0 +1,29 @@
|
||||
<?php namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @see \Illuminate\Database\Schema\Builder
|
||||
*/
|
||||
class Schema extends Facade {
|
||||
|
||||
/**
|
||||
* Get a schema builder instance for a connection.
|
||||
*
|
||||
* @param string $name
|
||||
* @return \Illuminate\Database\Schema\Builder
|
||||
*/
|
||||
public static function connection($name)
|
||||
{
|
||||
return static::$app['db']->connection($name)->getSchemaBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return static::$app['db']->connection()->getSchemaBuilder();
|
||||
}
|
||||
|
||||
}
|
19
vendor/illuminate/support/Facades/Session.php
vendored
Executable file
19
vendor/illuminate/support/Facades/Session.php
vendored
Executable file
@ -0,0 +1,19 @@
|
||||
<?php namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @see \Illuminate\Session\SessionManager
|
||||
* @see \Illuminate\Session\Store
|
||||
*/
|
||||
class Session extends Facade {
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'session';
|
||||
}
|
||||
|
||||
}
|
18
vendor/illuminate/support/Facades/Storage.php
vendored
Executable file
18
vendor/illuminate/support/Facades/Storage.php
vendored
Executable file
@ -0,0 +1,18 @@
|
||||
<?php namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @see \Illuminate\Filesystem\FilesystemManager
|
||||
*/
|
||||
class Storage extends Facade {
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'filesystem';
|
||||
}
|
||||
|
||||
}
|
18
vendor/illuminate/support/Facades/URL.php
vendored
Executable file
18
vendor/illuminate/support/Facades/URL.php
vendored
Executable file
@ -0,0 +1,18 @@
|
||||
<?php namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @see \Illuminate\Routing\UrlGenerator
|
||||
*/
|
||||
class URL extends Facade {
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'url';
|
||||
}
|
||||
|
||||
}
|
18
vendor/illuminate/support/Facades/Validator.php
vendored
Executable file
18
vendor/illuminate/support/Facades/Validator.php
vendored
Executable file
@ -0,0 +1,18 @@
|
||||
<?php namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @see \Illuminate\Validation\Factory
|
||||
*/
|
||||
class Validator extends Facade {
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'validator';
|
||||
}
|
||||
|
||||
}
|
18
vendor/illuminate/support/Facades/View.php
vendored
Executable file
18
vendor/illuminate/support/Facades/View.php
vendored
Executable file
@ -0,0 +1,18 @@
|
||||
<?php namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @see \Illuminate\View\Factory
|
||||
*/
|
||||
class View extends Facade {
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'view';
|
||||
}
|
||||
|
||||
}
|
193
vendor/illuminate/support/Fluent.php
vendored
Executable file
193
vendor/illuminate/support/Fluent.php
vendored
Executable file
@ -0,0 +1,193 @@
|
||||
<?php namespace Illuminate\Support;
|
||||
|
||||
use ArrayAccess;
|
||||
use JsonSerializable;
|
||||
use Illuminate\Contracts\Support\Jsonable;
|
||||
use Illuminate\Contracts\Support\Arrayable;
|
||||
|
||||
class Fluent implements ArrayAccess, Arrayable, Jsonable, JsonSerializable {
|
||||
|
||||
/**
|
||||
* All of the attributes set on the container.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $attributes = array();
|
||||
|
||||
/**
|
||||
* Create a new fluent container instance.
|
||||
*
|
||||
* @param array|object $attributes
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($attributes = array())
|
||||
{
|
||||
foreach ($attributes as $key => $value)
|
||||
{
|
||||
$this->attributes[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an attribute from the container.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($key, $default = null)
|
||||
{
|
||||
if (array_key_exists($key, $this->attributes))
|
||||
{
|
||||
return $this->attributes[$key];
|
||||
}
|
||||
|
||||
return value($default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attributes from the container.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAttributes()
|
||||
{
|
||||
return $this->attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the Fluent instance to an array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray()
|
||||
{
|
||||
return $this->attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the object into something JSON serializable.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the Fluent instance to JSON.
|
||||
*
|
||||
* @param int $options
|
||||
* @return string
|
||||
*/
|
||||
public function toJson($options = 0)
|
||||
{
|
||||
return json_encode($this->toArray(), $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given offset exists.
|
||||
*
|
||||
* @param string $offset
|
||||
* @return bool
|
||||
*/
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return isset($this->{$offset});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value for a given offset.
|
||||
*
|
||||
* @param string $offset
|
||||
* @return mixed
|
||||
*/
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->{$offset};
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value at the given offset.
|
||||
*
|
||||
* @param string $offset
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
$this->{$offset} = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unset the value at the given offset.
|
||||
*
|
||||
* @param string $offset
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
unset($this->{$offset});
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle dynamic calls to the container to set attributes.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return $this
|
||||
*/
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
$this->attributes[$method] = count($parameters) > 0 ? $parameters[0] : true;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically retrieve the value of an attribute.
|
||||
*
|
||||
* @param string $key
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($key)
|
||||
{
|
||||
return $this->get($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically set the value of an attribute.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
*/
|
||||
public function __set($key, $value)
|
||||
{
|
||||
$this->attributes[$key] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically check if an attribute is set.
|
||||
*
|
||||
* @param string $key
|
||||
* @return void
|
||||
*/
|
||||
public function __isset($key)
|
||||
{
|
||||
return isset($this->attributes[$key]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically unset an attribute.
|
||||
*
|
||||
* @param string $key
|
||||
* @return void
|
||||
*/
|
||||
public function __unset($key)
|
||||
{
|
||||
unset($this->attributes[$key]);
|
||||
}
|
||||
|
||||
}
|
142
vendor/illuminate/support/Manager.php
vendored
Executable file
142
vendor/illuminate/support/Manager.php
vendored
Executable file
@ -0,0 +1,142 @@
|
||||
<?php namespace Illuminate\Support;
|
||||
|
||||
use Closure;
|
||||
use InvalidArgumentException;
|
||||
|
||||
abstract class Manager {
|
||||
|
||||
/**
|
||||
* The application instance.
|
||||
*
|
||||
* @var \Illuminate\Foundation\Application
|
||||
*/
|
||||
protected $app;
|
||||
|
||||
/**
|
||||
* The registered custom driver creators.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $customCreators = array();
|
||||
|
||||
/**
|
||||
* The array of created "drivers".
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $drivers = array();
|
||||
|
||||
/**
|
||||
* Create a new manager instance.
|
||||
*
|
||||
* @param \Illuminate\Foundation\Application $app
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($app)
|
||||
{
|
||||
$this->app = $app;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default driver name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract public function getDefaultDriver();
|
||||
|
||||
/**
|
||||
* Get a driver instance.
|
||||
*
|
||||
* @param string $driver
|
||||
* @return mixed
|
||||
*/
|
||||
public function driver($driver = null)
|
||||
{
|
||||
$driver = $driver ?: $this->getDefaultDriver();
|
||||
|
||||
// If the given driver has not been created before, we will create the instances
|
||||
// here and cache it so we can return it next time very quickly. If there is
|
||||
// already a driver created by this name, we'll just return that instance.
|
||||
if ( ! isset($this->drivers[$driver]))
|
||||
{
|
||||
$this->drivers[$driver] = $this->createDriver($driver);
|
||||
}
|
||||
|
||||
return $this->drivers[$driver];
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new driver instance.
|
||||
*
|
||||
* @param string $driver
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
protected function createDriver($driver)
|
||||
{
|
||||
$method = 'create'.ucfirst($driver).'Driver';
|
||||
|
||||
// We'll check to see if a creator method exists for the given driver. If not we
|
||||
// will check for a custom driver creator, which allows developers to create
|
||||
// drivers using their own customized driver creator Closure to create it.
|
||||
if (isset($this->customCreators[$driver]))
|
||||
{
|
||||
return $this->callCustomCreator($driver);
|
||||
}
|
||||
elseif (method_exists($this, $method))
|
||||
{
|
||||
return $this->$method();
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException("Driver [$driver] not supported.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Call a custom driver creator.
|
||||
*
|
||||
* @param string $driver
|
||||
* @return mixed
|
||||
*/
|
||||
protected function callCustomCreator($driver)
|
||||
{
|
||||
return $this->customCreators[$driver]($this->app);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a custom driver creator Closure.
|
||||
*
|
||||
* @param string $driver
|
||||
* @param \Closure $callback
|
||||
* @return $this
|
||||
*/
|
||||
public function extend($driver, Closure $callback)
|
||||
{
|
||||
$this->customCreators[$driver] = $callback;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the created "drivers".
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getDrivers()
|
||||
{
|
||||
return $this->drivers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically call the default driver instance.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
return call_user_func_array(array($this->driver(), $method), $parameters);
|
||||
}
|
||||
|
||||
}
|
314
vendor/illuminate/support/MessageBag.php
vendored
Executable file
314
vendor/illuminate/support/MessageBag.php
vendored
Executable file
@ -0,0 +1,314 @@
|
||||
<?php namespace Illuminate\Support;
|
||||
|
||||
use Countable;
|
||||
use JsonSerializable;
|
||||
use Illuminate\Contracts\Support\Jsonable;
|
||||
use Illuminate\Contracts\Support\Arrayable;
|
||||
use Illuminate\Contracts\Support\MessageProvider;
|
||||
use Illuminate\Contracts\Support\MessageBag as MessageBagContract;
|
||||
|
||||
class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, MessageBagContract, MessageProvider {
|
||||
|
||||
/**
|
||||
* All of the registered messages.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $messages = array();
|
||||
|
||||
/**
|
||||
* Default format for message output.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $format = ':message';
|
||||
|
||||
/**
|
||||
* Create a new message bag instance.
|
||||
*
|
||||
* @param array $messages
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(array $messages = array())
|
||||
{
|
||||
foreach ($messages as $key => $value)
|
||||
{
|
||||
$this->messages[$key] = (array) $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the keys present in the message bag.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function keys()
|
||||
{
|
||||
return array_keys($this->messages);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a message to the bag.
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $message
|
||||
* @return $this
|
||||
*/
|
||||
public function add($key, $message)
|
||||
{
|
||||
if ($this->isUnique($key, $message))
|
||||
{
|
||||
$this->messages[$key][] = $message;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge a new array of messages into the bag.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Support\MessageProvider|array $messages
|
||||
* @return $this
|
||||
*/
|
||||
public function merge($messages)
|
||||
{
|
||||
if ($messages instanceof MessageProvider)
|
||||
{
|
||||
$messages = $messages->getMessageBag()->getMessages();
|
||||
}
|
||||
|
||||
$this->messages = array_merge_recursive($this->messages, $messages);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a key and message combination already exists.
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $message
|
||||
* @return bool
|
||||
*/
|
||||
protected function isUnique($key, $message)
|
||||
{
|
||||
$messages = (array) $this->messages;
|
||||
|
||||
return ! isset($messages[$key]) || ! in_array($message, $messages[$key]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if messages exist for a given key.
|
||||
*
|
||||
* @param string $key
|
||||
* @return bool
|
||||
*/
|
||||
public function has($key = null)
|
||||
{
|
||||
return $this->first($key) !== '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the first message from the bag for a given key.
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $format
|
||||
* @return string
|
||||
*/
|
||||
public function first($key = null, $format = null)
|
||||
{
|
||||
$messages = is_null($key) ? $this->all($format) : $this->get($key, $format);
|
||||
|
||||
return count($messages) > 0 ? $messages[0] : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the messages from the bag for a given key.
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $format
|
||||
* @return array
|
||||
*/
|
||||
public function get($key, $format = null)
|
||||
{
|
||||
// If the message exists in the container, we will transform it and return
|
||||
// the message. Otherwise, we'll return an empty array since the entire
|
||||
// methods is to return back an array of messages in the first place.
|
||||
if (array_key_exists($key, $this->messages))
|
||||
{
|
||||
return $this->transform($this->messages[$key], $this->checkFormat($format), $key);
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the messages for every key in the bag.
|
||||
*
|
||||
* @param string $format
|
||||
* @return array
|
||||
*/
|
||||
public function all($format = null)
|
||||
{
|
||||
$format = $this->checkFormat($format);
|
||||
|
||||
$all = array();
|
||||
|
||||
foreach ($this->messages as $key => $messages)
|
||||
{
|
||||
$all = array_merge($all, $this->transform($messages, $format, $key));
|
||||
}
|
||||
|
||||
return $all;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format an array of messages.
|
||||
*
|
||||
* @param array $messages
|
||||
* @param string $format
|
||||
* @param string $messageKey
|
||||
* @return array
|
||||
*/
|
||||
protected function transform($messages, $format, $messageKey)
|
||||
{
|
||||
$messages = (array) $messages;
|
||||
|
||||
// We will simply spin through the given messages and transform each one
|
||||
// replacing the :message place holder with the real message allowing
|
||||
// the messages to be easily formatted to each developer's desires.
|
||||
$replace = array(':message', ':key');
|
||||
|
||||
foreach ($messages as &$message)
|
||||
{
|
||||
$message = str_replace($replace, array($message, $messageKey), $format);
|
||||
}
|
||||
|
||||
return $messages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the appropriate format based on the given format.
|
||||
*
|
||||
* @param string $format
|
||||
* @return string
|
||||
*/
|
||||
protected function checkFormat($format)
|
||||
{
|
||||
return $format ?: $this->format;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the raw messages in the container.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getMessages()
|
||||
{
|
||||
return $this->messages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the messages for the instance.
|
||||
*
|
||||
* @return \Illuminate\Support\MessageBag
|
||||
*/
|
||||
public function getMessageBag()
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default message format.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFormat()
|
||||
{
|
||||
return $this->format;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default message format.
|
||||
*
|
||||
* @param string $format
|
||||
* @return \Illuminate\Support\MessageBag
|
||||
*/
|
||||
public function setFormat($format = ':message')
|
||||
{
|
||||
$this->format = $format;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the message bag has any messages.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isEmpty()
|
||||
{
|
||||
return ! $this->any();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the message bag has any messages.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function any()
|
||||
{
|
||||
return $this->count() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of messages in the container.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
return count($this->messages, COUNT_RECURSIVE) - count($this->messages);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the instance as an array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray()
|
||||
{
|
||||
return $this->getMessages();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the object into something JSON serializable.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the object to its JSON representation.
|
||||
*
|
||||
* @param int $options
|
||||
* @return string
|
||||
*/
|
||||
public function toJson($options = 0)
|
||||
{
|
||||
return json_encode($this->toArray(), $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the message bag to its string representation.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->toJson();
|
||||
}
|
||||
|
||||
}
|
109
vendor/illuminate/support/NamespacedItemResolver.php
vendored
Executable file
109
vendor/illuminate/support/NamespacedItemResolver.php
vendored
Executable file
@ -0,0 +1,109 @@
|
||||
<?php namespace Illuminate\Support;
|
||||
|
||||
class NamespacedItemResolver {
|
||||
|
||||
/**
|
||||
* A cache of the parsed items.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $parsed = array();
|
||||
|
||||
/**
|
||||
* Parse a key into namespace, group, and item.
|
||||
*
|
||||
* @param string $key
|
||||
* @return array
|
||||
*/
|
||||
public function parseKey($key)
|
||||
{
|
||||
// If we've already parsed the given key, we'll return the cached version we
|
||||
// already have, as this will save us some processing. We cache off every
|
||||
// key we parse so we can quickly return it on all subsequent requests.
|
||||
if (isset($this->parsed[$key]))
|
||||
{
|
||||
return $this->parsed[$key];
|
||||
}
|
||||
|
||||
// If the key does not contain a double colon, it means the key is not in a
|
||||
// namespace, and is just a regular configuration item. Namespaces are a
|
||||
// tool for organizing configuration items for things such as modules.
|
||||
if (strpos($key, '::') === false)
|
||||
{
|
||||
$segments = explode('.', $key);
|
||||
|
||||
$parsed = $this->parseBasicSegments($segments);
|
||||
}
|
||||
else
|
||||
{
|
||||
$parsed = $this->parseNamespacedSegments($key);
|
||||
}
|
||||
|
||||
// Once we have the parsed array of this key's elements, such as its groups
|
||||
// and namespace, we will cache each array inside a simple list that has
|
||||
// the key and the parsed array for quick look-ups for later requests.
|
||||
return $this->parsed[$key] = $parsed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse an array of basic segments.
|
||||
*
|
||||
* @param array $segments
|
||||
* @return array
|
||||
*/
|
||||
protected function parseBasicSegments(array $segments)
|
||||
{
|
||||
// The first segment in a basic array will always be the group, so we can go
|
||||
// ahead and grab that segment. If there is only one total segment we are
|
||||
// just pulling an entire group out of the array and not a single item.
|
||||
$group = $segments[0];
|
||||
|
||||
if (count($segments) == 1)
|
||||
{
|
||||
return array(null, $group, null);
|
||||
}
|
||||
|
||||
// If there is more than one segment in this group, it means we are pulling
|
||||
// a specific item out of a groups and will need to return the item name
|
||||
// as well as the group so we know which item to pull from the arrays.
|
||||
else
|
||||
{
|
||||
$item = implode('.', array_slice($segments, 1));
|
||||
|
||||
return array(null, $group, $item);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse an array of namespaced segments.
|
||||
*
|
||||
* @param string $key
|
||||
* @return array
|
||||
*/
|
||||
protected function parseNamespacedSegments($key)
|
||||
{
|
||||
list($namespace, $item) = explode('::', $key);
|
||||
|
||||
// First we'll just explode the first segment to get the namespace and group
|
||||
// since the item should be in the remaining segments. Once we have these
|
||||
// two pieces of data we can proceed with parsing out the item's value.
|
||||
$itemSegments = explode('.', $item);
|
||||
|
||||
$groupAndItem = array_slice($this->parseBasicSegments($itemSegments), 1);
|
||||
|
||||
return array_merge(array($namespace), $groupAndItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the parsed value of a key.
|
||||
*
|
||||
* @param string $key
|
||||
* @param array $parsed
|
||||
* @return void
|
||||
*/
|
||||
public function setParsedKey($key, $parsed)
|
||||
{
|
||||
$this->parsed[$key] = $parsed;
|
||||
}
|
||||
|
||||
}
|
103
vendor/illuminate/support/Pluralizer.php
vendored
Executable file
103
vendor/illuminate/support/Pluralizer.php
vendored
Executable file
@ -0,0 +1,103 @@
|
||||
<?php namespace Illuminate\Support;
|
||||
|
||||
use Doctrine\Common\Inflector\Inflector;
|
||||
|
||||
class Pluralizer {
|
||||
|
||||
/**
|
||||
* Uncountable word forms.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $uncountable = array(
|
||||
'audio',
|
||||
'bison',
|
||||
'chassis',
|
||||
'compensation',
|
||||
'coreopsis',
|
||||
'data',
|
||||
'deer',
|
||||
'education',
|
||||
'equipment',
|
||||
'fish',
|
||||
'gold',
|
||||
'information',
|
||||
'money',
|
||||
'moose',
|
||||
'offspring',
|
||||
'plankton',
|
||||
'police',
|
||||
'rice',
|
||||
'series',
|
||||
'sheep',
|
||||
'species',
|
||||
'swine',
|
||||
'traffic',
|
||||
);
|
||||
|
||||
/**
|
||||
* Get the plural form of an English word.
|
||||
*
|
||||
* @param string $value
|
||||
* @param int $count
|
||||
* @return string
|
||||
*/
|
||||
public static function plural($value, $count = 2)
|
||||
{
|
||||
if ($count === 1 || static::uncountable($value))
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
|
||||
$plural = Inflector::pluralize($value);
|
||||
|
||||
return static::matchCase($plural, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the singular form of an English word.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public static function singular($value)
|
||||
{
|
||||
$singular = Inflector::singularize($value);
|
||||
|
||||
return static::matchCase($singular, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given value is uncountable.
|
||||
*
|
||||
* @param string $value
|
||||
* @return bool
|
||||
*/
|
||||
protected static function uncountable($value)
|
||||
{
|
||||
return in_array(strtolower($value), static::$uncountable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to match the case on two strings.
|
||||
*
|
||||
* @param string $value
|
||||
* @param string $comparison
|
||||
* @return string
|
||||
*/
|
||||
protected static function matchCase($value, $comparison)
|
||||
{
|
||||
$functions = array('mb_strtolower', 'mb_strtoupper', 'ucfirst', 'ucwords');
|
||||
|
||||
foreach ($functions as $function)
|
||||
{
|
||||
if (call_user_func($function, $comparison) === $comparison)
|
||||
{
|
||||
return call_user_func($function, $value);
|
||||
}
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
}
|
229
vendor/illuminate/support/ServiceProvider.php
vendored
Executable file
229
vendor/illuminate/support/ServiceProvider.php
vendored
Executable file
@ -0,0 +1,229 @@
|
||||
<?php namespace Illuminate\Support;
|
||||
|
||||
use BadMethodCallException;
|
||||
|
||||
abstract class ServiceProvider {
|
||||
|
||||
/**
|
||||
* The application instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Foundation\Application
|
||||
*/
|
||||
protected $app;
|
||||
|
||||
/**
|
||||
* Indicates if loading of the provider is deferred.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $defer = false;
|
||||
|
||||
/**
|
||||
* The paths that should be published.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $publishes = [];
|
||||
|
||||
/**
|
||||
* The paths that should be published by group.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $publishGroups = [];
|
||||
|
||||
/**
|
||||
* Create a new service provider instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Foundation\Application $app
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($app)
|
||||
{
|
||||
$this->app = $app;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
abstract public function register();
|
||||
|
||||
/**
|
||||
* Merge the given configuration with the existing configuration.
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $key
|
||||
* @return void
|
||||
*/
|
||||
protected function mergeConfigFrom($path, $key)
|
||||
{
|
||||
$config = $this->app['config']->get($key, []);
|
||||
|
||||
$this->app['config']->set($key, array_merge(require $path, $config));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a view file namespace.
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $namespace
|
||||
* @return void
|
||||
*/
|
||||
protected function loadViewsFrom($path, $namespace)
|
||||
{
|
||||
if (is_dir($appPath = $this->app->basePath().'/resources/views/vendor/'.$namespace))
|
||||
{
|
||||
$this->app['view']->addNamespace($namespace, $appPath);
|
||||
}
|
||||
|
||||
$this->app['view']->addNamespace($namespace, $path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a translation file namespace.
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $namespace
|
||||
* @return void
|
||||
*/
|
||||
protected function loadTranslationsFrom($path, $namespace)
|
||||
{
|
||||
$this->app['translator']->addNamespace($namespace, $path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register paths to be published by the publish command.
|
||||
*
|
||||
* @param array $paths
|
||||
* @param string $group
|
||||
* @return void
|
||||
*/
|
||||
protected function publishes(array $paths, $group = null)
|
||||
{
|
||||
$class = get_class($this);
|
||||
|
||||
if ( ! array_key_exists($class, static::$publishes))
|
||||
{
|
||||
static::$publishes[$class] = [];
|
||||
}
|
||||
|
||||
static::$publishes[$class] = array_merge(static::$publishes[$class], $paths);
|
||||
|
||||
if ($group)
|
||||
{
|
||||
static::$publishGroups[$group] = $paths;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the paths to publish.
|
||||
*
|
||||
* @param string $provider
|
||||
* @param string $group
|
||||
* @return array
|
||||
*/
|
||||
public static function pathsToPublish($provider = null, $group = null)
|
||||
{
|
||||
if ($group && array_key_exists($group, static::$publishGroups))
|
||||
{
|
||||
return static::$publishGroups[$group];
|
||||
}
|
||||
|
||||
if ($provider && array_key_exists($provider, static::$publishes))
|
||||
{
|
||||
return static::$publishes[$provider];
|
||||
}
|
||||
|
||||
if ($group || $provider)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
$paths = [];
|
||||
|
||||
foreach (static::$publishes as $class => $publish)
|
||||
{
|
||||
$paths = array_merge($paths, $publish);
|
||||
}
|
||||
|
||||
return $paths;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the package's custom Artisan commands.
|
||||
*
|
||||
* @param array $commands
|
||||
* @return void
|
||||
*/
|
||||
public function commands($commands)
|
||||
{
|
||||
$commands = is_array($commands) ? $commands : func_get_args();
|
||||
|
||||
// To register the commands with Artisan, we will grab each of the arguments
|
||||
// passed into the method and listen for Artisan "start" event which will
|
||||
// give us the Artisan console instance which we will give commands to.
|
||||
$events = $this->app['events'];
|
||||
|
||||
$events->listen('artisan.start', function($artisan) use ($commands)
|
||||
{
|
||||
$artisan->resolveCommands($commands);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the events that trigger this service provider to register.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function when()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the provider is deferred.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isDeferred()
|
||||
{
|
||||
return $this->defer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of files that should be compiled for the package.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function compiles()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically handle missing method calls.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
if ($method == 'boot') return;
|
||||
|
||||
throw new BadMethodCallException("Call to undefined method [{$method}]");
|
||||
}
|
||||
|
||||
}
|
365
vendor/illuminate/support/Str.php
vendored
Executable file
365
vendor/illuminate/support/Str.php
vendored
Executable file
@ -0,0 +1,365 @@
|
||||
<?php namespace Illuminate\Support;
|
||||
|
||||
use RuntimeException;
|
||||
use Stringy\StaticStringy;
|
||||
use Illuminate\Support\Traits\Macroable;
|
||||
|
||||
class Str {
|
||||
|
||||
use Macroable;
|
||||
|
||||
/**
|
||||
* The cache of snake-cased words.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $snakeCache = [];
|
||||
|
||||
/**
|
||||
* The cache of camel-cased words.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $camelCache = [];
|
||||
|
||||
/**
|
||||
* The cache of studly-cased words.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $studlyCache = [];
|
||||
|
||||
/**
|
||||
* Transliterate a UTF-8 value to ASCII.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public static function ascii($value)
|
||||
{
|
||||
return StaticStringy::toAscii($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a value to camel case.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public static function camel($value)
|
||||
{
|
||||
if (isset(static::$camelCache[$value]))
|
||||
{
|
||||
return static::$camelCache[$value];
|
||||
}
|
||||
|
||||
return static::$camelCache[$value] = lcfirst(static::studly($value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a given string contains a given substring.
|
||||
*
|
||||
* @param string $haystack
|
||||
* @param string|array $needles
|
||||
* @return bool
|
||||
*/
|
||||
public static function contains($haystack, $needles)
|
||||
{
|
||||
foreach ((array) $needles as $needle)
|
||||
{
|
||||
if ($needle != '' && strpos($haystack, $needle) !== false) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a given string ends with a given substring.
|
||||
*
|
||||
* @param string $haystack
|
||||
* @param string|array $needles
|
||||
* @return bool
|
||||
*/
|
||||
public static function endsWith($haystack, $needles)
|
||||
{
|
||||
foreach ((array) $needles as $needle)
|
||||
{
|
||||
if ((string) $needle === substr($haystack, -strlen($needle))) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cap a string with a single instance of a given value.
|
||||
*
|
||||
* @param string $value
|
||||
* @param string $cap
|
||||
* @return string
|
||||
*/
|
||||
public static function finish($value, $cap)
|
||||
{
|
||||
$quoted = preg_quote($cap, '/');
|
||||
|
||||
return preg_replace('/(?:'.$quoted.')+$/', '', $value).$cap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a given string matches a given pattern.
|
||||
*
|
||||
* @param string $pattern
|
||||
* @param string $value
|
||||
* @return bool
|
||||
*/
|
||||
public static function is($pattern, $value)
|
||||
{
|
||||
if ($pattern == $value) return true;
|
||||
|
||||
$pattern = preg_quote($pattern, '#');
|
||||
|
||||
// Asterisks are translated into zero-or-more regular expression wildcards
|
||||
// to make it convenient to check if the strings starts with the given
|
||||
// pattern such as "library/*", making any string check convenient.
|
||||
$pattern = str_replace('\*', '.*', $pattern).'\z';
|
||||
|
||||
return (bool) preg_match('#^'.$pattern.'#', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the length of the given string.
|
||||
*
|
||||
* @param string $value
|
||||
* @return int
|
||||
*/
|
||||
public static function length($value)
|
||||
{
|
||||
return mb_strlen($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Limit the number of characters in a string.
|
||||
*
|
||||
* @param string $value
|
||||
* @param int $limit
|
||||
* @param string $end
|
||||
* @return string
|
||||
*/
|
||||
public static function limit($value, $limit = 100, $end = '...')
|
||||
{
|
||||
if (mb_strlen($value) <= $limit) return $value;
|
||||
|
||||
return rtrim(mb_substr($value, 0, $limit, 'UTF-8')).$end;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given string to lower-case.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public static function lower($value)
|
||||
{
|
||||
return mb_strtolower($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Limit the number of words in a string.
|
||||
*
|
||||
* @param string $value
|
||||
* @param int $words
|
||||
* @param string $end
|
||||
* @return string
|
||||
*/
|
||||
public static function words($value, $words = 100, $end = '...')
|
||||
{
|
||||
preg_match('/^\s*+(?:\S++\s*+){1,'.$words.'}/u', $value, $matches);
|
||||
|
||||
if ( ! isset($matches[0]) || strlen($value) === strlen($matches[0])) return $value;
|
||||
|
||||
return rtrim($matches[0]).$end;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a Class@method style callback into class and method.
|
||||
*
|
||||
* @param string $callback
|
||||
* @param string $default
|
||||
* @return array
|
||||
*/
|
||||
public static function parseCallback($callback, $default)
|
||||
{
|
||||
return static::contains($callback, '@') ? explode('@', $callback, 2) : array($callback, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plural form of an English word.
|
||||
*
|
||||
* @param string $value
|
||||
* @param int $count
|
||||
* @return string
|
||||
*/
|
||||
public static function plural($value, $count = 2)
|
||||
{
|
||||
return Pluralizer::plural($value, $count);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a more truly "random" alpha-numeric string.
|
||||
*
|
||||
* @param int $length
|
||||
* @return string
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public static function random($length = 16)
|
||||
{
|
||||
if ( ! function_exists('openssl_random_pseudo_bytes'))
|
||||
{
|
||||
throw new RuntimeException('OpenSSL extension is required.');
|
||||
}
|
||||
|
||||
$bytes = openssl_random_pseudo_bytes($length * 2);
|
||||
|
||||
if ($bytes === false)
|
||||
{
|
||||
throw new RuntimeException('Unable to generate random string.');
|
||||
}
|
||||
|
||||
return substr(str_replace(array('/', '+', '='), '', base64_encode($bytes)), 0, $length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a "random" alpha-numeric string.
|
||||
*
|
||||
* Should not be considered sufficient for cryptography, etc.
|
||||
*
|
||||
* @param int $length
|
||||
* @return string
|
||||
*/
|
||||
public static function quickRandom($length = 16)
|
||||
{
|
||||
$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
|
||||
return substr(str_shuffle(str_repeat($pool, $length)), 0, $length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given string to upper-case.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public static function upper($value)
|
||||
{
|
||||
return mb_strtoupper($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given string to title case.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public static function title($value)
|
||||
{
|
||||
return mb_convert_case($value, MB_CASE_TITLE, 'UTF-8');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the singular form of an English word.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public static function singular($value)
|
||||
{
|
||||
return Pluralizer::singular($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a URL friendly "slug" from a given string.
|
||||
*
|
||||
* @param string $title
|
||||
* @param string $separator
|
||||
* @return string
|
||||
*/
|
||||
public static function slug($title, $separator = '-')
|
||||
{
|
||||
$title = static::ascii($title);
|
||||
|
||||
// Convert all dashes/underscores into separator
|
||||
$flip = $separator == '-' ? '_' : '-';
|
||||
|
||||
$title = preg_replace('!['.preg_quote($flip).']+!u', $separator, $title);
|
||||
|
||||
// Remove all characters that are not the separator, letters, numbers, or whitespace.
|
||||
$title = preg_replace('![^'.preg_quote($separator).'\pL\pN\s]+!u', '', mb_strtolower($title));
|
||||
|
||||
// Replace all separator characters and whitespace by a single separator
|
||||
$title = preg_replace('!['.preg_quote($separator).'\s]+!u', $separator, $title);
|
||||
|
||||
return trim($title, $separator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a string to snake case.
|
||||
*
|
||||
* @param string $value
|
||||
* @param string $delimiter
|
||||
* @return string
|
||||
*/
|
||||
public static function snake($value, $delimiter = '_')
|
||||
{
|
||||
$key = $value.$delimiter;
|
||||
|
||||
if (isset(static::$snakeCache[$key]))
|
||||
{
|
||||
return static::$snakeCache[$key];
|
||||
}
|
||||
|
||||
if ( ! ctype_lower($value))
|
||||
{
|
||||
$value = strtolower(preg_replace('/(.)(?=[A-Z])/', '$1'.$delimiter, $value));
|
||||
}
|
||||
|
||||
return static::$snakeCache[$key] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a given string starts with a given substring.
|
||||
*
|
||||
* @param string $haystack
|
||||
* @param string|array $needles
|
||||
* @return bool
|
||||
*/
|
||||
public static function startsWith($haystack, $needles)
|
||||
{
|
||||
foreach ((array) $needles as $needle)
|
||||
{
|
||||
if ($needle != '' && strpos($haystack, $needle) === 0) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a value to studly caps case.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public static function studly($value)
|
||||
{
|
||||
$key = $value;
|
||||
|
||||
if (isset(static::$studlyCache[$key]))
|
||||
{
|
||||
return static::$studlyCache[$key];
|
||||
}
|
||||
|
||||
$value = ucwords(str_replace(array('-', '_'), ' ', $value));
|
||||
|
||||
return static::$studlyCache[$key] = str_replace(' ', '', $value);
|
||||
}
|
||||
|
||||
}
|
69
vendor/illuminate/support/Traits/CapsuleManagerTrait.php
vendored
Executable file
69
vendor/illuminate/support/Traits/CapsuleManagerTrait.php
vendored
Executable file
@ -0,0 +1,69 @@
|
||||
<?php namespace Illuminate\Support\Traits;
|
||||
|
||||
use Illuminate\Support\Fluent;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
|
||||
trait CapsuleManagerTrait {
|
||||
|
||||
/**
|
||||
* The current globally used instance.
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
protected static $instance;
|
||||
|
||||
/**
|
||||
* The container instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Container\Container
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
/**
|
||||
* Setup the IoC container instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Container\Container $container
|
||||
* @return void
|
||||
*/
|
||||
protected function setupContainer(Container $container)
|
||||
{
|
||||
$this->container = $container;
|
||||
|
||||
if ( ! $this->container->bound('config'))
|
||||
{
|
||||
$this->container->instance('config', new Fluent);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make this capsule instance available globally.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setAsGlobal()
|
||||
{
|
||||
static::$instance = $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the IoC container instance.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Container\Container
|
||||
*/
|
||||
public function getContainer()
|
||||
{
|
||||
return $this->container;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the IoC container instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Container\Container $container
|
||||
* @return void
|
||||
*/
|
||||
public function setContainer(Container $container)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
}
|
90
vendor/illuminate/support/Traits/Macroable.php
vendored
Executable file
90
vendor/illuminate/support/Traits/Macroable.php
vendored
Executable file
@ -0,0 +1,90 @@
|
||||
<?php namespace Illuminate\Support\Traits;
|
||||
|
||||
use Closure;
|
||||
use BadMethodCallException;
|
||||
|
||||
trait Macroable {
|
||||
|
||||
/**
|
||||
* The registered string macros.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $macros = array();
|
||||
|
||||
/**
|
||||
* Register a custom macro.
|
||||
*
|
||||
* @param string $name
|
||||
* @param callable $macro
|
||||
* @return void
|
||||
*/
|
||||
public static function macro($name, callable $macro)
|
||||
{
|
||||
static::$macros[$name] = $macro;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if macro is registered.
|
||||
*
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
public static function hasMacro($name)
|
||||
{
|
||||
return isset(static::$macros[$name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically handle calls to the class.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public static function __callStatic($method, $parameters)
|
||||
{
|
||||
if (static::hasMacro($method))
|
||||
{
|
||||
if (static::$macros[$method] instanceof Closure)
|
||||
{
|
||||
return call_user_func_array(Closure::bind(static::$macros[$method], null, get_called_class()), $parameters);
|
||||
}
|
||||
else
|
||||
{
|
||||
return call_user_func_array(static::$macros[$method], $parameters);
|
||||
}
|
||||
}
|
||||
|
||||
throw new BadMethodCallException("Method {$method} does not exist.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically handle calls to the class.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
if (static::hasMacro($method))
|
||||
{
|
||||
if (static::$macros[$method] instanceof Closure)
|
||||
{
|
||||
return call_user_func_array(static::$macros[$method]->bindTo($this, get_class($this)), $parameters);
|
||||
}
|
||||
else
|
||||
{
|
||||
return call_user_func_array(static::$macros[$method], $parameters);
|
||||
}
|
||||
}
|
||||
|
||||
throw new BadMethodCallException("Method {$method} does not exist.");
|
||||
}
|
||||
|
||||
}
|
106
vendor/illuminate/support/ViewErrorBag.php
vendored
Executable file
106
vendor/illuminate/support/ViewErrorBag.php
vendored
Executable file
@ -0,0 +1,106 @@
|
||||
<?php namespace Illuminate\Support;
|
||||
|
||||
use Countable;
|
||||
use Illuminate\Contracts\Support\MessageBag as MessageBagContract;
|
||||
|
||||
class ViewErrorBag implements Countable {
|
||||
|
||||
/**
|
||||
* The array of the view error bags.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $bags = [];
|
||||
|
||||
/**
|
||||
* Checks if a named MessageBag exists in the bags.
|
||||
*
|
||||
* @param string $key
|
||||
* @return bool
|
||||
*/
|
||||
public function hasBag($key = 'default')
|
||||
{
|
||||
return isset($this->bags[$key]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a MessageBag instance from the bags.
|
||||
*
|
||||
* @param string $key
|
||||
* @return \Illuminate\Contracts\Support\MessageBag
|
||||
*/
|
||||
public function getBag($key)
|
||||
{
|
||||
return array_get($this->bags, $key, new MessageBag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the bags.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getBags()
|
||||
{
|
||||
return $this->bags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new MessageBag instance to the bags.
|
||||
*
|
||||
* @param string $key
|
||||
* @param \Illuminate\Contracts\Support\MessageBag $bag
|
||||
* @return $this
|
||||
*/
|
||||
public function put($key, MessageBagContract $bag)
|
||||
{
|
||||
$this->bags[$key] = $bag;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of messages in the default bag.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
return $this->default->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically call methods on the default bag.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
return call_user_func_array(array($this->default, $method), $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically access a view error bag.
|
||||
*
|
||||
* @param string $key
|
||||
* @return \Illuminate\Contracts\Support\MessageBag
|
||||
*/
|
||||
public function __get($key)
|
||||
{
|
||||
return array_get($this->bags, $key, new MessageBag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically set a view error bag.
|
||||
*
|
||||
* @param string $key
|
||||
* @param \Illuminate\Contracts\Support\MessageBag $value
|
||||
* @return void
|
||||
*/
|
||||
public function __set($key, $value)
|
||||
{
|
||||
array_set($this->bags, $key, $value);
|
||||
}
|
||||
|
||||
}
|
40
vendor/illuminate/support/composer.json
vendored
Executable file
40
vendor/illuminate/support/composer.json
vendored
Executable file
@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "illuminate/support",
|
||||
"description": "The Illuminate Support package.",
|
||||
"license": "MIT",
|
||||
"homepage": "http://laravel.com",
|
||||
"support": {
|
||||
"issues": "https://github.com/laravel/framework/issues",
|
||||
"source": "https://github.com/laravel/framework"
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "Taylor Otwell",
|
||||
"email": "taylorotwell@gmail.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.4.0",
|
||||
"ext-mbstring": "*",
|
||||
"illuminate/contracts": "5.0.*",
|
||||
"doctrine/inflector": "~1.0",
|
||||
"danielstjules/stringy": "~1.8"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Illuminate\\Support\\": ""
|
||||
},
|
||||
"files": [
|
||||
"helpers.php"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "5.0-dev"
|
||||
}
|
||||
},
|
||||
"suggest": {
|
||||
"jeremeamia/superclosure": "Required to be able to serialize closures (~2.0)."
|
||||
},
|
||||
"minimum-stability": "dev"
|
||||
}
|
800
vendor/illuminate/support/helpers.php
vendored
Executable file
800
vendor/illuminate/support/helpers.php
vendored
Executable file
@ -0,0 +1,800 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Debug\Dumper;
|
||||
|
||||
if ( ! function_exists('append_config'))
|
||||
{
|
||||
/**
|
||||
* Assign high numeric IDs to a config item to force appending.
|
||||
*
|
||||
* @param array $array
|
||||
* @return array
|
||||
*/
|
||||
function append_config(array $array)
|
||||
{
|
||||
$start = 9999;
|
||||
|
||||
foreach ($array as $key => $value)
|
||||
{
|
||||
if (is_numeric($key))
|
||||
{
|
||||
$start++;
|
||||
|
||||
$array[$start] = array_pull($array, $key);
|
||||
}
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('array_add'))
|
||||
{
|
||||
/**
|
||||
* Add an element to an array using "dot" notation if it doesn't exist.
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @return array
|
||||
*/
|
||||
function array_add($array, $key, $value)
|
||||
{
|
||||
return Arr::add($array, $key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('array_build'))
|
||||
{
|
||||
/**
|
||||
* Build a new array using a callback.
|
||||
*
|
||||
* @param array $array
|
||||
* @param callable $callback
|
||||
* @return array
|
||||
*/
|
||||
function array_build($array, callable $callback)
|
||||
{
|
||||
return Arr::build($array, $callback);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('array_collapse'))
|
||||
{
|
||||
/**
|
||||
* Collapse an array of arrays into a single array.
|
||||
*
|
||||
* @param array|\ArrayAccess $array
|
||||
* @return array
|
||||
*/
|
||||
function array_collapse($array)
|
||||
{
|
||||
return Arr::collapse($array);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('array_divide'))
|
||||
{
|
||||
/**
|
||||
* Divide an array into two arrays. One with keys and the other with values.
|
||||
*
|
||||
* @param array $array
|
||||
* @return array
|
||||
*/
|
||||
function array_divide($array)
|
||||
{
|
||||
return Arr::divide($array);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('array_dot'))
|
||||
{
|
||||
/**
|
||||
* Flatten a multi-dimensional associative array with dots.
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $prepend
|
||||
* @return array
|
||||
*/
|
||||
function array_dot($array, $prepend = '')
|
||||
{
|
||||
return Arr::dot($array, $prepend);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('array_except'))
|
||||
{
|
||||
/**
|
||||
* Get all of the given array except for a specified array of items.
|
||||
*
|
||||
* @param array $array
|
||||
* @param array|string $keys
|
||||
* @return array
|
||||
*/
|
||||
function array_except($array, $keys)
|
||||
{
|
||||
return Arr::except($array, $keys);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('array_fetch'))
|
||||
{
|
||||
/**
|
||||
* Fetch a flattened array of a nested array element.
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $key
|
||||
* @return array
|
||||
*/
|
||||
function array_fetch($array, $key)
|
||||
{
|
||||
return Arr::fetch($array, $key);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('array_first'))
|
||||
{
|
||||
/**
|
||||
* Return the first element in an array passing a given truth test.
|
||||
*
|
||||
* @param array $array
|
||||
* @param callable $callback
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
function array_first($array, callable $callback, $default = null)
|
||||
{
|
||||
return Arr::first($array, $callback, $default);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('array_last'))
|
||||
{
|
||||
/**
|
||||
* Return the last element in an array passing a given truth test.
|
||||
*
|
||||
* @param array $array
|
||||
* @param callable $callback
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
function array_last($array, $callback, $default = null)
|
||||
{
|
||||
return Arr::last($array, $callback, $default);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('array_flatten'))
|
||||
{
|
||||
/**
|
||||
* Flatten a multi-dimensional array into a single level.
|
||||
*
|
||||
* @param array $array
|
||||
* @return array
|
||||
*/
|
||||
function array_flatten($array)
|
||||
{
|
||||
return Arr::flatten($array);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('array_forget'))
|
||||
{
|
||||
/**
|
||||
* Remove one or many array items from a given array using "dot" notation.
|
||||
*
|
||||
* @param array $array
|
||||
* @param array|string $keys
|
||||
* @return void
|
||||
*/
|
||||
function array_forget(&$array, $keys)
|
||||
{
|
||||
return Arr::forget($array, $keys);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('array_get'))
|
||||
{
|
||||
/**
|
||||
* Get an item from an array using "dot" notation.
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
function array_get($array, $key, $default = null)
|
||||
{
|
||||
return Arr::get($array, $key, $default);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('array_has'))
|
||||
{
|
||||
/**
|
||||
* Check if an item exists in an array using "dot" notation.
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $key
|
||||
* @return bool
|
||||
*/
|
||||
function array_has($array, $key)
|
||||
{
|
||||
return Arr::has($array, $key);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('array_only'))
|
||||
{
|
||||
/**
|
||||
* Get a subset of the items from the given array.
|
||||
*
|
||||
* @param array $array
|
||||
* @param array|string $keys
|
||||
* @return array
|
||||
*/
|
||||
function array_only($array, $keys)
|
||||
{
|
||||
return Arr::only($array, $keys);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('array_pluck'))
|
||||
{
|
||||
/**
|
||||
* Pluck an array of values from an array.
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $value
|
||||
* @param string $key
|
||||
* @return array
|
||||
*/
|
||||
function array_pluck($array, $value, $key = null)
|
||||
{
|
||||
return Arr::pluck($array, $value, $key);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('array_pull'))
|
||||
{
|
||||
/**
|
||||
* Get a value from the array, and remove it.
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
function array_pull(&$array, $key, $default = null)
|
||||
{
|
||||
return Arr::pull($array, $key, $default);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('array_set'))
|
||||
{
|
||||
/**
|
||||
* Set an array item to a given value using "dot" notation.
|
||||
*
|
||||
* If no key is given to the method, the entire array will be replaced.
|
||||
*
|
||||
* @param array $array
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @return array
|
||||
*/
|
||||
function array_set(&$array, $key, $value)
|
||||
{
|
||||
return Arr::set($array, $key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('array_sort'))
|
||||
{
|
||||
/**
|
||||
* Sort the array using the given callback.
|
||||
*
|
||||
* @param array $array
|
||||
* @param callable $callback
|
||||
* @return array
|
||||
*/
|
||||
function array_sort($array, callable $callback)
|
||||
{
|
||||
return Arr::sort($array, $callback);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('array_where'))
|
||||
{
|
||||
/**
|
||||
* Filter the array using the given callback.
|
||||
*
|
||||
* @param array $array
|
||||
* @param callable $callback
|
||||
* @return array
|
||||
*/
|
||||
function array_where($array, callable $callback)
|
||||
{
|
||||
return Arr::where($array, $callback);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('camel_case'))
|
||||
{
|
||||
/**
|
||||
* Convert a value to camel case.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
function camel_case($value)
|
||||
{
|
||||
return Str::camel($value);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('class_basename'))
|
||||
{
|
||||
/**
|
||||
* Get the class "basename" of the given object / class.
|
||||
*
|
||||
* @param string|object $class
|
||||
* @return string
|
||||
*/
|
||||
function class_basename($class)
|
||||
{
|
||||
$class = is_object($class) ? get_class($class) : $class;
|
||||
|
||||
return basename(str_replace('\\', '/', $class));
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('class_uses_recursive'))
|
||||
{
|
||||
/**
|
||||
* Returns all traits used by a class, its subclasses and trait of their traits.
|
||||
*
|
||||
* @param string $class
|
||||
* @return array
|
||||
*/
|
||||
function class_uses_recursive($class)
|
||||
{
|
||||
$results = [];
|
||||
|
||||
foreach (array_merge([$class => $class], class_parents($class)) as $class)
|
||||
{
|
||||
$results += trait_uses_recursive($class);
|
||||
}
|
||||
|
||||
return array_unique($results);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('collect'))
|
||||
{
|
||||
/**
|
||||
* Create a collection from the given value.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
function collect($value = null)
|
||||
{
|
||||
return new Collection($value);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('data_get'))
|
||||
{
|
||||
/**
|
||||
* Get an item from an array or object using "dot" notation.
|
||||
*
|
||||
* @param mixed $target
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
function data_get($target, $key, $default = null)
|
||||
{
|
||||
if (is_null($key)) return $target;
|
||||
|
||||
foreach (explode('.', $key) as $segment)
|
||||
{
|
||||
if (is_array($target))
|
||||
{
|
||||
if ( ! array_key_exists($segment, $target))
|
||||
{
|
||||
return value($default);
|
||||
}
|
||||
|
||||
$target = $target[$segment];
|
||||
}
|
||||
elseif ($target instanceof ArrayAccess)
|
||||
{
|
||||
if ( ! isset($target[$segment]))
|
||||
{
|
||||
return value($default);
|
||||
}
|
||||
|
||||
$target = $target[$segment];
|
||||
}
|
||||
elseif (is_object($target))
|
||||
{
|
||||
if ( ! isset($target->{$segment}))
|
||||
{
|
||||
return value($default);
|
||||
}
|
||||
|
||||
$target = $target->{$segment};
|
||||
}
|
||||
else
|
||||
{
|
||||
return value($default);
|
||||
}
|
||||
}
|
||||
|
||||
return $target;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('dd'))
|
||||
{
|
||||
/**
|
||||
* Dump the passed variables and end the script.
|
||||
*
|
||||
* @param mixed
|
||||
* @return void
|
||||
*/
|
||||
function dd()
|
||||
{
|
||||
array_map(function($x) { (new Dumper)->dump($x); }, func_get_args());
|
||||
|
||||
die;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('e'))
|
||||
{
|
||||
/**
|
||||
* Escape HTML entities in a string.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
function e($value)
|
||||
{
|
||||
return htmlentities($value, ENT_QUOTES, 'UTF-8', false);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('ends_with'))
|
||||
{
|
||||
/**
|
||||
* Determine if a given string ends with a given substring.
|
||||
*
|
||||
* @param string $haystack
|
||||
* @param string|array $needles
|
||||
* @return bool
|
||||
*/
|
||||
function ends_with($haystack, $needles)
|
||||
{
|
||||
return Str::endsWith($haystack, $needles);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('head'))
|
||||
{
|
||||
/**
|
||||
* Get the first element of an array. Useful for method chaining.
|
||||
*
|
||||
* @param array $array
|
||||
* @return mixed
|
||||
*/
|
||||
function head($array)
|
||||
{
|
||||
return reset($array);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('last'))
|
||||
{
|
||||
/**
|
||||
* Get the last element from an array.
|
||||
*
|
||||
* @param array $array
|
||||
* @return mixed
|
||||
*/
|
||||
function last($array)
|
||||
{
|
||||
return end($array);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('object_get'))
|
||||
{
|
||||
/**
|
||||
* Get an item from an object using "dot" notation.
|
||||
*
|
||||
* @param object $object
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
function object_get($object, $key, $default = null)
|
||||
{
|
||||
if (is_null($key) || trim($key) == '') return $object;
|
||||
|
||||
foreach (explode('.', $key) as $segment)
|
||||
{
|
||||
if ( ! is_object($object) || ! isset($object->{$segment}))
|
||||
{
|
||||
return value($default);
|
||||
}
|
||||
|
||||
$object = $object->{$segment};
|
||||
}
|
||||
|
||||
return $object;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('preg_replace_sub'))
|
||||
{
|
||||
/**
|
||||
* Replace a given pattern with each value in the array in sequentially.
|
||||
*
|
||||
* @param string $pattern
|
||||
* @param array $replacements
|
||||
* @param string $subject
|
||||
* @return string
|
||||
*/
|
||||
function preg_replace_sub($pattern, &$replacements, $subject)
|
||||
{
|
||||
return preg_replace_callback($pattern, function($match) use (&$replacements)
|
||||
{
|
||||
foreach ($replacements as $key => $value)
|
||||
{
|
||||
return array_shift($replacements);
|
||||
}
|
||||
|
||||
}, $subject);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('snake_case'))
|
||||
{
|
||||
/**
|
||||
* Convert a string to snake case.
|
||||
*
|
||||
* @param string $value
|
||||
* @param string $delimiter
|
||||
* @return string
|
||||
*/
|
||||
function snake_case($value, $delimiter = '_')
|
||||
{
|
||||
return Str::snake($value, $delimiter);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('starts_with'))
|
||||
{
|
||||
/**
|
||||
* Determine if a given string starts with a given substring.
|
||||
*
|
||||
* @param string $haystack
|
||||
* @param string|array $needles
|
||||
* @return bool
|
||||
*/
|
||||
function starts_with($haystack, $needles)
|
||||
{
|
||||
return Str::startsWith($haystack, $needles);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('str_contains'))
|
||||
{
|
||||
/**
|
||||
* Determine if a given string contains a given substring.
|
||||
*
|
||||
* @param string $haystack
|
||||
* @param string|array $needles
|
||||
* @return bool
|
||||
*/
|
||||
function str_contains($haystack, $needles)
|
||||
{
|
||||
return Str::contains($haystack, $needles);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('str_finish'))
|
||||
{
|
||||
/**
|
||||
* Cap a string with a single instance of a given value.
|
||||
*
|
||||
* @param string $value
|
||||
* @param string $cap
|
||||
* @return string
|
||||
*/
|
||||
function str_finish($value, $cap)
|
||||
{
|
||||
return Str::finish($value, $cap);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('str_is'))
|
||||
{
|
||||
/**
|
||||
* Determine if a given string matches a given pattern.
|
||||
*
|
||||
* @param string $pattern
|
||||
* @param string $value
|
||||
* @return bool
|
||||
*/
|
||||
function str_is($pattern, $value)
|
||||
{
|
||||
return Str::is($pattern, $value);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('str_limit'))
|
||||
{
|
||||
/**
|
||||
* Limit the number of characters in a string.
|
||||
*
|
||||
* @param string $value
|
||||
* @param int $limit
|
||||
* @param string $end
|
||||
* @return string
|
||||
*/
|
||||
function str_limit($value, $limit = 100, $end = '...')
|
||||
{
|
||||
return Str::limit($value, $limit, $end);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('str_plural'))
|
||||
{
|
||||
/**
|
||||
* Get the plural form of an English word.
|
||||
*
|
||||
* @param string $value
|
||||
* @param int $count
|
||||
* @return string
|
||||
*/
|
||||
function str_plural($value, $count = 2)
|
||||
{
|
||||
return Str::plural($value, $count);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('str_random'))
|
||||
{
|
||||
/**
|
||||
* Generate a more truly "random" alpha-numeric string.
|
||||
*
|
||||
* @param int $length
|
||||
* @return string
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
function str_random($length = 16)
|
||||
{
|
||||
return Str::random($length);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('str_replace_array'))
|
||||
{
|
||||
/**
|
||||
* Replace a given value in the string sequentially with an array.
|
||||
*
|
||||
* @param string $search
|
||||
* @param array $replace
|
||||
* @param string $subject
|
||||
* @return string
|
||||
*/
|
||||
function str_replace_array($search, array $replace, $subject)
|
||||
{
|
||||
foreach ($replace as $value)
|
||||
{
|
||||
$subject = preg_replace('/'.$search.'/', $value, $subject, 1);
|
||||
}
|
||||
|
||||
return $subject;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('str_singular'))
|
||||
{
|
||||
/**
|
||||
* Get the singular form of an English word.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
function str_singular($value)
|
||||
{
|
||||
return Str::singular($value);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('str_slug'))
|
||||
{
|
||||
/**
|
||||
* Generate a URL friendly "slug" from a given string.
|
||||
*
|
||||
* @param string $title
|
||||
* @param string $separator
|
||||
* @return string
|
||||
*/
|
||||
function str_slug($title, $separator = '-')
|
||||
{
|
||||
return Str::slug($title, $separator);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('studly_case'))
|
||||
{
|
||||
/**
|
||||
* Convert a value to studly caps case.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
function studly_case($value)
|
||||
{
|
||||
return Str::studly($value);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('trait_uses_recursive'))
|
||||
{
|
||||
/**
|
||||
* Returns all traits used by a trait and its traits.
|
||||
*
|
||||
* @param string $trait
|
||||
* @return array
|
||||
*/
|
||||
function trait_uses_recursive($trait)
|
||||
{
|
||||
$traits = class_uses($trait);
|
||||
|
||||
foreach ($traits as $trait)
|
||||
{
|
||||
$traits += trait_uses_recursive($trait);
|
||||
}
|
||||
|
||||
return $traits;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('value'))
|
||||
{
|
||||
/**
|
||||
* Return the default value of the given value.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return mixed
|
||||
*/
|
||||
function value($value)
|
||||
{
|
||||
return $value instanceof Closure ? $value() : $value;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('with'))
|
||||
{
|
||||
/**
|
||||
* Return the given object. Useful for chaining.
|
||||
*
|
||||
* @param mixed $object
|
||||
* @return mixed
|
||||
*/
|
||||
function with($object)
|
||||
{
|
||||
return $object;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user