v.0.1
This commit is contained in:
52
vendor/illuminate/support/AggregateServiceProvider.php
vendored
Normal file
52
vendor/illuminate/support/AggregateServiceProvider.php
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
<?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->resolveProvider($provider);
|
||||
|
||||
$provides = array_merge($provides, $instance->provides());
|
||||
}
|
||||
|
||||
return $provides;
|
||||
}
|
||||
}
|
664
vendor/illuminate/support/Arr.php
vendored
Executable file
664
vendor/illuminate/support/Arr.php
vendored
Executable file
@ -0,0 +1,664 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support;
|
||||
|
||||
use ArrayAccess;
|
||||
use Illuminate\Support\Traits\Macroable;
|
||||
use InvalidArgumentException;
|
||||
|
||||
class Arr
|
||||
{
|
||||
use Macroable;
|
||||
|
||||
/**
|
||||
* Determine whether the given value is array accessible.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public static function accessible($value)
|
||||
{
|
||||
return is_array($value) || $value instanceof ArrayAccess;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Collapse an array of arrays into a single array.
|
||||
*
|
||||
* @param iterable $array
|
||||
* @return array
|
||||
*/
|
||||
public static function collapse($array)
|
||||
{
|
||||
$results = [];
|
||||
|
||||
foreach ($array as $values) {
|
||||
if ($values instanceof Collection) {
|
||||
$values = $values->all();
|
||||
} elseif (! is_array($values)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$results[] = $values;
|
||||
}
|
||||
|
||||
return array_merge([], ...$results);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cross join the given arrays, returning all possible permutations.
|
||||
*
|
||||
* @param iterable ...$arrays
|
||||
* @return array
|
||||
*/
|
||||
public static function crossJoin(...$arrays)
|
||||
{
|
||||
$results = [[]];
|
||||
|
||||
foreach ($arrays as $index => $array) {
|
||||
$append = [];
|
||||
|
||||
foreach ($results as $product) {
|
||||
foreach ($array as $item) {
|
||||
$product[$index] = $item;
|
||||
|
||||
$append[] = $product;
|
||||
}
|
||||
}
|
||||
|
||||
$results = $append;
|
||||
}
|
||||
|
||||
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 iterable $array
|
||||
* @param string $prepend
|
||||
* @return array
|
||||
*/
|
||||
public static function dot($array, $prepend = '')
|
||||
{
|
||||
$results = [];
|
||||
|
||||
foreach ($array as $key => $value) {
|
||||
if (is_array($value) && ! empty($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 keys.
|
||||
*
|
||||
* @param array $array
|
||||
* @param array|string $keys
|
||||
* @return array
|
||||
*/
|
||||
public static function except($array, $keys)
|
||||
{
|
||||
static::forget($array, $keys);
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given key exists in the provided array.
|
||||
*
|
||||
* @param \ArrayAccess|array $array
|
||||
* @param string|int $key
|
||||
* @return bool
|
||||
*/
|
||||
public static function exists($array, $key)
|
||||
{
|
||||
if ($array instanceof ArrayAccess) {
|
||||
return $array->offsetExists($key);
|
||||
}
|
||||
|
||||
return array_key_exists($key, $array);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the first element in an array passing a given truth test.
|
||||
*
|
||||
* @param iterable $array
|
||||
* @param callable|null $callback
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public static function first($array, callable $callback = null, $default = null)
|
||||
{
|
||||
if (is_null($callback)) {
|
||||
if (empty($array)) {
|
||||
return value($default);
|
||||
}
|
||||
|
||||
foreach ($array as $item) {
|
||||
return $item;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($array as $key => $value) {
|
||||
if ($callback($value, $key)) {
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
return value($default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the last element in an array passing a given truth test.
|
||||
*
|
||||
* @param array $array
|
||||
* @param callable|null $callback
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public static function last($array, callable $callback = null, $default = null)
|
||||
{
|
||||
if (is_null($callback)) {
|
||||
return empty($array) ? value($default) : end($array);
|
||||
}
|
||||
|
||||
return static::first(array_reverse($array, true), $callback, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Flatten a multi-dimensional array into a single level.
|
||||
*
|
||||
* @param iterable $array
|
||||
* @param int $depth
|
||||
* @return array
|
||||
*/
|
||||
public static function flatten($array, $depth = INF)
|
||||
{
|
||||
$result = [];
|
||||
|
||||
foreach ($array as $item) {
|
||||
$item = $item instanceof Collection ? $item->all() : $item;
|
||||
|
||||
if (! is_array($item)) {
|
||||
$result[] = $item;
|
||||
} else {
|
||||
$values = $depth === 1
|
||||
? array_values($item)
|
||||
: static::flatten($item, $depth - 1);
|
||||
|
||||
foreach ($values as $value) {
|
||||
$result[] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
$keys = (array) $keys;
|
||||
|
||||
if (count($keys) === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($keys as $key) {
|
||||
// if the exact key exists in the top-level, remove it
|
||||
if (static::exists($array, $key)) {
|
||||
unset($array[$key]);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$parts = explode('.', $key);
|
||||
|
||||
// clean up before each pass
|
||||
$array = &$original;
|
||||
|
||||
while (count($parts) > 1) {
|
||||
$part = array_shift($parts);
|
||||
|
||||
if (isset($array[$part]) && is_array($array[$part])) {
|
||||
$array = &$array[$part];
|
||||
} else {
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
|
||||
unset($array[array_shift($parts)]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an item from an array using "dot" notation.
|
||||
*
|
||||
* @param \ArrayAccess|array $array
|
||||
* @param string|int|null $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public static function get($array, $key, $default = null)
|
||||
{
|
||||
if (! static::accessible($array)) {
|
||||
return value($default);
|
||||
}
|
||||
|
||||
if (is_null($key)) {
|
||||
return $array;
|
||||
}
|
||||
|
||||
if (static::exists($array, $key)) {
|
||||
return $array[$key];
|
||||
}
|
||||
|
||||
if (strpos($key, '.') === false) {
|
||||
return $array[$key] ?? value($default);
|
||||
}
|
||||
|
||||
foreach (explode('.', $key) as $segment) {
|
||||
if (static::accessible($array) && static::exists($array, $segment)) {
|
||||
$array = $array[$segment];
|
||||
} else {
|
||||
return value($default);
|
||||
}
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an item or items exist in an array using "dot" notation.
|
||||
*
|
||||
* @param \ArrayAccess|array $array
|
||||
* @param string|array $keys
|
||||
* @return bool
|
||||
*/
|
||||
public static function has($array, $keys)
|
||||
{
|
||||
$keys = (array) $keys;
|
||||
|
||||
if (! $array || $keys === []) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($keys as $key) {
|
||||
$subKeyArray = $array;
|
||||
|
||||
if (static::exists($array, $key)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach (explode('.', $key) as $segment) {
|
||||
if (static::accessible($subKeyArray) && static::exists($subKeyArray, $segment)) {
|
||||
$subKeyArray = $subKeyArray[$segment];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if any of the keys exist in an array using "dot" notation.
|
||||
*
|
||||
* @param \ArrayAccess|array $array
|
||||
* @param string|array $keys
|
||||
* @return bool
|
||||
*/
|
||||
public static function hasAny($array, $keys)
|
||||
{
|
||||
if (is_null($keys)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$keys = (array) $keys;
|
||||
|
||||
if (! $array) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($keys === []) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($keys as $key) {
|
||||
if (static::has($array, $key)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if an array is associative.
|
||||
*
|
||||
* An array is "associative" if it doesn't have sequential numerical keys beginning with zero.
|
||||
*
|
||||
* @param array $array
|
||||
* @return bool
|
||||
*/
|
||||
public static function isAssoc(array $array)
|
||||
{
|
||||
$keys = array_keys($array);
|
||||
|
||||
return array_keys($keys) !== $keys;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 iterable $array
|
||||
* @param string|array $value
|
||||
* @param string|array|null $key
|
||||
* @return array
|
||||
*/
|
||||
public static function pluck($array, $value, $key = null)
|
||||
{
|
||||
$results = [];
|
||||
|
||||
[$value, $key] = static::explodePluckParameters($value, $key);
|
||||
|
||||
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);
|
||||
|
||||
if (is_object($itemKey) && method_exists($itemKey, '__toString')) {
|
||||
$itemKey = (string) $itemKey;
|
||||
}
|
||||
|
||||
$results[$itemKey] = $itemValue;
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Explode the "value" and "key" arguments passed to "pluck".
|
||||
*
|
||||
* @param string|array $value
|
||||
* @param string|array|null $key
|
||||
* @return array
|
||||
*/
|
||||
protected static function explodePluckParameters($value, $key)
|
||||
{
|
||||
$value = is_string($value) ? explode('.', $value) : $value;
|
||||
|
||||
$key = is_null($key) || is_array($key) ? $key : explode('.', $key);
|
||||
|
||||
return [$value, $key];
|
||||
}
|
||||
|
||||
/**
|
||||
* Push an item onto the beginning of an array.
|
||||
*
|
||||
* @param array $array
|
||||
* @param mixed $value
|
||||
* @param mixed $key
|
||||
* @return array
|
||||
*/
|
||||
public static function prepend($array, $value, $key = null)
|
||||
{
|
||||
if (is_null($key)) {
|
||||
array_unshift($array, $value);
|
||||
} else {
|
||||
$array = [$key => $value] + $array;
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get one or a specified number of random values from an array.
|
||||
*
|
||||
* @param array $array
|
||||
* @param int|null $number
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function random($array, $number = null)
|
||||
{
|
||||
$requested = is_null($number) ? 1 : $number;
|
||||
|
||||
$count = count($array);
|
||||
|
||||
if ($requested > $count) {
|
||||
throw new InvalidArgumentException(
|
||||
"You requested {$requested} items, but there are only {$count} items available."
|
||||
);
|
||||
}
|
||||
|
||||
if (is_null($number)) {
|
||||
return $array[array_rand($array)];
|
||||
}
|
||||
|
||||
if ((int) $number === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$keys = array_rand($array, $number);
|
||||
|
||||
$results = [];
|
||||
|
||||
foreach ((array) $keys as $key) {
|
||||
$results[] = $array[$key];
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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|null $key
|
||||
* @param mixed $value
|
||||
* @return array
|
||||
*/
|
||||
public static function set(&$array, $key, $value)
|
||||
{
|
||||
if (is_null($key)) {
|
||||
return $array = $value;
|
||||
}
|
||||
|
||||
$keys = explode('.', $key);
|
||||
|
||||
foreach ($keys as $i => $key) {
|
||||
if (count($keys) === 1) {
|
||||
break;
|
||||
}
|
||||
|
||||
unset($keys[$i]);
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shuffle the given array and return the result.
|
||||
*
|
||||
* @param array $array
|
||||
* @param int|null $seed
|
||||
* @return array
|
||||
*/
|
||||
public static function shuffle($array, $seed = null)
|
||||
{
|
||||
if (is_null($seed)) {
|
||||
shuffle($array);
|
||||
} else {
|
||||
mt_srand($seed);
|
||||
shuffle($array);
|
||||
mt_srand();
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort the array using the given callback or "dot" notation.
|
||||
*
|
||||
* @param array $array
|
||||
* @param callable|string|null $callback
|
||||
* @return array
|
||||
*/
|
||||
public static function sort($array, $callback = null)
|
||||
{
|
||||
return Collection::make($array)->sortBy($callback)->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively sort an array by keys and values.
|
||||
*
|
||||
* @param array $array
|
||||
* @return array
|
||||
*/
|
||||
public static function sortRecursive($array)
|
||||
{
|
||||
foreach ($array as &$value) {
|
||||
if (is_array($value)) {
|
||||
$value = static::sortRecursive($value);
|
||||
}
|
||||
}
|
||||
|
||||
if (static::isAssoc($array)) {
|
||||
ksort($array);
|
||||
} else {
|
||||
sort($array);
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the array into a query string.
|
||||
*
|
||||
* @param array $array
|
||||
* @return string
|
||||
*/
|
||||
public static function query($array)
|
||||
{
|
||||
return http_build_query($array, '', '&', PHP_QUERY_RFC3986);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the array using the given callback.
|
||||
*
|
||||
* @param array $array
|
||||
* @param callable $callback
|
||||
* @return array
|
||||
*/
|
||||
public static function where($array, callable $callback)
|
||||
{
|
||||
return array_filter($array, $callback, ARRAY_FILTER_USE_BOTH);
|
||||
}
|
||||
|
||||
/**
|
||||
* If the given value is not an array and not null, wrap it in one.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return array
|
||||
*/
|
||||
public static function wrap($value)
|
||||
{
|
||||
if (is_null($value)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return is_array($value) ? $value : [$value];
|
||||
}
|
||||
}
|
10
vendor/illuminate/support/Carbon.php
vendored
Normal file
10
vendor/illuminate/support/Carbon.php
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support;
|
||||
|
||||
use Carbon\Carbon as BaseCarbon;
|
||||
|
||||
class Carbon extends BaseCarbon
|
||||
{
|
||||
//
|
||||
}
|
1391
vendor/illuminate/support/Collection.php
vendored
Normal file
1391
vendor/illuminate/support/Collection.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
110
vendor/illuminate/support/Composer.php
vendored
Normal file
110
vendor/illuminate/support/Composer.php
vendored
Normal file
@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support;
|
||||
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Symfony\Component\Process\PhpExecutableFinder;
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
class Composer
|
||||
{
|
||||
/**
|
||||
* The filesystem instance.
|
||||
*
|
||||
* @var \Illuminate\Filesystem\Filesystem
|
||||
*/
|
||||
protected $files;
|
||||
|
||||
/**
|
||||
* The working path to regenerate from.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
protected $workingPath;
|
||||
|
||||
/**
|
||||
* Create a new Composer manager instance.
|
||||
*
|
||||
* @param \Illuminate\Filesystem\Filesystem $files
|
||||
* @param string|null $workingPath
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Filesystem $files, $workingPath = null)
|
||||
{
|
||||
$this->files = $files;
|
||||
$this->workingPath = $workingPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Regenerate the Composer autoloader files.
|
||||
*
|
||||
* @param string|array $extra
|
||||
* @return void
|
||||
*/
|
||||
public function dumpAutoloads($extra = '')
|
||||
{
|
||||
$extra = $extra ? (array) $extra : [];
|
||||
|
||||
$command = array_merge($this->findComposer(), ['dump-autoload'], $extra);
|
||||
|
||||
$this->getProcess($command)->run();
|
||||
}
|
||||
|
||||
/**
|
||||
* Regenerate the optimized Composer autoloader files.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function dumpOptimized()
|
||||
{
|
||||
$this->dumpAutoloads('--optimize');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the composer command for the environment.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function findComposer()
|
||||
{
|
||||
if ($this->files->exists($this->workingPath.'/composer.phar')) {
|
||||
return [$this->phpBinary(), 'composer.phar'];
|
||||
}
|
||||
|
||||
return ['composer'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the PHP binary.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function phpBinary()
|
||||
{
|
||||
return ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new Symfony process instance.
|
||||
*
|
||||
* @param array $command
|
||||
* @return \Symfony\Component\Process\Process
|
||||
*/
|
||||
protected function getProcess(array $command)
|
||||
{
|
||||
return (new Process($command, $this->workingPath))->setTimeout(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the working path used by the class.
|
||||
*
|
||||
* @param string $path
|
||||
* @return $this
|
||||
*/
|
||||
public function setWorkingPath($path)
|
||||
{
|
||||
$this->workingPath = realpath($path);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
193
vendor/illuminate/support/ConfigurationUrlParser.php
vendored
Normal file
193
vendor/illuminate/support/ConfigurationUrlParser.php
vendored
Normal file
@ -0,0 +1,193 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support;
|
||||
|
||||
use InvalidArgumentException;
|
||||
|
||||
class ConfigurationUrlParser
|
||||
{
|
||||
/**
|
||||
* The drivers aliases map.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $driverAliases = [
|
||||
'mssql' => 'sqlsrv',
|
||||
'mysql2' => 'mysql', // RDS
|
||||
'postgres' => 'pgsql',
|
||||
'postgresql' => 'pgsql',
|
||||
'sqlite3' => 'sqlite',
|
||||
'redis' => 'tcp',
|
||||
'rediss' => 'tls',
|
||||
];
|
||||
|
||||
/**
|
||||
* Parse the database configuration, hydrating options using a database configuration URL if possible.
|
||||
*
|
||||
* @param array|string $config
|
||||
* @return array
|
||||
*/
|
||||
public function parseConfiguration($config)
|
||||
{
|
||||
if (is_string($config)) {
|
||||
$config = ['url' => $config];
|
||||
}
|
||||
|
||||
$url = Arr::pull($config, 'url');
|
||||
|
||||
if (! $url) {
|
||||
return $config;
|
||||
}
|
||||
|
||||
$rawComponents = $this->parseUrl($url);
|
||||
|
||||
$decodedComponents = $this->parseStringsToNativeTypes(
|
||||
array_map('rawurldecode', $rawComponents)
|
||||
);
|
||||
|
||||
return array_merge(
|
||||
$config,
|
||||
$this->getPrimaryOptions($decodedComponents),
|
||||
$this->getQueryOptions($rawComponents)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the primary database connection options.
|
||||
*
|
||||
* @param array $url
|
||||
* @return array
|
||||
*/
|
||||
protected function getPrimaryOptions($url)
|
||||
{
|
||||
return array_filter([
|
||||
'driver' => $this->getDriver($url),
|
||||
'database' => $this->getDatabase($url),
|
||||
'host' => $url['host'] ?? null,
|
||||
'port' => $url['port'] ?? null,
|
||||
'username' => $url['user'] ?? null,
|
||||
'password' => $url['pass'] ?? null,
|
||||
], function ($value) {
|
||||
return ! is_null($value);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the database driver from the URL.
|
||||
*
|
||||
* @param array $url
|
||||
* @return string|null
|
||||
*/
|
||||
protected function getDriver($url)
|
||||
{
|
||||
$alias = $url['scheme'] ?? null;
|
||||
|
||||
if (! $alias) {
|
||||
return;
|
||||
}
|
||||
|
||||
return static::$driverAliases[$alias] ?? $alias;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the database name from the URL.
|
||||
*
|
||||
* @param array $url
|
||||
* @return string|null
|
||||
*/
|
||||
protected function getDatabase($url)
|
||||
{
|
||||
$path = $url['path'] ?? null;
|
||||
|
||||
return $path && $path !== '/' ? substr($path, 1) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the additional database options from the query string.
|
||||
*
|
||||
* @param array $url
|
||||
* @return array
|
||||
*/
|
||||
protected function getQueryOptions($url)
|
||||
{
|
||||
$queryString = $url['query'] ?? null;
|
||||
|
||||
if (! $queryString) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$query = [];
|
||||
|
||||
parse_str($queryString, $query);
|
||||
|
||||
return $this->parseStringsToNativeTypes($query);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the string URL to an array of components.
|
||||
*
|
||||
* @param string $url
|
||||
* @return array
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
protected function parseUrl($url)
|
||||
{
|
||||
$url = preg_replace('#^(sqlite3?):///#', '$1://null/', $url);
|
||||
|
||||
$parsedUrl = parse_url($url);
|
||||
|
||||
if ($parsedUrl === false) {
|
||||
throw new InvalidArgumentException('The database configuration URL is malformed.');
|
||||
}
|
||||
|
||||
return $parsedUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert string casted values to their native types.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return mixed
|
||||
*/
|
||||
protected function parseStringsToNativeTypes($value)
|
||||
{
|
||||
if (is_array($value)) {
|
||||
return array_map([$this, 'parseStringsToNativeTypes'], $value);
|
||||
}
|
||||
|
||||
if (! is_string($value)) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
$parsedValue = json_decode($value, true);
|
||||
|
||||
if (json_last_error() === JSON_ERROR_NONE) {
|
||||
return $parsedValue;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the current drivers aliases.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getDriverAliases()
|
||||
{
|
||||
return static::$driverAliases;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given driver alias to the driver aliases array.
|
||||
*
|
||||
* @param string $alias
|
||||
* @param string $driver
|
||||
* @return void
|
||||
*/
|
||||
public static function addDriverAlias($alias, $driver)
|
||||
{
|
||||
static::$driverAliases[$alias] = $driver;
|
||||
}
|
||||
}
|
231
vendor/illuminate/support/DateFactory.php
vendored
Normal file
231
vendor/illuminate/support/DateFactory.php
vendored
Normal file
@ -0,0 +1,231 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support;
|
||||
|
||||
use Carbon\Factory;
|
||||
use InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* @see https://carbon.nesbot.com/docs/
|
||||
* @see https://github.com/briannesbitt/Carbon/blob/master/src/Carbon/Factory.php
|
||||
*
|
||||
* @method static Carbon create($year = 0, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0, $tz = null)
|
||||
* @method static Carbon createFromDate($year = null, $month = null, $day = null, $tz = null)
|
||||
* @method static Carbon|false createFromFormat($format, $time, $tz = null)
|
||||
* @method static Carbon createFromTime($hour = 0, $minute = 0, $second = 0, $tz = null)
|
||||
* @method static Carbon createFromTimeString($time, $tz = null)
|
||||
* @method static Carbon createFromTimestamp($timestamp, $tz = null)
|
||||
* @method static Carbon createFromTimestampMs($timestamp, $tz = null)
|
||||
* @method static Carbon createFromTimestampUTC($timestamp)
|
||||
* @method static Carbon createMidnightDate($year = null, $month = null, $day = null, $tz = null)
|
||||
* @method static Carbon|false createSafe($year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, $tz = null)
|
||||
* @method static Carbon disableHumanDiffOption($humanDiffOption)
|
||||
* @method static Carbon enableHumanDiffOption($humanDiffOption)
|
||||
* @method static mixed executeWithLocale($locale, $func)
|
||||
* @method static Carbon fromSerialized($value)
|
||||
* @method static array getAvailableLocales()
|
||||
* @method static array getDays()
|
||||
* @method static int getHumanDiffOptions()
|
||||
* @method static array getIsoUnits()
|
||||
* @method static Carbon getLastErrors()
|
||||
* @method static string getLocale()
|
||||
* @method static int getMidDayAt()
|
||||
* @method static Carbon getTestNow()
|
||||
* @method static \Symfony\Component\Translation\TranslatorInterface getTranslator()
|
||||
* @method static int getWeekEndsAt()
|
||||
* @method static int getWeekStartsAt()
|
||||
* @method static array getWeekendDays()
|
||||
* @method static bool hasFormat($date, $format)
|
||||
* @method static bool hasMacro($name)
|
||||
* @method static bool hasRelativeKeywords($time)
|
||||
* @method static bool hasTestNow()
|
||||
* @method static Carbon instance($date)
|
||||
* @method static bool isImmutable()
|
||||
* @method static bool isModifiableUnit($unit)
|
||||
* @method static Carbon isMutable()
|
||||
* @method static bool isStrictModeEnabled()
|
||||
* @method static bool localeHasDiffOneDayWords($locale)
|
||||
* @method static bool localeHasDiffSyntax($locale)
|
||||
* @method static bool localeHasDiffTwoDayWords($locale)
|
||||
* @method static bool localeHasPeriodSyntax($locale)
|
||||
* @method static bool localeHasShortUnits($locale)
|
||||
* @method static void macro($name, $macro)
|
||||
* @method static Carbon|null make($var)
|
||||
* @method static Carbon maxValue()
|
||||
* @method static Carbon minValue()
|
||||
* @method static void mixin($mixin)
|
||||
* @method static Carbon now($tz = null)
|
||||
* @method static Carbon parse($time = null, $tz = null)
|
||||
* @method static string pluralUnit(string $unit)
|
||||
* @method static void resetMonthsOverflow()
|
||||
* @method static void resetToStringFormat()
|
||||
* @method static void resetYearsOverflow()
|
||||
* @method static void serializeUsing($callback)
|
||||
* @method static Carbon setHumanDiffOptions($humanDiffOptions)
|
||||
* @method static bool setLocale($locale)
|
||||
* @method static void setMidDayAt($hour)
|
||||
* @method static Carbon setTestNow($testNow = null)
|
||||
* @method static void setToStringFormat($format)
|
||||
* @method static void setTranslator(\Symfony\Component\Translation\TranslatorInterface $translator)
|
||||
* @method static Carbon setUtf8($utf8)
|
||||
* @method static void setWeekEndsAt($day)
|
||||
* @method static void setWeekStartsAt($day)
|
||||
* @method static void setWeekendDays($days)
|
||||
* @method static bool shouldOverflowMonths()
|
||||
* @method static bool shouldOverflowYears()
|
||||
* @method static string singularUnit(string $unit)
|
||||
* @method static Carbon today($tz = null)
|
||||
* @method static Carbon tomorrow($tz = null)
|
||||
* @method static void useMonthsOverflow($monthsOverflow = true)
|
||||
* @method static Carbon useStrictMode($strictModeEnabled = true)
|
||||
* @method static void useYearsOverflow($yearsOverflow = true)
|
||||
* @method static Carbon yesterday($tz = null)
|
||||
*/
|
||||
class DateFactory
|
||||
{
|
||||
/**
|
||||
* The default class that will be used for all created dates.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const DEFAULT_CLASS_NAME = Carbon::class;
|
||||
|
||||
/**
|
||||
* The type (class) of dates that should be created.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $dateClass;
|
||||
|
||||
/**
|
||||
* This callable may be used to intercept date creation.
|
||||
*
|
||||
* @var callable
|
||||
*/
|
||||
protected static $callable;
|
||||
|
||||
/**
|
||||
* The Carbon factory that should be used when creating dates.
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
protected static $factory;
|
||||
|
||||
/**
|
||||
* Use the given handler when generating dates (class name, callable, or factory).
|
||||
*
|
||||
* @param mixed $handler
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function use($handler)
|
||||
{
|
||||
if (is_callable($handler) && is_object($handler)) {
|
||||
return static::useCallable($handler);
|
||||
} elseif (is_string($handler)) {
|
||||
return static::useClass($handler);
|
||||
} elseif ($handler instanceof Factory) {
|
||||
return static::useFactory($handler);
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException('Invalid date creation handler. Please provide a class name, callable, or Carbon factory.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the default date class when generating dates.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function useDefault()
|
||||
{
|
||||
static::$dateClass = null;
|
||||
static::$callable = null;
|
||||
static::$factory = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the given callable on each date creation.
|
||||
*
|
||||
* @param callable $callable
|
||||
* @return void
|
||||
*/
|
||||
public static function useCallable(callable $callable)
|
||||
{
|
||||
static::$callable = $callable;
|
||||
|
||||
static::$dateClass = null;
|
||||
static::$factory = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the given date type (class) when generating dates.
|
||||
*
|
||||
* @param string $dateClass
|
||||
* @return void
|
||||
*/
|
||||
public static function useClass($dateClass)
|
||||
{
|
||||
static::$dateClass = $dateClass;
|
||||
|
||||
static::$factory = null;
|
||||
static::$callable = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the given Carbon factory when generating dates.
|
||||
*
|
||||
* @param object $factory
|
||||
* @return void
|
||||
*/
|
||||
public static function useFactory($factory)
|
||||
{
|
||||
static::$factory = $factory;
|
||||
|
||||
static::$dateClass = null;
|
||||
static::$callable = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle dynamic calls to generate dates.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
$defaultClassName = static::DEFAULT_CLASS_NAME;
|
||||
|
||||
// Using callable to generate dates...
|
||||
if (static::$callable) {
|
||||
return call_user_func(static::$callable, $defaultClassName::$method(...$parameters));
|
||||
}
|
||||
|
||||
// Using Carbon factory to generate dates...
|
||||
if (static::$factory) {
|
||||
return static::$factory->$method(...$parameters);
|
||||
}
|
||||
|
||||
$dateClass = static::$dateClass ?: $defaultClassName;
|
||||
|
||||
// Check if date can be created using public class method...
|
||||
if (method_exists($dateClass, $method) ||
|
||||
method_exists($dateClass, 'hasMacro') && $dateClass::hasMacro($method)) {
|
||||
return $dateClass::$method(...$parameters);
|
||||
}
|
||||
|
||||
// If that fails, create the date with the default class..
|
||||
$date = $defaultClassName::$method(...$parameters);
|
||||
|
||||
// If the configured class has an "instance" method, we'll try to pass our date into there...
|
||||
if (method_exists($dateClass, 'instance')) {
|
||||
return $dateClass::instance($date);
|
||||
}
|
||||
|
||||
// Otherwise, assume the configured class has a DateTime compatible constructor...
|
||||
return new $dateClass($date->format('Y-m-d H:i:s.u'), $date->getTimezone());
|
||||
}
|
||||
}
|
928
vendor/illuminate/support/Enumerable.php
vendored
Normal file
928
vendor/illuminate/support/Enumerable.php
vendored
Normal file
@ -0,0 +1,928 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support;
|
||||
|
||||
use Countable;
|
||||
use Illuminate\Contracts\Support\Arrayable;
|
||||
use Illuminate\Contracts\Support\Jsonable;
|
||||
use IteratorAggregate;
|
||||
use JsonSerializable;
|
||||
|
||||
interface Enumerable extends Arrayable, Countable, IteratorAggregate, Jsonable, JsonSerializable
|
||||
{
|
||||
/**
|
||||
* Create a new collection instance if the value isn't one already.
|
||||
*
|
||||
* @param mixed $items
|
||||
* @return static
|
||||
*/
|
||||
public static function make($items = []);
|
||||
|
||||
/**
|
||||
* Create a new instance by invoking the callback a given amount of times.
|
||||
*
|
||||
* @param int $number
|
||||
* @param callable|null $callback
|
||||
* @return static
|
||||
*/
|
||||
public static function times($number, callable $callback = null);
|
||||
|
||||
/**
|
||||
* Wrap the given value in a collection if applicable.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return static
|
||||
*/
|
||||
public static function wrap($value);
|
||||
|
||||
/**
|
||||
* Get the underlying items from the given collection if applicable.
|
||||
*
|
||||
* @param array|static $value
|
||||
* @return array
|
||||
*/
|
||||
public static function unwrap($value);
|
||||
|
||||
/**
|
||||
* Get all items in the enumerable.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all();
|
||||
|
||||
/**
|
||||
* Alias for the "avg" method.
|
||||
*
|
||||
* @param callable|string|null $callback
|
||||
* @return mixed
|
||||
*/
|
||||
public function average($callback = null);
|
||||
|
||||
/**
|
||||
* Get the median of a given key.
|
||||
*
|
||||
* @param string|array|null $key
|
||||
* @return mixed
|
||||
*/
|
||||
public function median($key = null);
|
||||
|
||||
/**
|
||||
* Get the mode of a given key.
|
||||
*
|
||||
* @param string|array|null $key
|
||||
* @return array|null
|
||||
*/
|
||||
public function mode($key = null);
|
||||
|
||||
/**
|
||||
* Collapse the items into a single enumerable.
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function collapse();
|
||||
|
||||
/**
|
||||
* Alias for the "contains" method.
|
||||
*
|
||||
* @param mixed $key
|
||||
* @param mixed $operator
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public function some($key, $operator = null, $value = null);
|
||||
|
||||
/**
|
||||
* Determine if an item exists, using strict comparison.
|
||||
*
|
||||
* @param mixed $key
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public function containsStrict($key, $value = null);
|
||||
|
||||
/**
|
||||
* Get the average value of a given key.
|
||||
*
|
||||
* @param callable|string|null $callback
|
||||
* @return mixed
|
||||
*/
|
||||
public function avg($callback = null);
|
||||
|
||||
/**
|
||||
* Determine if an item exists in the enumerable.
|
||||
*
|
||||
* @param mixed $key
|
||||
* @param mixed $operator
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public function contains($key, $operator = null, $value = null);
|
||||
|
||||
/**
|
||||
* Dump the collection and end the script.
|
||||
*
|
||||
* @param mixed ...$args
|
||||
* @return void
|
||||
*/
|
||||
public function dd(...$args);
|
||||
|
||||
/**
|
||||
* Dump the collection.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function dump();
|
||||
|
||||
/**
|
||||
* Get the items that are not present in the given items.
|
||||
*
|
||||
* @param mixed $items
|
||||
* @return static
|
||||
*/
|
||||
public function diff($items);
|
||||
|
||||
/**
|
||||
* Get the items that are not present in the given items, using the callback.
|
||||
*
|
||||
* @param mixed $items
|
||||
* @param callable $callback
|
||||
* @return static
|
||||
*/
|
||||
public function diffUsing($items, callable $callback);
|
||||
|
||||
/**
|
||||
* Get the items whose keys and values are not present in the given items.
|
||||
*
|
||||
* @param mixed $items
|
||||
* @return static
|
||||
*/
|
||||
public function diffAssoc($items);
|
||||
|
||||
/**
|
||||
* Get the items whose keys and values are not present in the given items, using the callback.
|
||||
*
|
||||
* @param mixed $items
|
||||
* @param callable $callback
|
||||
* @return static
|
||||
*/
|
||||
public function diffAssocUsing($items, callable $callback);
|
||||
|
||||
/**
|
||||
* Get the items whose keys are not present in the given items.
|
||||
*
|
||||
* @param mixed $items
|
||||
* @return static
|
||||
*/
|
||||
public function diffKeys($items);
|
||||
|
||||
/**
|
||||
* Get the items whose keys are not present in the given items, using the callback.
|
||||
*
|
||||
* @param mixed $items
|
||||
* @param callable $callback
|
||||
* @return static
|
||||
*/
|
||||
public function diffKeysUsing($items, callable $callback);
|
||||
|
||||
/**
|
||||
* Retrieve duplicate items.
|
||||
*
|
||||
* @param callable|null $callback
|
||||
* @param bool $strict
|
||||
* @return static
|
||||
*/
|
||||
public function duplicates($callback = null, $strict = false);
|
||||
|
||||
/**
|
||||
* Retrieve duplicate items using strict comparison.
|
||||
*
|
||||
* @param callable|null $callback
|
||||
* @return static
|
||||
*/
|
||||
public function duplicatesStrict($callback = null);
|
||||
|
||||
/**
|
||||
* Execute a callback over each item.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return $this
|
||||
*/
|
||||
public function each(callable $callback);
|
||||
|
||||
/**
|
||||
* Execute a callback over each nested chunk of items.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return static
|
||||
*/
|
||||
public function eachSpread(callable $callback);
|
||||
|
||||
/**
|
||||
* Determine if all items pass the given truth test.
|
||||
*
|
||||
* @param string|callable $key
|
||||
* @param mixed $operator
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public function every($key, $operator = null, $value = null);
|
||||
|
||||
/**
|
||||
* Get all items except for those with the specified keys.
|
||||
*
|
||||
* @param mixed $keys
|
||||
* @return static
|
||||
*/
|
||||
public function except($keys);
|
||||
|
||||
/**
|
||||
* Run a filter over each of the items.
|
||||
*
|
||||
* @param callable|null $callback
|
||||
* @return static
|
||||
*/
|
||||
public function filter(callable $callback = null);
|
||||
|
||||
/**
|
||||
* Apply the callback if the value is truthy.
|
||||
*
|
||||
* @param bool $value
|
||||
* @param callable $callback
|
||||
* @param callable|null $default
|
||||
* @return static|mixed
|
||||
*/
|
||||
public function when($value, callable $callback, callable $default = null);
|
||||
|
||||
/**
|
||||
* Apply the callback if the collection is empty.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @param callable|null $default
|
||||
* @return static|mixed
|
||||
*/
|
||||
public function whenEmpty(callable $callback, callable $default = null);
|
||||
|
||||
/**
|
||||
* Apply the callback if the collection is not empty.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @param callable|null $default
|
||||
* @return static|mixed
|
||||
*/
|
||||
public function whenNotEmpty(callable $callback, callable $default = null);
|
||||
|
||||
/**
|
||||
* Apply the callback if the value is falsy.
|
||||
*
|
||||
* @param bool $value
|
||||
* @param callable $callback
|
||||
* @param callable|null $default
|
||||
* @return static|mixed
|
||||
*/
|
||||
public function unless($value, callable $callback, callable $default = null);
|
||||
|
||||
/**
|
||||
* Apply the callback unless the collection is empty.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @param callable|null $default
|
||||
* @return static|mixed
|
||||
*/
|
||||
public function unlessEmpty(callable $callback, callable $default = null);
|
||||
|
||||
/**
|
||||
* Apply the callback unless the collection is not empty.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @param callable|null $default
|
||||
* @return static|mixed
|
||||
*/
|
||||
public function unlessNotEmpty(callable $callback, callable $default = null);
|
||||
|
||||
/**
|
||||
* Filter items by the given key value pair.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $operator
|
||||
* @param mixed $value
|
||||
* @return static
|
||||
*/
|
||||
public function where($key, $operator = null, $value = null);
|
||||
|
||||
/**
|
||||
* Filter items by the given key value pair using strict comparison.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @return static
|
||||
*/
|
||||
public function whereStrict($key, $value);
|
||||
|
||||
/**
|
||||
* Filter items by the given key value pair.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $values
|
||||
* @param bool $strict
|
||||
* @return static
|
||||
*/
|
||||
public function whereIn($key, $values, $strict = false);
|
||||
|
||||
/**
|
||||
* Filter items by the given key value pair using strict comparison.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $values
|
||||
* @return static
|
||||
*/
|
||||
public function whereInStrict($key, $values);
|
||||
|
||||
/**
|
||||
* Filter items such that the value of the given key is between the given values.
|
||||
*
|
||||
* @param string $key
|
||||
* @param array $values
|
||||
* @return static
|
||||
*/
|
||||
public function whereBetween($key, $values);
|
||||
|
||||
/**
|
||||
* Filter items such that the value of the given key is not between the given values.
|
||||
*
|
||||
* @param string $key
|
||||
* @param array $values
|
||||
* @return static
|
||||
*/
|
||||
public function whereNotBetween($key, $values);
|
||||
|
||||
/**
|
||||
* Filter items by the given key value pair.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $values
|
||||
* @param bool $strict
|
||||
* @return static
|
||||
*/
|
||||
public function whereNotIn($key, $values, $strict = false);
|
||||
|
||||
/**
|
||||
* Filter items by the given key value pair using strict comparison.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $values
|
||||
* @return static
|
||||
*/
|
||||
public function whereNotInStrict($key, $values);
|
||||
|
||||
/**
|
||||
* Filter the items, removing any items that don't match the given type.
|
||||
*
|
||||
* @param string $type
|
||||
* @return static
|
||||
*/
|
||||
public function whereInstanceOf($type);
|
||||
|
||||
/**
|
||||
* Get the first item from the enumerable passing the given truth test.
|
||||
*
|
||||
* @param callable|null $callback
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public function first(callable $callback = null, $default = null);
|
||||
|
||||
/**
|
||||
* Get the first item by the given key value pair.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $operator
|
||||
* @param mixed $value
|
||||
* @return mixed
|
||||
*/
|
||||
public function firstWhere($key, $operator = null, $value = null);
|
||||
|
||||
/**
|
||||
* Flip the values with their keys.
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function flip();
|
||||
|
||||
/**
|
||||
* Get an item from the collection by key.
|
||||
*
|
||||
* @param mixed $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($key, $default = null);
|
||||
|
||||
/**
|
||||
* Group an associative array by a field or using a callback.
|
||||
*
|
||||
* @param array|callable|string $groupBy
|
||||
* @param bool $preserveKeys
|
||||
* @return static
|
||||
*/
|
||||
public function groupBy($groupBy, $preserveKeys = false);
|
||||
|
||||
/**
|
||||
* Key an associative array by a field or using a callback.
|
||||
*
|
||||
* @param callable|string $keyBy
|
||||
* @return static
|
||||
*/
|
||||
public function keyBy($keyBy);
|
||||
|
||||
/**
|
||||
* Determine if an item exists in the collection by key.
|
||||
*
|
||||
* @param mixed $key
|
||||
* @return bool
|
||||
*/
|
||||
public function has($key);
|
||||
|
||||
/**
|
||||
* Concatenate values of a given key as a string.
|
||||
*
|
||||
* @param string $value
|
||||
* @param string|null $glue
|
||||
* @return string
|
||||
*/
|
||||
public function implode($value, $glue = null);
|
||||
|
||||
/**
|
||||
* Intersect the collection with the given items.
|
||||
*
|
||||
* @param mixed $items
|
||||
* @return static
|
||||
*/
|
||||
public function intersect($items);
|
||||
|
||||
/**
|
||||
* Intersect the collection with the given items by key.
|
||||
*
|
||||
* @param mixed $items
|
||||
* @return static
|
||||
*/
|
||||
public function intersectByKeys($items);
|
||||
|
||||
/**
|
||||
* Determine if the collection is empty or not.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isEmpty();
|
||||
|
||||
/**
|
||||
* Determine if the collection is not empty.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isNotEmpty();
|
||||
|
||||
/**
|
||||
* Join all items from the collection using a string. The final items can use a separate glue string.
|
||||
*
|
||||
* @param string $glue
|
||||
* @param string $finalGlue
|
||||
* @return string
|
||||
*/
|
||||
public function join($glue, $finalGlue = '');
|
||||
|
||||
/**
|
||||
* Get the keys of the collection items.
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function keys();
|
||||
|
||||
/**
|
||||
* Get the last item from the collection.
|
||||
*
|
||||
* @param callable|null $callback
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public function last(callable $callback = null, $default = null);
|
||||
|
||||
/**
|
||||
* Run a map over each of the items.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return static
|
||||
*/
|
||||
public function map(callable $callback);
|
||||
|
||||
/**
|
||||
* Run a map over each nested chunk of items.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return static
|
||||
*/
|
||||
public function mapSpread(callable $callback);
|
||||
|
||||
/**
|
||||
* Run a dictionary map over the items.
|
||||
*
|
||||
* The callback should return an associative array with a single key/value pair.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return static
|
||||
*/
|
||||
public function mapToDictionary(callable $callback);
|
||||
|
||||
/**
|
||||
* Run a grouping map over the items.
|
||||
*
|
||||
* The callback should return an associative array with a single key/value pair.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return static
|
||||
*/
|
||||
public function mapToGroups(callable $callback);
|
||||
|
||||
/**
|
||||
* Run an associative map over each of the items.
|
||||
*
|
||||
* The callback should return an associative array with a single key/value pair.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return static
|
||||
*/
|
||||
public function mapWithKeys(callable $callback);
|
||||
|
||||
/**
|
||||
* Map a collection and flatten the result by a single level.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return static
|
||||
*/
|
||||
public function flatMap(callable $callback);
|
||||
|
||||
/**
|
||||
* Map the values into a new class.
|
||||
*
|
||||
* @param string $class
|
||||
* @return static
|
||||
*/
|
||||
public function mapInto($class);
|
||||
|
||||
/**
|
||||
* Merge the collection with the given items.
|
||||
*
|
||||
* @param mixed $items
|
||||
* @return static
|
||||
*/
|
||||
public function merge($items);
|
||||
|
||||
/**
|
||||
* Recursively merge the collection with the given items.
|
||||
*
|
||||
* @param mixed $items
|
||||
* @return static
|
||||
*/
|
||||
public function mergeRecursive($items);
|
||||
|
||||
/**
|
||||
* Create a collection by using this collection for keys and another for its values.
|
||||
*
|
||||
* @param mixed $values
|
||||
* @return static
|
||||
*/
|
||||
public function combine($values);
|
||||
|
||||
/**
|
||||
* Union the collection with the given items.
|
||||
*
|
||||
* @param mixed $items
|
||||
* @return static
|
||||
*/
|
||||
public function union($items);
|
||||
|
||||
/**
|
||||
* Get the min value of a given key.
|
||||
*
|
||||
* @param callable|string|null $callback
|
||||
* @return mixed
|
||||
*/
|
||||
public function min($callback = null);
|
||||
|
||||
/**
|
||||
* Get the max value of a given key.
|
||||
*
|
||||
* @param callable|string|null $callback
|
||||
* @return mixed
|
||||
*/
|
||||
public function max($callback = null);
|
||||
|
||||
/**
|
||||
* Create a new collection consisting of every n-th element.
|
||||
*
|
||||
* @param int $step
|
||||
* @param int $offset
|
||||
* @return static
|
||||
*/
|
||||
public function nth($step, $offset = 0);
|
||||
|
||||
/**
|
||||
* Get the items with the specified keys.
|
||||
*
|
||||
* @param mixed $keys
|
||||
* @return static
|
||||
*/
|
||||
public function only($keys);
|
||||
|
||||
/**
|
||||
* "Paginate" the collection by slicing it into a smaller collection.
|
||||
*
|
||||
* @param int $page
|
||||
* @param int $perPage
|
||||
* @return static
|
||||
*/
|
||||
public function forPage($page, $perPage);
|
||||
|
||||
/**
|
||||
* Partition the collection into two arrays using the given callback or key.
|
||||
*
|
||||
* @param callable|string $key
|
||||
* @param mixed $operator
|
||||
* @param mixed $value
|
||||
* @return static
|
||||
*/
|
||||
public function partition($key, $operator = null, $value = null);
|
||||
|
||||
/**
|
||||
* Push all of the given items onto the collection.
|
||||
*
|
||||
* @param iterable $source
|
||||
* @return static
|
||||
*/
|
||||
public function concat($source);
|
||||
|
||||
/**
|
||||
* Get one or a specified number of items randomly from the collection.
|
||||
*
|
||||
* @param int|null $number
|
||||
* @return static|mixed
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function random($number = null);
|
||||
|
||||
/**
|
||||
* Reduce the collection to a single value.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @param mixed $initial
|
||||
* @return mixed
|
||||
*/
|
||||
public function reduce(callable $callback, $initial = null);
|
||||
|
||||
/**
|
||||
* Replace the collection items with the given items.
|
||||
*
|
||||
* @param mixed $items
|
||||
* @return static
|
||||
*/
|
||||
public function replace($items);
|
||||
|
||||
/**
|
||||
* Recursively replace the collection items with the given items.
|
||||
*
|
||||
* @param mixed $items
|
||||
* @return static
|
||||
*/
|
||||
public function replaceRecursive($items);
|
||||
|
||||
/**
|
||||
* Reverse items order.
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function reverse();
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* Shuffle the items in the collection.
|
||||
*
|
||||
* @param int|null $seed
|
||||
* @return static
|
||||
*/
|
||||
public function shuffle($seed = null);
|
||||
|
||||
/**
|
||||
* Skip the first {$count} items.
|
||||
*
|
||||
* @param int $count
|
||||
* @return static
|
||||
*/
|
||||
public function skip($count);
|
||||
|
||||
/**
|
||||
* Get a slice of items from the enumerable.
|
||||
*
|
||||
* @param int $offset
|
||||
* @param int|null $length
|
||||
* @return static
|
||||
*/
|
||||
public function slice($offset, $length = null);
|
||||
|
||||
/**
|
||||
* Split a collection into a certain number of groups.
|
||||
*
|
||||
* @param int $numberOfGroups
|
||||
* @return static
|
||||
*/
|
||||
public function split($numberOfGroups);
|
||||
|
||||
/**
|
||||
* Chunk the collection into chunks of the given size.
|
||||
*
|
||||
* @param int $size
|
||||
* @return static
|
||||
*/
|
||||
public function chunk($size);
|
||||
|
||||
/**
|
||||
* Sort through each item with a callback.
|
||||
*
|
||||
* @param callable|null|int $callback
|
||||
* @return static
|
||||
*/
|
||||
public function sort($callback = null);
|
||||
|
||||
/**
|
||||
* Sort items in descending order.
|
||||
*
|
||||
* @param int $options
|
||||
* @return static
|
||||
*/
|
||||
public function sortDesc($options = SORT_REGULAR);
|
||||
|
||||
/**
|
||||
* Sort the collection using the given callback.
|
||||
*
|
||||
* @param callable|string $callback
|
||||
* @param int $options
|
||||
* @param bool $descending
|
||||
* @return static
|
||||
*/
|
||||
public function sortBy($callback, $options = SORT_REGULAR, $descending = false);
|
||||
|
||||
/**
|
||||
* Sort the collection in descending order using the given callback.
|
||||
*
|
||||
* @param callable|string $callback
|
||||
* @param int $options
|
||||
* @return static
|
||||
*/
|
||||
public function sortByDesc($callback, $options = SORT_REGULAR);
|
||||
|
||||
/**
|
||||
* Sort the collection keys.
|
||||
*
|
||||
* @param int $options
|
||||
* @param bool $descending
|
||||
* @return static
|
||||
*/
|
||||
public function sortKeys($options = SORT_REGULAR, $descending = false);
|
||||
|
||||
/**
|
||||
* Sort the collection keys in descending order.
|
||||
*
|
||||
* @param int $options
|
||||
* @return static
|
||||
*/
|
||||
public function sortKeysDesc($options = SORT_REGULAR);
|
||||
|
||||
/**
|
||||
* Get the sum of the given values.
|
||||
*
|
||||
* @param callable|string|null $callback
|
||||
* @return mixed
|
||||
*/
|
||||
public function sum($callback = null);
|
||||
|
||||
/**
|
||||
* Take the first or last {$limit} items.
|
||||
*
|
||||
* @param int $limit
|
||||
* @return static
|
||||
*/
|
||||
public function take($limit);
|
||||
|
||||
/**
|
||||
* Pass the collection to the given callback and then return it.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return $this
|
||||
*/
|
||||
public function tap(callable $callback);
|
||||
|
||||
/**
|
||||
* Pass the enumerable to the given callback and return the result.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return mixed
|
||||
*/
|
||||
public function pipe(callable $callback);
|
||||
|
||||
/**
|
||||
* Get the values of a given key.
|
||||
*
|
||||
* @param string|array $value
|
||||
* @param string|null $key
|
||||
* @return static
|
||||
*/
|
||||
public function pluck($value, $key = null);
|
||||
|
||||
/**
|
||||
* Create a collection of all elements that do not pass a given truth test.
|
||||
*
|
||||
* @param callable|mixed $callback
|
||||
* @return static
|
||||
*/
|
||||
public function reject($callback = true);
|
||||
|
||||
/**
|
||||
* Return only unique items from the collection array.
|
||||
*
|
||||
* @param string|callable|null $key
|
||||
* @param bool $strict
|
||||
* @return static
|
||||
*/
|
||||
public function unique($key = null, $strict = false);
|
||||
|
||||
/**
|
||||
* Return only unique items from the collection array using strict comparison.
|
||||
*
|
||||
* @param string|callable|null $key
|
||||
* @return static
|
||||
*/
|
||||
public function uniqueStrict($key = null);
|
||||
|
||||
/**
|
||||
* Reset the keys on the underlying array.
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function values();
|
||||
|
||||
/**
|
||||
* Pad collection to the specified length with a value.
|
||||
*
|
||||
* @param int $size
|
||||
* @param mixed $value
|
||||
* @return static
|
||||
*/
|
||||
public function pad($size, $value);
|
||||
|
||||
/**
|
||||
* Count the number of items in the collection using a given truth test.
|
||||
*
|
||||
* @param callable|null $callback
|
||||
* @return static
|
||||
*/
|
||||
public function countBy($callback = null);
|
||||
|
||||
/**
|
||||
* Collect the values into a collection.
|
||||
*
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function collect();
|
||||
|
||||
/**
|
||||
* Convert the collection to its string representation.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString();
|
||||
|
||||
/**
|
||||
* Add a method to the list of proxied methods.
|
||||
*
|
||||
* @param string $method
|
||||
* @return void
|
||||
*/
|
||||
public static function proxy($method);
|
||||
|
||||
/**
|
||||
* Dynamically access collection proxies.
|
||||
*
|
||||
* @param string $key
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __get($key);
|
||||
}
|
108
vendor/illuminate/support/Env.php
vendored
Normal file
108
vendor/illuminate/support/Env.php
vendored
Normal file
@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support;
|
||||
|
||||
use Dotenv\Repository\Adapter\EnvConstAdapter;
|
||||
use Dotenv\Repository\Adapter\PutenvAdapter;
|
||||
use Dotenv\Repository\Adapter\ServerConstAdapter;
|
||||
use Dotenv\Repository\RepositoryBuilder;
|
||||
use PhpOption\Option;
|
||||
|
||||
class Env
|
||||
{
|
||||
/**
|
||||
* Indicates if the putenv adapter is enabled.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected static $putenv = true;
|
||||
|
||||
/**
|
||||
* The environment repository instance.
|
||||
*
|
||||
* @var \Dotenv\Repository\RepositoryInterface|null
|
||||
*/
|
||||
protected static $repository;
|
||||
|
||||
/**
|
||||
* Enable the putenv adapter.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function enablePutenv()
|
||||
{
|
||||
static::$putenv = true;
|
||||
static::$repository = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable the putenv adapter.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function disablePutenv()
|
||||
{
|
||||
static::$putenv = false;
|
||||
static::$repository = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the environment repository instance.
|
||||
*
|
||||
* @return \Dotenv\Repository\RepositoryInterface
|
||||
*/
|
||||
public static function getRepository()
|
||||
{
|
||||
if (static::$repository === null) {
|
||||
$adapters = array_merge(
|
||||
[new EnvConstAdapter, new ServerConstAdapter],
|
||||
static::$putenv ? [new PutenvAdapter] : []
|
||||
);
|
||||
|
||||
static::$repository = RepositoryBuilder::create()
|
||||
->withReaders($adapters)
|
||||
->withWriters($adapters)
|
||||
->immutable()
|
||||
->make();
|
||||
}
|
||||
|
||||
return static::$repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of an environment variable.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public static function get($key, $default = null)
|
||||
{
|
||||
return Option::fromValue(static::getRepository()->get($key))
|
||||
->map(function ($value) {
|
||||
switch (strtolower($value)) {
|
||||
case 'true':
|
||||
case '(true)':
|
||||
return true;
|
||||
case 'false':
|
||||
case '(false)':
|
||||
return false;
|
||||
case 'empty':
|
||||
case '(empty)':
|
||||
return '';
|
||||
case 'null':
|
||||
case '(null)':
|
||||
return;
|
||||
}
|
||||
|
||||
if (preg_match('/\A([\'"])(.*)\1\z/', $value, $matches)) {
|
||||
return $matches[2];
|
||||
}
|
||||
|
||||
return $value;
|
||||
})
|
||||
->getOrCall(function () use ($default) {
|
||||
return value($default);
|
||||
});
|
||||
}
|
||||
}
|
58
vendor/illuminate/support/Facades/App.php
vendored
Executable file
58
vendor/illuminate/support/Facades/App.php
vendored
Executable file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @method static \Illuminate\Contracts\Foundation\Application loadEnvironmentFrom(string $file)
|
||||
* @method static \Illuminate\Support\ServiceProvider register(\Illuminate\Support\ServiceProvider|string $provider, bool $force = false)
|
||||
* @method static \Illuminate\Support\ServiceProvider resolveProvider(string $provider)
|
||||
* @method static array getProviders(\Illuminate\Support\ServiceProvider|string $provider)
|
||||
* @method static bool configurationIsCached()
|
||||
* @method static bool hasBeenBootstrapped()
|
||||
* @method static bool isDownForMaintenance()
|
||||
* @method static bool routesAreCached()
|
||||
* @method static bool runningInConsole()
|
||||
* @method static bool runningUnitTests()
|
||||
* @method static bool shouldSkipMiddleware()
|
||||
* @method static string basePath()
|
||||
* @method static string bootstrapPath(string $path = '')
|
||||
* @method static string configPath(string $path = '')
|
||||
* @method static string databasePath(string $path = '')
|
||||
* @method static string detectEnvironment(callable $callback)
|
||||
* @method static string environmentFile()
|
||||
* @method static string environmentFilePath()
|
||||
* @method static string environmentPath()
|
||||
* @method static string getCachedConfigPath()
|
||||
* @method static string getCachedPackagesPath()
|
||||
* @method static string getCachedRoutesPath()
|
||||
* @method static string getCachedServicesPath()
|
||||
* @method static string getLocale()
|
||||
* @method static string getNamespace()
|
||||
* @method static string resourcePath(string $path = '')
|
||||
* @method static string storagePath(string $path = '')
|
||||
* @method static string version()
|
||||
* @method static string|bool environment(string|array ...$environments)
|
||||
* @method static void boot()
|
||||
* @method static void booted(callable $callback)
|
||||
* @method static void booting(callable $callback)
|
||||
* @method static void bootstrapWith(array $bootstrappers)
|
||||
* @method static void loadDeferredProviders()
|
||||
* @method static void registerConfiguredProviders()
|
||||
* @method static void registerDeferredProvider(string $provider, string $service = null)
|
||||
* @method static void setLocale(string $locale)
|
||||
* @method static void terminate()
|
||||
*
|
||||
* @see \Illuminate\Contracts\Foundation\Application
|
||||
*/
|
||||
class App extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'app';
|
||||
}
|
||||
}
|
29
vendor/illuminate/support/Facades/Artisan.php
vendored
Executable file
29
vendor/illuminate/support/Facades/Artisan.php
vendored
Executable file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
use Illuminate\Contracts\Console\Kernel as ConsoleKernelContract;
|
||||
|
||||
/**
|
||||
* @method static \Illuminate\Foundation\Bus\PendingDispatch queue(string $command, array $parameters = [])
|
||||
* @method static \Illuminate\Foundation\Console\ClosureCommand command(string $command, callable $callback)
|
||||
* @method static array all()
|
||||
* @method static int call(string $command, array $parameters = [], \Symfony\Component\Console\Output\OutputInterface|null $outputBuffer = null)
|
||||
* @method static int handle(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface|null $output = null)
|
||||
* @method static string output()
|
||||
* @method static void terminate(\Symfony\Component\Console\Input\InputInterface $input, int $status)
|
||||
*
|
||||
* @see \Illuminate\Contracts\Console\Kernel
|
||||
*/
|
||||
class Artisan extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return ConsoleKernelContract::class;
|
||||
}
|
||||
}
|
61
vendor/illuminate/support/Facades/Auth.php
vendored
Executable file
61
vendor/illuminate/support/Facades/Auth.php
vendored
Executable file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
use Laravel\Ui\UiServiceProvider;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* @method static \Illuminate\Auth\AuthManager extend(string $driver, \Closure $callback)
|
||||
* @method static \Illuminate\Auth\AuthManager provider(string $name, \Closure $callback)
|
||||
* @method static \Illuminate\Contracts\Auth\Authenticatable loginUsingId(mixed $id, bool $remember = false)
|
||||
* @method static \Illuminate\Contracts\Auth\Authenticatable|null user()
|
||||
* @method static \Illuminate\Contracts\Auth\Guard|\Illuminate\Contracts\Auth\StatefulGuard guard(string|null $name = null)
|
||||
* @method static \Illuminate\Contracts\Auth\UserProvider|null createUserProvider(string $provider = null)
|
||||
* @method static \Symfony\Component\HttpFoundation\Response|null onceBasic(string $field = 'email',array $extraConditions = [])
|
||||
* @method static bool attempt(array $credentials = [], bool $remember = false)
|
||||
* @method static bool check()
|
||||
* @method static bool guest()
|
||||
* @method static bool once(array $credentials = [])
|
||||
* @method static bool onceUsingId(mixed $id)
|
||||
* @method static bool validate(array $credentials = [])
|
||||
* @method static bool viaRemember()
|
||||
* @method static bool|null logoutOtherDevices(string $password, string $attribute = 'password')
|
||||
* @method static int|string|null id()
|
||||
* @method static void login(\Illuminate\Contracts\Auth\Authenticatable $user, bool $remember = false)
|
||||
* @method static void logout()
|
||||
* @method static void setUser(\Illuminate\Contracts\Auth\Authenticatable $user)
|
||||
* @method static void shouldUse(string $name);
|
||||
*
|
||||
* @see \Illuminate\Auth\AuthManager
|
||||
* @see \Illuminate\Contracts\Auth\Factory
|
||||
* @see \Illuminate\Contracts\Auth\Guard
|
||||
* @see \Illuminate\Contracts\Auth\StatefulGuard
|
||||
*/
|
||||
class Auth extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'auth';
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the typical authentication routes for an application.
|
||||
*
|
||||
* @param array $options
|
||||
* @return void
|
||||
*/
|
||||
public static function routes(array $options = [])
|
||||
{
|
||||
if (! static::$app->providerIsLoaded(UiServiceProvider::class)) {
|
||||
throw new RuntimeException('In order to use the Auth::routes() method, please install the laravel/ui package.');
|
||||
}
|
||||
|
||||
static::$app->make('router')->auth($options);
|
||||
}
|
||||
}
|
42
vendor/illuminate/support/Facades/Blade.php
vendored
Executable file
42
vendor/illuminate/support/Facades/Blade.php
vendored
Executable file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @method static array getClassComponentAliases()
|
||||
* @method static array getCustomDirectives()
|
||||
* @method static array getExtensions()
|
||||
* @method static bool check(string $name, array ...$parameters)
|
||||
* @method static string compileString(string $value)
|
||||
* @method static string getPath()
|
||||
* @method static string stripParentheses(string $expression)
|
||||
* @method static void aliasComponent(string $path, string|null $alias = null)
|
||||
* @method static void aliasInclude(string $path, string|null $alias = null)
|
||||
* @method static void compile(string|null $path = null)
|
||||
* @method static void component(string $class, string|null $alias = null, string $prefix = '')
|
||||
* @method static void components(array $components, string $prefix = '')
|
||||
* @method static void directive(string $name, callable $handler)
|
||||
* @method static void extend(callable $compiler)
|
||||
* @method static void if(string $name, callable $callback)
|
||||
* @method static void include(string $path, string|null $alias = null)
|
||||
* @method static void precompiler(callable $precompiler)
|
||||
* @method static void setEchoFormat(string $format)
|
||||
* @method static void setPath(string $path)
|
||||
* @method static void withDoubleEncoding()
|
||||
* @method static void withoutComponentTags()
|
||||
* @method static void withoutDoubleEncoding()
|
||||
*
|
||||
* @see \Illuminate\View\Compilers\BladeCompiler
|
||||
*/
|
||||
class Blade extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'blade.compiler';
|
||||
}
|
||||
}
|
26
vendor/illuminate/support/Facades/Broadcast.php
vendored
Normal file
26
vendor/illuminate/support/Facades/Broadcast.php
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
use Illuminate\Contracts\Broadcasting\Factory as BroadcastingFactoryContract;
|
||||
|
||||
/**
|
||||
* @method static \Illuminate\Broadcasting\Broadcasters\Broadcaster channel(string $channel, callable|string $callback, array $options = [])
|
||||
* @method static mixed auth(\Illuminate\Http\Request $request)
|
||||
* @method static void connection($name = null);
|
||||
* @method static void routes(array $attributes = null)
|
||||
*
|
||||
* @see \Illuminate\Contracts\Broadcasting\Factory
|
||||
*/
|
||||
class Broadcast extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return BroadcastingFactoryContract::class;
|
||||
}
|
||||
}
|
60
vendor/illuminate/support/Facades/Bus.php
vendored
Normal file
60
vendor/illuminate/support/Facades/Bus.php
vendored
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
use Illuminate\Contracts\Bus\Dispatcher as BusDispatcherContract;
|
||||
use Illuminate\Foundation\Bus\PendingChain;
|
||||
use Illuminate\Support\Testing\Fakes\BusFake;
|
||||
|
||||
/**
|
||||
* @method static \Illuminate\Contracts\Bus\Dispatcher map(array $map)
|
||||
* @method static \Illuminate\Contracts\Bus\Dispatcher pipeThrough(array $pipes)
|
||||
* @method static bool hasCommandHandler($command)
|
||||
* @method static bool|mixed getCommandHandler($command)
|
||||
* @method static mixed dispatch($command)
|
||||
* @method static mixed dispatchNow($command, $handler = null)
|
||||
* @method static void assertDispatched(string $command, callable|int $callback = null)
|
||||
* @method static void assertDispatchedTimes(string $command, int $times = 1)
|
||||
* @method static void assertNotDispatched(string $command, callable|int $callback = null)
|
||||
*
|
||||
* @see \Illuminate\Contracts\Bus\Dispatcher
|
||||
*/
|
||||
class Bus extends Facade
|
||||
{
|
||||
/**
|
||||
* Replace the bound instance with a fake.
|
||||
*
|
||||
* @param array|string $jobsToFake
|
||||
* @return \Illuminate\Support\Testing\Fakes\BusFake
|
||||
*/
|
||||
public static function fake($jobsToFake = [])
|
||||
{
|
||||
static::swap($fake = new BusFake(static::getFacadeRoot(), $jobsToFake));
|
||||
|
||||
return $fake;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch the given chain of jobs.
|
||||
*
|
||||
* @param array|mixed $jobs
|
||||
* @return \Illuminate\Foundation\Bus\PendingDispatch
|
||||
*/
|
||||
public static function dispatchChain($jobs)
|
||||
{
|
||||
$jobs = is_array($jobs) ? $jobs : func_get_args();
|
||||
|
||||
return (new PendingChain(array_shift($jobs), $jobs))
|
||||
->dispatch();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return BusDispatcherContract::class;
|
||||
}
|
||||
}
|
39
vendor/illuminate/support/Facades/Cache.php
vendored
Executable file
39
vendor/illuminate/support/Facades/Cache.php
vendored
Executable file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @method static \Illuminate\Cache\TaggedCache tags(array|mixed $names)
|
||||
* @method static \Illuminate\Contracts\Cache\Lock lock(string $name, int $seconds = 0, mixed $owner = null)
|
||||
* @method static \Illuminate\Contracts\Cache\Lock restoreLock(string $name, string $owner)
|
||||
* @method static \Illuminate\Contracts\Cache\Repository store(string|null $name = null)
|
||||
* @method static \Illuminate\Contracts\Cache\Store getStore()
|
||||
* @method static bool add(string $key, $value, \DateTimeInterface|\DateInterval|int $ttl = null)
|
||||
* @method static bool forever(string $key, $value)
|
||||
* @method static bool forget(string $key)
|
||||
* @method static bool has(string $key)
|
||||
* @method static bool missing(string $key)
|
||||
* @method static bool put(string $key, $value, \DateTimeInterface|\DateInterval|int $ttl = null)
|
||||
* @method static int|bool decrement(string $key, $value = 1)
|
||||
* @method static int|bool increment(string $key, $value = 1)
|
||||
* @method static mixed get(string $key, mixed $default = null)
|
||||
* @method static mixed pull(string $key, mixed $default = null)
|
||||
* @method static mixed remember(string $key, \DateTimeInterface|\DateInterval|int $ttl, \Closure $callback)
|
||||
* @method static mixed rememberForever(string $key, \Closure $callback)
|
||||
* @method static mixed sear(string $key, \Closure $callback)
|
||||
*
|
||||
* @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';
|
||||
}
|
||||
}
|
26
vendor/illuminate/support/Facades/Config.php
vendored
Executable file
26
vendor/illuminate/support/Facades/Config.php
vendored
Executable file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @method static array all()
|
||||
* @method static bool has($key)
|
||||
* @method static mixed get($key, $default = null)
|
||||
* @method static void prepend($key, $value)
|
||||
* @method static void push($key, $value)
|
||||
* @method static void set($key, $value = null)
|
||||
*
|
||||
* @see \Illuminate\Config\Repository
|
||||
*/
|
||||
class Config extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'config';
|
||||
}
|
||||
}
|
46
vendor/illuminate/support/Facades/Cookie.php
vendored
Executable file
46
vendor/illuminate/support/Facades/Cookie.php
vendored
Executable file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @method static array getQueuedCookies()
|
||||
* @method static unqueue($name)
|
||||
* @method static void queue(...$parameters)
|
||||
*
|
||||
* @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|null $key
|
||||
* @param mixed $default
|
||||
* @return string|array|null
|
||||
*/
|
||||
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';
|
||||
}
|
||||
}
|
27
vendor/illuminate/support/Facades/Crypt.php
vendored
Executable file
27
vendor/illuminate/support/Facades/Crypt.php
vendored
Executable file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @method static bool supported(string $key, string $cipher)
|
||||
* @method static mixed decrypt(string $payload, bool $unserialize = true)
|
||||
* @method static string decryptString(string $payload)
|
||||
* @method static string encrypt(mixed $value, bool $serialize = true)
|
||||
* @method static string encryptString(string $value)
|
||||
* @method static string generateKey(string $cipher)
|
||||
* @method static string getKey()
|
||||
*
|
||||
* @see \Illuminate\Encryption\Encrypter
|
||||
*/
|
||||
class Crypt extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'encrypter';
|
||||
}
|
||||
}
|
47
vendor/illuminate/support/Facades/DB.php
vendored
Executable file
47
vendor/illuminate/support/Facades/DB.php
vendored
Executable file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @method static \Illuminate\Database\ConnectionInterface connection(string $name = null)
|
||||
* @method static \Illuminate\Database\Query\Builder table(string $table, string $as = null)
|
||||
* @method static \Illuminate\Database\Query\Expression raw($value)
|
||||
* @method static array getQueryLog()
|
||||
* @method static array prepareBindings(array $bindings)
|
||||
* @method static array pretend(\Closure $callback)
|
||||
* @method static array select(string $query, array $bindings = [], bool $useReadPdo = true)
|
||||
* @method static bool insert(string $query, array $bindings = [])
|
||||
* @method static bool logging()
|
||||
* @method static bool statement(string $query, array $bindings = [])
|
||||
* @method static bool unprepared(string $query)
|
||||
* @method static int affectingStatement(string $query, array $bindings = [])
|
||||
* @method static int delete(string $query, array $bindings = [])
|
||||
* @method static int transactionLevel()
|
||||
* @method static int update(string $query, array $bindings = [])
|
||||
* @method static mixed selectOne(string $query, array $bindings = [], bool $useReadPdo = true)
|
||||
* @method static mixed transaction(\Closure $callback, int $attempts = 1)
|
||||
* @method static string getDefaultConnection()
|
||||
* @method static void beginTransaction()
|
||||
* @method static void commit()
|
||||
* @method static void enableQueryLog()
|
||||
* @method static void disableQueryLog()
|
||||
* @method static void flushQueryLog()
|
||||
* @method static void listen(\Closure $callback)
|
||||
* @method static void rollBack(int $toLevel = null)
|
||||
* @method static void setDefaultConnection(string $name)
|
||||
*
|
||||
* @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';
|
||||
}
|
||||
}
|
120
vendor/illuminate/support/Facades/Date.php
vendored
Normal file
120
vendor/illuminate/support/Facades/Date.php
vendored
Normal file
@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
use Illuminate\Support\DateFactory;
|
||||
|
||||
/**
|
||||
* @see https://carbon.nesbot.com/docs/
|
||||
* @see https://github.com/briannesbitt/Carbon/blob/master/src/Carbon/Factory.php
|
||||
*
|
||||
* @method static \Illuminate\Support\Carbon create($year = 0, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0, $tz = null)
|
||||
* @method static \Illuminate\Support\Carbon createFromDate($year = null, $month = null, $day = null, $tz = null)
|
||||
* @method static \Illuminate\Support\Carbon createFromTime($hour = 0, $minute = 0, $second = 0, $tz = null)
|
||||
* @method static \Illuminate\Support\Carbon createFromTimeString($time, $tz = null)
|
||||
* @method static \Illuminate\Support\Carbon createFromTimestamp($timestamp, $tz = null)
|
||||
* @method static \Illuminate\Support\Carbon createFromTimestampMs($timestamp, $tz = null)
|
||||
* @method static \Illuminate\Support\Carbon createFromTimestampUTC($timestamp)
|
||||
* @method static \Illuminate\Support\Carbon createMidnightDate($year = null, $month = null, $day = null, $tz = null)
|
||||
* @method static \Illuminate\Support\Carbon disableHumanDiffOption($humanDiffOption)
|
||||
* @method static \Illuminate\Support\Carbon enableHumanDiffOption($humanDiffOption)
|
||||
* @method static \Illuminate\Support\Carbon fromSerialized($value)
|
||||
* @method static \Illuminate\Support\Carbon getLastErrors()
|
||||
* @method static \Illuminate\Support\Carbon getTestNow()
|
||||
* @method static \Illuminate\Support\Carbon instance($date)
|
||||
* @method static \Illuminate\Support\Carbon isMutable()
|
||||
* @method static \Illuminate\Support\Carbon maxValue()
|
||||
* @method static \Illuminate\Support\Carbon minValue()
|
||||
* @method static \Illuminate\Support\Carbon now($tz = null)
|
||||
* @method static \Illuminate\Support\Carbon parse($time = null, $tz = null)
|
||||
* @method static \Illuminate\Support\Carbon setHumanDiffOptions($humanDiffOptions)
|
||||
* @method static \Illuminate\Support\Carbon setTestNow($testNow = null)
|
||||
* @method static \Illuminate\Support\Carbon setUtf8($utf8)
|
||||
* @method static \Illuminate\Support\Carbon today($tz = null)
|
||||
* @method static \Illuminate\Support\Carbon tomorrow($tz = null)
|
||||
* @method static \Illuminate\Support\Carbon useStrictMode($strictModeEnabled = true)
|
||||
* @method static \Illuminate\Support\Carbon yesterday($tz = null)
|
||||
* @method static \Illuminate\Support\Carbon|false createFromFormat($format, $time, $tz = null)
|
||||
* @method static \Illuminate\Support\Carbon|false createSafe($year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, $tz = null)
|
||||
* @method static \Illuminate\Support\Carbon|null make($var)
|
||||
* @method static \Symfony\Component\Translation\TranslatorInterface getTranslator()
|
||||
* @method static array getAvailableLocales()
|
||||
* @method static array getDays()
|
||||
* @method static array getIsoUnits()
|
||||
* @method static array getWeekendDays()
|
||||
* @method static bool hasFormat($date, $format)
|
||||
* @method static bool hasMacro($name)
|
||||
* @method static bool hasRelativeKeywords($time)
|
||||
* @method static bool hasTestNow()
|
||||
* @method static bool isImmutable()
|
||||
* @method static bool isModifiableUnit($unit)
|
||||
* @method static bool isStrictModeEnabled()
|
||||
* @method static bool localeHasDiffOneDayWords($locale)
|
||||
* @method static bool localeHasDiffSyntax($locale)
|
||||
* @method static bool localeHasDiffTwoDayWords($locale)
|
||||
* @method static bool localeHasPeriodSyntax($locale)
|
||||
* @method static bool localeHasShortUnits($locale)
|
||||
* @method static bool setLocale($locale)
|
||||
* @method static bool shouldOverflowMonths()
|
||||
* @method static bool shouldOverflowYears()
|
||||
* @method static int getHumanDiffOptions()
|
||||
* @method static int getMidDayAt()
|
||||
* @method static int getWeekEndsAt()
|
||||
* @method static int getWeekStartsAt()
|
||||
* @method static mixed executeWithLocale($locale, $func)
|
||||
* @method static mixed use(mixed $handler)
|
||||
* @method static string getLocale()
|
||||
* @method static string pluralUnit(string $unit)
|
||||
* @method static string singularUnit(string $unit)
|
||||
* @method static void macro($name, $macro)
|
||||
* @method static void mixin($mixin)
|
||||
* @method static void resetMonthsOverflow()
|
||||
* @method static void resetToStringFormat()
|
||||
* @method static void resetYearsOverflow()
|
||||
* @method static void serializeUsing($callback)
|
||||
* @method static void setMidDayAt($hour)
|
||||
* @method static void setToStringFormat($format)
|
||||
* @method static void setTranslator(\Symfony\Component\Translation\TranslatorInterface $translator)
|
||||
* @method static void setWeekEndsAt($day)
|
||||
* @method static void setWeekStartsAt($day)
|
||||
* @method static void setWeekendDays($days)
|
||||
* @method static void useCallable(callable $callable)
|
||||
* @method static void useClass(string $class)
|
||||
* @method static void useDefault()
|
||||
* @method static void useFactory(object $factory)
|
||||
* @method static void useMonthsOverflow($monthsOverflow = true)
|
||||
* @method static void useYearsOverflow($yearsOverflow = true)
|
||||
*/
|
||||
class Date extends Facade
|
||||
{
|
||||
const DEFAULT_FACADE = DateFactory::class;
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'date';
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the facade root instance from the container.
|
||||
*
|
||||
* @param string $name
|
||||
* @return mixed
|
||||
*/
|
||||
protected static function resolveFacadeInstance($name)
|
||||
{
|
||||
if (! isset(static::$resolvedInstance[$name]) && ! isset(static::$app, static::$app[$name])) {
|
||||
$class = static::DEFAULT_FACADE;
|
||||
|
||||
static::swap(new $class);
|
||||
}
|
||||
|
||||
return parent::resolveFacadeInstance($name);
|
||||
}
|
||||
}
|
76
vendor/illuminate/support/Facades/Event.php
vendored
Executable file
76
vendor/illuminate/support/Facades/Event.php
vendored
Executable file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Testing\Fakes\EventFake;
|
||||
|
||||
/**
|
||||
* @method static \Closure createClassListener(string $listener, bool $wildcard = false)
|
||||
* @method static \Closure makeListener(\Closure|string $listener, bool $wildcard = false)
|
||||
* @method static \Illuminate\Events\Dispatcher setQueueResolver(callable $resolver)
|
||||
* @method static array getListeners(string $eventName)
|
||||
* @method static array|null dispatch(string|object $event, mixed $payload = [], bool $halt = false)
|
||||
* @method static array|null until(string|object $event, mixed $payload = [])
|
||||
* @method static bool hasListeners(string $eventName)
|
||||
* @method static void assertDispatched(string $event, callable|int $callback = null)
|
||||
* @method static void assertDispatchedTimes(string $event, int $times = 1)
|
||||
* @method static void assertNotDispatched(string $event, callable|int $callback = null)
|
||||
* @method static void flush(string $event)
|
||||
* @method static void forget(string $event)
|
||||
* @method static void forgetPushed()
|
||||
* @method static void listen(string|array $events, \Closure|string $listener)
|
||||
* @method static void push(string $event, array $payload = [])
|
||||
* @method static void subscribe(object|string $subscriber)
|
||||
*
|
||||
* @see \Illuminate\Events\Dispatcher
|
||||
*/
|
||||
class Event extends Facade
|
||||
{
|
||||
/**
|
||||
* Replace the bound instance with a fake.
|
||||
*
|
||||
* @param array|string $eventsToFake
|
||||
* @return \Illuminate\Support\Testing\Fakes\EventFake
|
||||
*/
|
||||
public static function fake($eventsToFake = [])
|
||||
{
|
||||
static::swap($fake = new EventFake(static::getFacadeRoot(), $eventsToFake));
|
||||
|
||||
Model::setEventDispatcher($fake);
|
||||
Cache::refreshEventDispatcher();
|
||||
|
||||
return $fake;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the bound instance with a fake during the given callable's execution.
|
||||
*
|
||||
* @param callable $callable
|
||||
* @param array $eventsToFake
|
||||
* @return callable
|
||||
*/
|
||||
public static function fakeFor(callable $callable, array $eventsToFake = [])
|
||||
{
|
||||
$originalDispatcher = static::getFacadeRoot();
|
||||
|
||||
static::fake($eventsToFake);
|
||||
|
||||
return tap($callable(), function () use ($originalDispatcher) {
|
||||
static::swap($originalDispatcher);
|
||||
|
||||
Model::setEventDispatcher($originalDispatcher);
|
||||
Cache::refreshEventDispatcher();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'events';
|
||||
}
|
||||
}
|
263
vendor/illuminate/support/Facades/Facade.php
vendored
Executable file
263
vendor/illuminate/support/Facades/Facade.php
vendored
Executable file
@ -0,0 +1,263 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
use Closure;
|
||||
use Mockery;
|
||||
use Mockery\MockInterface;
|
||||
use RuntimeException;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Run a Closure when the facade has been resolved.
|
||||
*
|
||||
* @param \Closure $callback
|
||||
* @return void
|
||||
*/
|
||||
public static function resolved(Closure $callback)
|
||||
{
|
||||
$accessor = static::getFacadeAccessor();
|
||||
|
||||
if (static::$app->resolved($accessor) === true) {
|
||||
$callback(static::getFacadeRoot());
|
||||
}
|
||||
|
||||
static::$app->afterResolving($accessor, function ($service) use ($callback) {
|
||||
$callback($service);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the facade into a Mockery spy.
|
||||
*
|
||||
* @return \Mockery\MockInterface
|
||||
*/
|
||||
public static function spy()
|
||||
{
|
||||
if (! static::isMock()) {
|
||||
$class = static::getMockableClass();
|
||||
|
||||
return tap($class ? Mockery::spy($class) : Mockery::spy(), function ($spy) {
|
||||
static::swap($spy);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiate a partial mock on the facade.
|
||||
*
|
||||
* @return \Mockery\MockInterface
|
||||
*/
|
||||
public static function partialMock()
|
||||
{
|
||||
$name = static::getFacadeAccessor();
|
||||
|
||||
$mock = static::isMock()
|
||||
? static::$resolvedInstance[$name]
|
||||
: static::createFreshMockInstance();
|
||||
|
||||
return $mock->makePartial();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiate a mock expectation on the facade.
|
||||
*
|
||||
* @return \Mockery\Expectation
|
||||
*/
|
||||
public static function shouldReceive()
|
||||
{
|
||||
$name = static::getFacadeAccessor();
|
||||
|
||||
$mock = static::isMock()
|
||||
? static::$resolvedInstance[$name]
|
||||
: static::createFreshMockInstance();
|
||||
|
||||
return $mock->shouldReceive(...func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a fresh mock instance for the given class.
|
||||
*
|
||||
* @return \Mockery\MockInterface
|
||||
*/
|
||||
protected static function createFreshMockInstance()
|
||||
{
|
||||
return tap(static::createMock(), function ($mock) {
|
||||
static::swap($mock);
|
||||
|
||||
$mock->shouldAllowMockingProtectedMethods();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a fresh mock instance for the given class.
|
||||
*
|
||||
* @return \Mockery\MockInterface
|
||||
*/
|
||||
protected static function createMock()
|
||||
{
|
||||
$class = static::getMockableClass();
|
||||
|
||||
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|null
|
||||
*/
|
||||
protected static function getMockableClass()
|
||||
{
|
||||
if ($root = static::getFacadeRoot()) {
|
||||
return get_class($root);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hotswap the underlying instance behind the facade.
|
||||
*
|
||||
* @param mixed $instance
|
||||
* @return void
|
||||
*/
|
||||
public static function swap($instance)
|
||||
{
|
||||
static::$resolvedInstance[static::getFacadeAccessor()] = $instance;
|
||||
|
||||
if (isset(static::$app)) {
|
||||
static::$app->instance(static::getFacadeAccessor(), $instance);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 object|string $name
|
||||
* @return mixed
|
||||
*/
|
||||
protected static function resolveFacadeInstance($name)
|
||||
{
|
||||
if (is_object($name)) {
|
||||
return $name;
|
||||
}
|
||||
|
||||
if (isset(static::$resolvedInstance[$name])) {
|
||||
return static::$resolvedInstance[$name];
|
||||
}
|
||||
|
||||
if (static::$app) {
|
||||
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 = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public static function __callStatic($method, $args)
|
||||
{
|
||||
$instance = static::getFacadeRoot();
|
||||
|
||||
if (! $instance) {
|
||||
throw new RuntimeException('A facade root has not been set.');
|
||||
}
|
||||
|
||||
return $instance->$method(...$args);
|
||||
}
|
||||
}
|
58
vendor/illuminate/support/Facades/File.php
vendored
Executable file
58
vendor/illuminate/support/Facades/File.php
vendored
Executable file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @method static \Symfony\Component\Finder\SplFileInfo[] allFiles(string $directory, bool $hidden = false)
|
||||
* @method static \Symfony\Component\Finder\SplFileInfo[] files(string $directory, bool $hidden = false)
|
||||
* @method static array directories(string $directory)
|
||||
* @method static array glob(string $pattern, int $flags = 0)
|
||||
* @method static bool cleanDirectory(string $directory)
|
||||
* @method static bool copy(string $path, string $target)
|
||||
* @method static bool copyDirectory(string $directory, string $destination, int|null $options = null)
|
||||
* @method static bool delete(string|array $paths)
|
||||
* @method static bool deleteDirectories(string $directory)
|
||||
* @method static bool deleteDirectory(string $directory, bool $preserve = false)
|
||||
* @method static bool exists(string $path)
|
||||
* @method static bool isDirectory(string $directory)
|
||||
* @method static bool isFile(string $file)
|
||||
* @method static bool isReadable(string $path)
|
||||
* @method static bool isWritable(string $path)
|
||||
* @method static bool makeDirectory(string $path, int $mode = 0755, bool $recursive = false, bool $force = false)
|
||||
* @method static bool move(string $path, string $target)
|
||||
* @method static bool moveDirectory(string $from, string $to, bool $overwrite = false)
|
||||
* @method static int append(string $path, string $data)
|
||||
* @method static int lastModified(string $path)
|
||||
* @method static int prepend(string $path, string $data)
|
||||
* @method static int size(string $path)
|
||||
* @method static int|bool put(string $path, string $contents, bool $lock = false)
|
||||
* @method static mixed chmod(string $path, int|null $mode = null)
|
||||
* @method static mixed getRequire(string $path)
|
||||
* @method static mixed requireOnce(string $file)
|
||||
* @method static string basename(string $path)
|
||||
* @method static string dirname(string $path)
|
||||
* @method static string extension(string $path)
|
||||
* @method static string get(string $path, bool $lock = false)
|
||||
* @method static string hash(string $path)
|
||||
* @method static string name(string $path)
|
||||
* @method static string sharedGet(string $path)
|
||||
* @method static string type(string $path)
|
||||
* @method static string|false mimeType(string $path)
|
||||
* @method static void ensureDirectoryExists(string $path, int $mode = 0755, bool $recursive = true)
|
||||
* @method static void link(string $target, string $link)
|
||||
* @method static void replace(string $path, string $content)
|
||||
*
|
||||
* @see \Illuminate\Filesystem\Filesystem
|
||||
*/
|
||||
class File extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'files';
|
||||
}
|
||||
}
|
38
vendor/illuminate/support/Facades/Gate.php
vendored
Normal file
38
vendor/illuminate/support/Facades/Gate.php
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
use Illuminate\Contracts\Auth\Access\Gate as GateContract;
|
||||
|
||||
/**
|
||||
* @method static \Illuminate\Auth\Access\Gate guessPolicyNamesUsing(callable $callback)
|
||||
* @method static \Illuminate\Auth\Access\Response authorize(string $ability, array|mixed $arguments = [])
|
||||
* @method static \Illuminate\Auth\Access\Response inspect(string $ability, array|mixed $arguments = [])
|
||||
* @method static \Illuminate\Contracts\Auth\Access\Gate after(callable $callback)
|
||||
* @method static \Illuminate\Contracts\Auth\Access\Gate before(callable $callback)
|
||||
* @method static \Illuminate\Contracts\Auth\Access\Gate define(string $ability, callable|string $callback)
|
||||
* @method static \Illuminate\Contracts\Auth\Access\Gate forUser(\Illuminate\Contracts\Auth\Authenticatable|mixed $user)
|
||||
* @method static \Illuminate\Contracts\Auth\Access\Gate policy(string $class, string $policy)
|
||||
* @method static array abilities()
|
||||
* @method static bool allows(string $ability, array|mixed $arguments = [])
|
||||
* @method static bool any(iterable|string $abilities, array|mixed $arguments = [])
|
||||
* @method static bool check(iterable|string $abilities, array|mixed $arguments = [])
|
||||
* @method static bool denies(string $ability, array|mixed $arguments = [])
|
||||
* @method static bool has(string $ability)
|
||||
* @method static mixed getPolicyFor(object|string $class)
|
||||
* @method static mixed raw(string $ability, array|mixed $arguments = [])
|
||||
*
|
||||
* @see \Illuminate\Contracts\Auth\Access\Gate
|
||||
*/
|
||||
class Gate extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return GateContract::class;
|
||||
}
|
||||
}
|
24
vendor/illuminate/support/Facades/Hash.php
vendored
Executable file
24
vendor/illuminate/support/Facades/Hash.php
vendored
Executable file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @method static array info(string $hashedValue)
|
||||
* @method static bool check(string $value, string $hashedValue, array $options = [])
|
||||
* @method static bool needsRehash(string $hashedValue, array $options = [])
|
||||
* @method static string make(string $value, array $options = [])
|
||||
*
|
||||
* @see \Illuminate\Hashing\HashManager
|
||||
*/
|
||||
class Hash extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'hash';
|
||||
}
|
||||
}
|
54
vendor/illuminate/support/Facades/Http.php
vendored
Normal file
54
vendor/illuminate/support/Facades/Http.php
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
use Illuminate\Http\Client\Factory;
|
||||
|
||||
/**
|
||||
* @method static \GuzzleHttp\Promise\PromiseInterface response($body = null, $status = 200, $headers = [])
|
||||
* @method static \Illuminate\Http\Client\Factory fake($callback = null)
|
||||
* @method static \Illuminate\Http\Client\PendingRequest accept(string $contentType)
|
||||
* @method static \Illuminate\Http\Client\PendingRequest acceptJson()
|
||||
* @method static \Illuminate\Http\Client\PendingRequest asForm()
|
||||
* @method static \Illuminate\Http\Client\PendingRequest asJson()
|
||||
* @method static \Illuminate\Http\Client\PendingRequest asMultipart()
|
||||
* @method static \Illuminate\Http\Client\PendingRequest attach(string $name, string $contents, string|null $filename = null, array $headers = [])
|
||||
* @method static \Illuminate\Http\Client\PendingRequest baseUrl(string $url)
|
||||
* @method static \Illuminate\Http\Client\PendingRequest beforeSending(callable $callback)
|
||||
* @method static \Illuminate\Http\Client\PendingRequest bodyFormat(string $format)
|
||||
* @method static \Illuminate\Http\Client\PendingRequest contentType(string $contentType)
|
||||
* @method static \Illuminate\Http\Client\PendingRequest retry(int $times, int $sleep = 0)
|
||||
* @method static \Illuminate\Http\Client\PendingRequest stub(callable $callback)
|
||||
* @method static \Illuminate\Http\Client\PendingRequest timeout(int $seconds)
|
||||
* @method static \Illuminate\Http\Client\PendingRequest withBasicAuth(string $username, string $password)
|
||||
* @method static \Illuminate\Http\Client\PendingRequest withBody(resource|string $content, string $contentType)
|
||||
* @method static \Illuminate\Http\Client\PendingRequest withCookies(array $cookies, string $domain)
|
||||
* @method static \Illuminate\Http\Client\PendingRequest withDigestAuth(string $username, string $password)
|
||||
* @method static \Illuminate\Http\Client\PendingRequest withHeaders(array $headers)
|
||||
* @method static \Illuminate\Http\Client\PendingRequest withOptions(array $options)
|
||||
* @method static \Illuminate\Http\Client\PendingRequest withToken(string $token, string $type = 'Bearer')
|
||||
* @method static \Illuminate\Http\Client\PendingRequest withoutRedirecting()
|
||||
* @method static \Illuminate\Http\Client\PendingRequest withoutVerifying()
|
||||
* @method static \Illuminate\Http\Client\Response delete(string $url, array $data = [])
|
||||
* @method static \Illuminate\Http\Client\Response get(string $url, array $query = [])
|
||||
* @method static \Illuminate\Http\Client\Response head(string $url, array $query = [])
|
||||
* @method static \Illuminate\Http\Client\Response patch(string $url, array $data = [])
|
||||
* @method static \Illuminate\Http\Client\Response post(string $url, array $data = [])
|
||||
* @method static \Illuminate\Http\Client\Response put(string $url, array $data = [])
|
||||
* @method static \Illuminate\Http\Client\Response send(string $method, string $url, array $options = [])
|
||||
* @method static \Illuminate\Http\Client\ResponseSequence fakeSequence(string $urlPattern = '*')
|
||||
*
|
||||
* @see \Illuminate\Http\Client\Factory
|
||||
*/
|
||||
class Http extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return Factory::class;
|
||||
}
|
||||
}
|
25
vendor/illuminate/support/Facades/Lang.php
vendored
Executable file
25
vendor/illuminate/support/Facades/Lang.php
vendored
Executable file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @method static bool has(string $key)
|
||||
* @method static mixed get(string $key, array $replace = [], string $locale = null, bool $fallback = true)
|
||||
* @method static string choice(string $key, \Countable|int|array $number, array $replace = [], string $locale = null)
|
||||
* @method static string getLocale()
|
||||
* @method static void setLocale(string $locale)
|
||||
*
|
||||
* @see \Illuminate\Translation\Translator
|
||||
*/
|
||||
class Lang extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'translator';
|
||||
}
|
||||
}
|
31
vendor/illuminate/support/Facades/Log.php
vendored
Executable file
31
vendor/illuminate/support/Facades/Log.php
vendored
Executable file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @method static \Psr\Log\LoggerInterface channel(string $channel = null)
|
||||
* @method static \Psr\Log\LoggerInterface stack(array $channels, string $channel = null)
|
||||
* @method static void alert(string $message, array $context = [])
|
||||
* @method static void critical(string $message, array $context = [])
|
||||
* @method static void debug(string $message, array $context = [])
|
||||
* @method static void emergency(string $message, array $context = [])
|
||||
* @method static void error(string $message, array $context = [])
|
||||
* @method static void info(string $message, array $context = [])
|
||||
* @method static void log($level, string $message, array $context = [])
|
||||
* @method static void notice(string $message, array $context = [])
|
||||
* @method static void warning(string $message, array $context = [])
|
||||
*
|
||||
* @see \Illuminate\Log\Logger
|
||||
*/
|
||||
class Log extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'log';
|
||||
}
|
||||
}
|
52
vendor/illuminate/support/Facades/Mail.php
vendored
Executable file
52
vendor/illuminate/support/Facades/Mail.php
vendored
Executable file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
use Illuminate\Support\Testing\Fakes\MailFake;
|
||||
|
||||
/**
|
||||
* @method static \Illuminate\Mail\PendingMail bcc($users)
|
||||
* @method static \Illuminate\Mail\PendingMail to($users)
|
||||
* @method static \Illuminate\Support\Collection queued(string $mailable, \Closure|string $callback = null)
|
||||
* @method static \Illuminate\Support\Collection sent(string $mailable, \Closure|string $callback = null)
|
||||
* @method static array failures()
|
||||
* @method static bool hasQueued(string $mailable)
|
||||
* @method static bool hasSent(string $mailable)
|
||||
* @method static mixed later(\DateTimeInterface|\DateInterval|int $delay, \Illuminate\Contracts\Mail\Mailable|string|array $view, string $queue = null)
|
||||
* @method static mixed queue(\Illuminate\Contracts\Mail\Mailable|string|array $view, string $queue = null)
|
||||
* @method static void assertNotQueued(string $mailable, callable $callback = null)
|
||||
* @method static void assertNotSent(string $mailable, callable|int $callback = null)
|
||||
* @method static void assertNothingQueued()
|
||||
* @method static void assertNothingSent()
|
||||
* @method static void assertQueued(string $mailable, callable|int $callback = null)
|
||||
* @method static void assertSent(string $mailable, callable|int $callback = null)
|
||||
* @method static void raw(string $text, $callback)
|
||||
* @method static void send(\Illuminate\Contracts\Mail\Mailable|string|array $view, array $data = [], \Closure|string $callback = null)
|
||||
*
|
||||
* @see \Illuminate\Mail\Mailer
|
||||
* @see \Illuminate\Support\Testing\Fakes\MailFake
|
||||
*/
|
||||
class Mail extends Facade
|
||||
{
|
||||
/**
|
||||
* Replace the bound instance with a fake.
|
||||
*
|
||||
* @return \Illuminate\Support\Testing\Fakes\MailFake
|
||||
*/
|
||||
public static function fake()
|
||||
{
|
||||
static::swap($fake = new MailFake);
|
||||
|
||||
return $fake;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'mail.manager';
|
||||
}
|
||||
}
|
59
vendor/illuminate/support/Facades/Notification.php
vendored
Normal file
59
vendor/illuminate/support/Facades/Notification.php
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
use Illuminate\Notifications\AnonymousNotifiable;
|
||||
use Illuminate\Notifications\ChannelManager;
|
||||
use Illuminate\Support\Testing\Fakes\NotificationFake;
|
||||
|
||||
/**
|
||||
* @method static \Illuminate\Notifications\ChannelManager locale(string|null $locale)
|
||||
* @method static \Illuminate\Support\Collection sent(mixed $notifiable, string $notification, callable $callback = null)
|
||||
* @method static bool hasSent(mixed $notifiable, string $notification)
|
||||
* @method static mixed channel(string|null $name = null)
|
||||
* @method static void assertNotSentTo(mixed $notifiable, string $notification, callable $callback = null)
|
||||
* @method static void assertNothingSent()
|
||||
* @method static void assertSentTo(mixed $notifiable, string $notification, callable $callback = null)
|
||||
* @method static void assertSentToTimes(mixed $notifiable, string $notification, int $times = 1)
|
||||
* @method static void assertTimesSent(int $expectedCount, string $notification)
|
||||
* @method static void send(\Illuminate\Support\Collection|array|mixed $notifiables, $notification)
|
||||
* @method static void sendNow(\Illuminate\Support\Collection|array|mixed $notifiables, $notification)
|
||||
*
|
||||
* @see \Illuminate\Notifications\ChannelManager
|
||||
*/
|
||||
class Notification extends Facade
|
||||
{
|
||||
/**
|
||||
* Replace the bound instance with a fake.
|
||||
*
|
||||
* @return \Illuminate\Support\Testing\Fakes\NotificationFake
|
||||
*/
|
||||
public static function fake()
|
||||
{
|
||||
static::swap($fake = new NotificationFake);
|
||||
|
||||
return $fake;
|
||||
}
|
||||
|
||||
/**
|
||||
* Begin sending a notification to an anonymous notifiable.
|
||||
*
|
||||
* @param string $channel
|
||||
* @param mixed $route
|
||||
* @return \Illuminate\Notifications\AnonymousNotifiable
|
||||
*/
|
||||
public static function route($channel, $route)
|
||||
{
|
||||
return (new AnonymousNotifiable)->route($channel, $route);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return ChannelManager::class;
|
||||
}
|
||||
}
|
64
vendor/illuminate/support/Facades/Password.php
vendored
Executable file
64
vendor/illuminate/support/Facades/Password.php
vendored
Executable file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
use Illuminate\Contracts\Auth\PasswordBroker;
|
||||
|
||||
/**
|
||||
* @method static mixed reset(array $credentials, \Closure $callback)
|
||||
* @method static string sendResetLink(array $credentials)
|
||||
* @method static \Illuminate\Contracts\Auth\CanResetPassword getUser(array $credentials)
|
||||
* @method static string createToken(\Illuminate\Contracts\Auth\CanResetPassword $user)
|
||||
* @method static void deleteToken(\Illuminate\Contracts\Auth\CanResetPassword $user)
|
||||
* @method static bool tokenExists(\Illuminate\Contracts\Auth\CanResetPassword $user, string $token)
|
||||
* @method static \Illuminate\Auth\Passwords\TokenRepositoryInterface getRepository()
|
||||
*
|
||||
* @see \Illuminate\Auth\Passwords\PasswordBroker
|
||||
*/
|
||||
class Password extends Facade
|
||||
{
|
||||
/**
|
||||
* Constant representing a successfully sent reminder.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const RESET_LINK_SENT = PasswordBroker::RESET_LINK_SENT;
|
||||
|
||||
/**
|
||||
* Constant representing a successfully reset password.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const PASSWORD_RESET = PasswordBroker::PASSWORD_RESET;
|
||||
|
||||
/**
|
||||
* Constant representing the user not found response.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const INVALID_USER = PasswordBroker::INVALID_USER;
|
||||
|
||||
/**
|
||||
* Constant representing an invalid token.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const INVALID_TOKEN = PasswordBroker::INVALID_TOKEN;
|
||||
|
||||
/**
|
||||
* Constant representing a throttled reset attempt.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const RESET_THROTTLED = PasswordBroker::RESET_THROTTLED;
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'auth.password';
|
||||
}
|
||||
}
|
50
vendor/illuminate/support/Facades/Queue.php
vendored
Executable file
50
vendor/illuminate/support/Facades/Queue.php
vendored
Executable file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
use Illuminate\Support\Testing\Fakes\QueueFake;
|
||||
|
||||
/**
|
||||
* @method static \Illuminate\Contracts\Queue\Job|null pop(string $queue = null)
|
||||
* @method static \Illuminate\Contracts\Queue\Queue setConnectionName(string $name)
|
||||
* @method static int size(string $queue = null)
|
||||
* @method static mixed bulk(array $jobs, mixed $data = '', string $queue = null)
|
||||
* @method static mixed later(\DateTimeInterface|\DateInterval|int $delay, string|object $job, mixed $data = '', string $queue = null)
|
||||
* @method static mixed laterOn(string $queue, \DateTimeInterface|\DateInterval|int $delay, string|object $job, mixed $data = '')
|
||||
* @method static mixed push(string|object $job, mixed $data = '', $queue = null)
|
||||
* @method static mixed pushOn(string $queue, string|object $job, mixed $data = '')
|
||||
* @method static mixed pushRaw(string $payload, string $queue = null, array $options = [])
|
||||
* @method static string getConnectionName()
|
||||
* @method static void assertNotPushed(string $job, callable $callback = null)
|
||||
* @method static void assertNothingPushed()
|
||||
* @method static void assertPushed(string $job, callable|int $callback = null)
|
||||
* @method static void assertPushedOn(string $queue, string $job, callable|int $callback = null)
|
||||
* @method static void assertPushedWithChain(string $job, array $expectedChain = [], callable $callback = null)
|
||||
*
|
||||
* @see \Illuminate\Queue\QueueManager
|
||||
* @see \Illuminate\Queue\Queue
|
||||
*/
|
||||
class Queue extends Facade
|
||||
{
|
||||
/**
|
||||
* Replace the bound instance with a fake.
|
||||
*
|
||||
* @return \Illuminate\Support\Testing\Fakes\QueueFake
|
||||
*/
|
||||
public static function fake()
|
||||
{
|
||||
static::swap($fake = new QueueFake(static::getFacadeApplication()));
|
||||
|
||||
return $fake;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'queue';
|
||||
}
|
||||
}
|
34
vendor/illuminate/support/Facades/Redirect.php
vendored
Executable file
34
vendor/illuminate/support/Facades/Redirect.php
vendored
Executable file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @method static \Illuminate\Http\RedirectResponse action(string $action, array $parameters = [], int $status = 302, array $headers = [])
|
||||
* @method static \Illuminate\Http\RedirectResponse away(string $path, int $status = 302, array $headers = [])
|
||||
* @method static \Illuminate\Http\RedirectResponse back(int $status = 302, array $headers = [], $fallback = false)
|
||||
* @method static \Illuminate\Http\RedirectResponse guest(string $path, int $status = 302, array $headers = [], bool $secure = null)
|
||||
* @method static \Illuminate\Http\RedirectResponse home(int $status = 302)
|
||||
* @method static \Illuminate\Http\RedirectResponse intended(string $default = '/', int $status = 302, array $headers = [], bool $secure = null)
|
||||
* @method static \Illuminate\Http\RedirectResponse refresh(int $status = 302, array $headers = [])
|
||||
* @method static \Illuminate\Http\RedirectResponse route(string $route, array $parameters = [], int $status = 302, array $headers = [])
|
||||
* @method static \Illuminate\Http\RedirectResponse secure(string $path, int $status = 302, array $headers = [])
|
||||
* @method static \Illuminate\Http\RedirectResponse signedRoute(string $name, array $parameters = [], \DateTimeInterface|\DateInterval|int $expiration = null, int $status = 302, array $headers = [])
|
||||
* @method static \Illuminate\Http\RedirectResponse temporarySignedRoute(string $name, \DateTimeInterface|\DateInterval|int $expiration, array $parameters = [], int $status = 302, array $headers = [])
|
||||
* @method static \Illuminate\Http\RedirectResponse to(string $path, int $status = 302, array $headers = [], bool $secure = null)
|
||||
* @method static \Illuminate\Routing\UrlGenerator getUrlGenerator()
|
||||
* @method static void setSession(\Illuminate\Session\Store $session)
|
||||
*
|
||||
* @see \Illuminate\Routing\Redirector
|
||||
*/
|
||||
class Redirect extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'redirect';
|
||||
}
|
||||
}
|
24
vendor/illuminate/support/Facades/Redis.php
vendored
Executable file
24
vendor/illuminate/support/Facades/Redis.php
vendored
Executable file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @method static \Illuminate\Redis\Connections\Connection connection(string $name = null)
|
||||
* @method static \Illuminate\Redis\Limiters\ConcurrencyLimiterBuilder funnel(string $name)
|
||||
* @method static \Illuminate\Redis\Limiters\DurationLimiterBuilder throttle(string $name)
|
||||
*
|
||||
* @see \Illuminate\Redis\RedisManager
|
||||
* @see \Illuminate\Contracts\Redis\Factory
|
||||
*/
|
||||
class Redis extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'redis';
|
||||
}
|
||||
}
|
103
vendor/illuminate/support/Facades/Request.php
vendored
Executable file
103
vendor/illuminate/support/Facades/Request.php
vendored
Executable file
@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @method static \Closure getRouteResolver()
|
||||
* @method static \Closure getUserResolver()
|
||||
* @method static \Illuminate\Http\Request capture()
|
||||
* @method static \Illuminate\Http\Request createFrom(\Illuminate\Http\Request $from, \Illuminate\Http\Request|null $to = null)
|
||||
* @method static \Illuminate\Http\Request createFromBase(\Symfony\Component\HttpFoundation\Request $request)
|
||||
* @method static \Illuminate\Http\Request duplicate(array|null $query = null, array|null $request = null, array|null $attributes = null, array|null $cookies = null, array|null $files = null, array|null $server = null)
|
||||
* @method static \Illuminate\Http\Request instance()
|
||||
* @method static \Illuminate\Http\Request merge(array $input)
|
||||
* @method static \Illuminate\Http\Request replace(array $input)
|
||||
* @method static \Illuminate\Http\Request setJson(\Symfony\Component\HttpFoundation\ParameterBag $json)
|
||||
* @method static \Illuminate\Http\Request setRouteResolver(\Closure $callback)
|
||||
* @method static \Illuminate\Http\Request setUserResolver(\Closure $callback)
|
||||
* @method static \Illuminate\Http\UploadedFile|\Illuminate\Http\UploadedFile[]|array|null file(string|null $key = null, mixed $default = null)
|
||||
* @method static \Illuminate\Routing\Route|object|string route(string|null $param = null, string|null $default = null)
|
||||
* @method static \Illuminate\Session\Store session()
|
||||
* @method static \Illuminate\Session\Store|null getSession()
|
||||
* @method static \Symfony\Component\HttpFoundation\ParameterBag|mixed json(string|null $key = null, mixed $default = null)
|
||||
* @method static array all(array|mixed|null $keys = null)
|
||||
* @method static array allFiles()
|
||||
* @method static array except(array|mixed $keys)
|
||||
* @method static array ips()
|
||||
* @method static array keys()
|
||||
* @method static array only(array|mixed $keys)
|
||||
* @method static array segments()
|
||||
* @method static array toArray()
|
||||
* @method static array validate(array $rules, ...$params)
|
||||
* @method static array validateWithBag(string $errorBag, array $rules, ...$params)
|
||||
* @method static bool accepts(string|array $contentTypes)
|
||||
* @method static bool acceptsAnyContentType()
|
||||
* @method static bool acceptsHtml()
|
||||
* @method static bool acceptsJson()
|
||||
* @method static bool ajax()
|
||||
* @method static bool anyFilled(string|array $key)
|
||||
* @method static bool exists(string|array $key)
|
||||
* @method static bool expectsJson()
|
||||
* @method static bool filled(string|array $key)
|
||||
* @method static bool fullUrlIs(mixed ...$patterns)
|
||||
* @method static bool has(string|array $key)
|
||||
* @method static bool hasAny(string|array $key)
|
||||
* @method static bool hasCookie(string $key)
|
||||
* @method static bool hasFile(string $key)
|
||||
* @method static bool hasHeader(string $key)
|
||||
* @method static bool hasValidSignature(bool $absolute = true)
|
||||
* @method static bool is(mixed ...$patterns)
|
||||
* @method static bool isJson()
|
||||
* @method static bool matchesType(string $actual, string $type)
|
||||
* @method static bool offsetExists(string $offset)
|
||||
* @method static bool pjax()
|
||||
* @method static bool prefers(string|array $contentTypes)
|
||||
* @method static bool prefetch()
|
||||
* @method static bool routeIs(mixed ...$patterns)
|
||||
* @method static bool secure()
|
||||
* @method static bool wantsJson()
|
||||
* @method static mixed filterFiles(mixed $files)
|
||||
* @method static mixed offsetGet(string $offset)
|
||||
* @method static mixed user(string|null $guard = null)
|
||||
* @method static string decodedPath()
|
||||
* @method static string fingerprint()
|
||||
* @method static string format($default = 'html')
|
||||
* @method static string fullUrl()
|
||||
* @method static string fullUrlWithQuery(array $query)
|
||||
* @method static string method()
|
||||
* @method static string path()
|
||||
* @method static string root()
|
||||
* @method static string url()
|
||||
* @method static string userAgent()
|
||||
* @method static string|array old(string|null $key = null, string|array|null $default = null)
|
||||
* @method static string|array|null cookie(string|null $key = null, string|array|null $default = null)
|
||||
* @method static string|array|null header(string|null $key = null, string|array|null $default = null)
|
||||
* @method static string|array|null input(string|null $key = null, string|array|null $default = null)
|
||||
* @method static string|array|null post(string|null $key = null, string|array|null $default = null)
|
||||
* @method static string|array|null query(string|null $key = null, string|array|null $default = null)
|
||||
* @method static string|array|null server(string|null $key = null, string|array|null $default = null)
|
||||
* @method static string|null bearerToken()
|
||||
* @method static string|null ip()
|
||||
* @method static string|null segment(int $index, string|null $default = null)
|
||||
* @method static void flash()
|
||||
* @method static void flashExcept(array|mixed $keys)
|
||||
* @method static void flashOnly(array|mixed $keys)
|
||||
* @method static void flush()
|
||||
* @method static void offsetSet(string $offset, mixed $value)
|
||||
* @method static void offsetUnset(string $offset)
|
||||
* @method static void setLaravelSession(\Illuminate\Contracts\Session\Session $session)
|
||||
*
|
||||
* @see \Illuminate\Http\Request
|
||||
*/
|
||||
class Request extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'request';
|
||||
}
|
||||
}
|
36
vendor/illuminate/support/Facades/Response.php
vendored
Executable file
36
vendor/illuminate/support/Facades/Response.php
vendored
Executable file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
use Illuminate\Contracts\Routing\ResponseFactory as ResponseFactoryContract;
|
||||
|
||||
/**
|
||||
* @method static \Illuminate\Http\JsonResponse json(string|array $data = [], int $status = 200, array $headers = [], int $options = 0)
|
||||
* @method static \Illuminate\Http\JsonResponse jsonp(string $callback, string|array $data = [], int $status = 200, array $headers = [], int $options = 0)
|
||||
* @method static \Illuminate\Http\RedirectResponse redirectGuest(string $path, int $status = 302, array $headers = [], bool|null $secure = null)
|
||||
* @method static \Illuminate\Http\RedirectResponse redirectTo(string $path, int $status = 302, array $headers = [], bool|null $secure = null)
|
||||
* @method static \Illuminate\Http\RedirectResponse redirectToAction(string $action, mixed $parameters = [], int $status = 302, array $headers = [])
|
||||
* @method static \Illuminate\Http\RedirectResponse redirectToIntended(string $default = '/', int $status = 302, array $headers = [], bool|null $secure = null)
|
||||
* @method static \Illuminate\Http\RedirectResponse redirectToRoute(string $route, mixed $parameters = [], int $status = 302, array $headers = [])
|
||||
* @method static \Illuminate\Http\Response make(string $content = '', int $status = 200, array $headers = [])
|
||||
* @method static \Illuminate\Http\Response noContent($status = 204, array $headers = [])
|
||||
* @method static \Illuminate\Http\Response view(string $view, array $data = [], int $status = 200, array $headers = [])
|
||||
* @method static \Symfony\Component\HttpFoundation\BinaryFileResponse download(\SplFileInfo|string $file, string|null $name = null, array $headers = [], string|null $disposition = 'attachment')
|
||||
* @method static \Symfony\Component\HttpFoundation\BinaryFileResponse file($file, array $headers = [])
|
||||
* @method static \Symfony\Component\HttpFoundation\StreamedResponse stream(\Closure $callback, int $status = 200, array $headers = [])
|
||||
* @method static \Symfony\Component\HttpFoundation\StreamedResponse streamDownload(\Closure $callback, string|null $name = null, array $headers = [], string|null $disposition = 'attachment')
|
||||
*
|
||||
* @see \Illuminate\Contracts\Routing\ResponseFactory
|
||||
*/
|
||||
class Response extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return ResponseFactoryContract::class;
|
||||
}
|
||||
}
|
53
vendor/illuminate/support/Facades/Route.php
vendored
Executable file
53
vendor/illuminate/support/Facades/Route.php
vendored
Executable file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @method static \Illuminate\Routing\PendingResourceRegistration apiResource(string $name, string $controller, array $options = [])
|
||||
* @method static \Illuminate\Routing\PendingResourceRegistration resource(string $name, string $controller, array $options = [])
|
||||
* @method static \Illuminate\Routing\Route any(string $uri, array|string|callable|null $action = null)
|
||||
* @method static \Illuminate\Routing\Route current()
|
||||
* @method static \Illuminate\Routing\Route delete(string $uri, array|string|callable|null $action = null)
|
||||
* @method static \Illuminate\Routing\Route fallback(array|string|callable|null $action = null)
|
||||
* @method static \Illuminate\Routing\Route get(string $uri, array|string|callable|null $action = null)
|
||||
* @method static \Illuminate\Routing\Route getCurrentRoute()
|
||||
* @method static \Illuminate\Routing\Route match(array|string $methods, string $uri, array|string|callable|null $action = null)
|
||||
* @method static \Illuminate\Routing\Route options(string $uri, array|string|callable|null $action = null)
|
||||
* @method static \Illuminate\Routing\Route patch(string $uri, array|string|callable|null $action = null)
|
||||
* @method static \Illuminate\Routing\Route permanentRedirect(string $uri, string $destination)
|
||||
* @method static \Illuminate\Routing\Route post(string $uri, array|string|callable|null $action = null)
|
||||
* @method static \Illuminate\Routing\Route put(string $uri, array|string|callable|null $action = null)
|
||||
* @method static \Illuminate\Routing\Route redirect(string $uri, string $destination, int $status = 302)
|
||||
* @method static \Illuminate\Routing\Route substituteBindings(\Illuminate\Support\Facades\Route $route)
|
||||
* @method static \Illuminate\Routing\Route view(string $uri, string $view, array $data = [])
|
||||
* @method static \Illuminate\Routing\RouteRegistrar as(string $value)
|
||||
* @method static \Illuminate\Routing\RouteRegistrar domain(string $value)
|
||||
* @method static \Illuminate\Routing\RouteRegistrar middleware(array|string|null $middleware)
|
||||
* @method static \Illuminate\Routing\RouteRegistrar name(string $value)
|
||||
* @method static \Illuminate\Routing\RouteRegistrar namespace(string $value)
|
||||
* @method static \Illuminate\Routing\RouteRegistrar prefix(string $prefix)
|
||||
* @method static \Illuminate\Routing\RouteRegistrar where(array $where)
|
||||
* @method static \Illuminate\Routing\Router|\Illuminate\Routing\RouteRegistrar group(\Closure|string|array $attributes, \Closure|string $routes)
|
||||
* @method static string|null currentRouteAction()
|
||||
* @method static string|null currentRouteName()
|
||||
* @method static void apiResources(array $resources, array $options = [])
|
||||
* @method static void bind(string $key, string|callable $binder)
|
||||
* @method static void model(string $key, string $class, \Closure|null $callback = null)
|
||||
* @method static void pattern(string $key, string $pattern)
|
||||
* @method static void resources(array $resources)
|
||||
* @method static void substituteImplicitBindings(\Illuminate\Support\Facades\Route $route)
|
||||
*
|
||||
* @see \Illuminate\Routing\Router
|
||||
*/
|
||||
class Route extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'router';
|
||||
}
|
||||
}
|
43
vendor/illuminate/support/Facades/Schema.php
vendored
Executable file
43
vendor/illuminate/support/Facades/Schema.php
vendored
Executable file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @method static \Illuminate\Database\Schema\Builder create(string $table, \Closure $callback)
|
||||
* @method static \Illuminate\Database\Schema\Builder disableForeignKeyConstraints()
|
||||
* @method static \Illuminate\Database\Schema\Builder drop(string $table)
|
||||
* @method static \Illuminate\Database\Schema\Builder dropIfExists(string $table)
|
||||
* @method static \Illuminate\Database\Schema\Builder enableForeignKeyConstraints()
|
||||
* @method static \Illuminate\Database\Schema\Builder rename(string $from, string $to)
|
||||
* @method static \Illuminate\Database\Schema\Builder table(string $table, \Closure $callback)
|
||||
* @method static bool hasColumn(string $table, string $column)
|
||||
* @method static bool hasColumns(string $table, array $columns)
|
||||
* @method static bool hasTable(string $table)
|
||||
* @method static void defaultStringLength(int $length)
|
||||
* @method static void registerCustomDoctrineType(string $class, string $name, string $type)
|
||||
*
|
||||
* @see \Illuminate\Database\Schema\Builder
|
||||
*/
|
||||
class Schema extends Facade
|
||||
{
|
||||
/**
|
||||
* Get a schema builder instance for a connection.
|
||||
*
|
||||
* @param string|null $name
|
||||
* @return \Illuminate\Database\Schema\Builder
|
||||
*/
|
||||
public static function connection($name)
|
||||
{
|
||||
return static::$app['db']->connection($name)->getSchemaBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a schema builder instance for the default connection.
|
||||
*
|
||||
* @return \Illuminate\Database\Schema\Builder
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return static::$app['db']->connection()->getSchemaBuilder();
|
||||
}
|
||||
}
|
44
vendor/illuminate/support/Facades/Session.php
vendored
Executable file
44
vendor/illuminate/support/Facades/Session.php
vendored
Executable file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @method static \SessionHandlerInterface getHandler()
|
||||
* @method static array all()
|
||||
* @method static bool exists(string|array $key)
|
||||
* @method static bool handlerNeedsRequest()
|
||||
* @method static bool has(string|array $key)
|
||||
* @method static bool isStarted()
|
||||
* @method static bool migrate(bool $destroy = false)
|
||||
* @method static bool save()
|
||||
* @method static bool start()
|
||||
* @method static mixed get(string $key, $default = null)
|
||||
* @method static mixed pull(string $key, $default = null)
|
||||
* @method static mixed remove(string $key)
|
||||
* @method static string getId()
|
||||
* @method static string getName()
|
||||
* @method static string token()
|
||||
* @method static string|null previousUrl()
|
||||
* @method static void flush()
|
||||
* @method static void forget(string|array $keys)
|
||||
* @method static void push(string $key, mixed $value)
|
||||
* @method static void put(string|array $key, $value = null)
|
||||
* @method static void setId(string $id)
|
||||
* @method static void setPreviousUrl(string $url)
|
||||
* @method static void setRequestOnHandler(\Illuminate\Http\Request $request)
|
||||
*
|
||||
* @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';
|
||||
}
|
||||
}
|
90
vendor/illuminate/support/Facades/Storage.php
vendored
Normal file
90
vendor/illuminate/support/Facades/Storage.php
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
|
||||
/**
|
||||
* @method static \Illuminate\Contracts\Filesystem\Filesystem assertExists(string|array $path)
|
||||
* @method static \Illuminate\Contracts\Filesystem\Filesystem assertMissing(string|array $path)
|
||||
* @method static \Illuminate\Contracts\Filesystem\Filesystem cloud()
|
||||
* @method static \Illuminate\Contracts\Filesystem\Filesystem disk(string $name = null)
|
||||
* @method static array allDirectories(string|null $directory = null)
|
||||
* @method static array allFiles(string|null $directory = null)
|
||||
* @method static array directories(string|null $directory = null, bool $recursive = false)
|
||||
* @method static array files(string|null $directory = null, bool $recursive = false)
|
||||
* @method static bool append(string $path, string $data)
|
||||
* @method static bool copy(string $from, string $to)
|
||||
* @method static bool delete(string|array $paths)
|
||||
* @method static bool deleteDirectory(string $directory)
|
||||
* @method static bool exists(string $path)
|
||||
* @method static bool makeDirectory(string $path)
|
||||
* @method static bool move(string $from, string $to)
|
||||
* @method static bool prepend(string $path, string $data)
|
||||
* @method static bool put(string $path, string|resource $contents, mixed $options = [])
|
||||
* @method static string|false putFile(string $path, \Illuminate\Http\File|\Illuminate\Http\UploadedFile|string $file, mixed $options = [])
|
||||
* @method static string|false putFileAs(string $path, \Illuminate\Http\File|\Illuminate\Http\UploadedFile|string $file, string $name, mixed $options = [])
|
||||
* @method static bool setVisibility(string $path, string $visibility)
|
||||
* @method static bool writeStream(string $path, resource $resource, array $options = [])
|
||||
* @method static int lastModified(string $path)
|
||||
* @method static int size(string $path)
|
||||
* @method static resource|null readStream(string $path)
|
||||
* @method static string get(string $path)
|
||||
* @method static string getVisibility(string $path)
|
||||
* @method static string temporaryUrl(string $path, \DateTimeInterface $expiration, array $options = [])
|
||||
* @method static string url(string $path)
|
||||
*
|
||||
* @see \Illuminate\Filesystem\FilesystemManager
|
||||
*/
|
||||
class Storage extends Facade
|
||||
{
|
||||
/**
|
||||
* Replace the given disk with a local testing disk.
|
||||
*
|
||||
* @param string|null $disk
|
||||
* @param array $config
|
||||
* @return \Illuminate\Contracts\Filesystem\Filesystem
|
||||
*/
|
||||
public static function fake($disk = null, array $config = [])
|
||||
{
|
||||
$disk = $disk ?: static::$app['config']->get('filesystems.default');
|
||||
|
||||
(new Filesystem)->cleanDirectory(
|
||||
$root = storage_path('framework/testing/disks/'.$disk)
|
||||
);
|
||||
|
||||
static::set($disk, $fake = static::createLocalDriver(array_merge($config, [
|
||||
'root' => $root,
|
||||
])));
|
||||
|
||||
return $fake;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the given disk with a persistent local testing disk.
|
||||
*
|
||||
* @param string|null $disk
|
||||
* @param array $config
|
||||
* @return \Illuminate\Contracts\Filesystem\Filesystem
|
||||
*/
|
||||
public static function persistentFake($disk = null, array $config = [])
|
||||
{
|
||||
$disk = $disk ?: static::$app['config']->get('filesystems.default');
|
||||
|
||||
static::set($disk, $fake = static::createLocalDriver(array_merge($config, [
|
||||
'root' => storage_path('framework/testing/disks/'.$disk),
|
||||
])));
|
||||
|
||||
return $fake;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'filesystem';
|
||||
}
|
||||
}
|
34
vendor/illuminate/support/Facades/URL.php
vendored
Executable file
34
vendor/illuminate/support/Facades/URL.php
vendored
Executable file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @method static \Illuminate\Contracts\Routing\UrlGenerator setRootControllerNamespace(string $rootNamespace)
|
||||
* @method static bool hasValidSignature(\Illuminate\Http\Request $request, bool $absolute = true)
|
||||
* @method static string action(string $action, $parameters = [], bool $absolute = true)
|
||||
* @method static string asset(string $path, bool $secure = null)
|
||||
* @method static string current()
|
||||
* @method static string full()
|
||||
* @method static string previous($fallback = false)
|
||||
* @method static string route(string $name, $parameters = [], bool $absolute = true)
|
||||
* @method static string secure(string $path, array $parameters = [])
|
||||
* @method static string signedRoute(string $name, array $parameters = [], \DateTimeInterface|\DateInterval|int $expiration = null, bool $absolute = true)
|
||||
* @method static string temporarySignedRoute(string $name, \DateTimeInterface|\DateInterval|int $expiration, array $parameters = [], bool $absolute = true)
|
||||
* @method static string to(string $path, $extra = [], bool $secure = null)
|
||||
* @method static void defaults(array $defaults)
|
||||
* @method static void forceScheme(string $scheme)
|
||||
*
|
||||
* @see \Illuminate\Routing\UrlGenerator
|
||||
*/
|
||||
class URL extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'url';
|
||||
}
|
||||
}
|
24
vendor/illuminate/support/Facades/Validator.php
vendored
Executable file
24
vendor/illuminate/support/Facades/Validator.php
vendored
Executable file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @method static \Illuminate\Contracts\Validation\Validator make(array $data, array $rules, array $messages = [], array $customAttributes = [])
|
||||
* @method static void extend(string $rule, \Closure|string $extension, string $message = null)
|
||||
* @method static void extendImplicit(string $rule, \Closure|string $extension, string $message = null)
|
||||
* @method static void replacer(string $rule, \Closure|string $replacer)
|
||||
*
|
||||
* @see \Illuminate\Validation\Factory
|
||||
*/
|
||||
class Validator extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'validator';
|
||||
}
|
||||
}
|
29
vendor/illuminate/support/Facades/View.php
vendored
Executable file
29
vendor/illuminate/support/Facades/View.php
vendored
Executable file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Facades;
|
||||
|
||||
/**
|
||||
* @method static \Illuminate\Contracts\View\Factory addNamespace(string $namespace, string|array $hints)
|
||||
* @method static \Illuminate\Contracts\View\Factory first(array $views, \Illuminate\Contracts\Support\Arrayable|array $data, array $mergeData)
|
||||
* @method static \Illuminate\Contracts\View\Factory replaceNamespace(string $namespace, string|array $hints)
|
||||
* @method static \Illuminate\Contracts\View\View file(string $path, array $data = [], array $mergeData = [])
|
||||
* @method static \Illuminate\Contracts\View\View make(string $view, array $data = [], array $mergeData = [])
|
||||
* @method static array composer(array|string $views, \Closure|string $callback)
|
||||
* @method static array creator(array|string $views, \Closure|string $callback)
|
||||
* @method static bool exists(string $view)
|
||||
* @method static mixed share(array|string $key, $value = null)
|
||||
*
|
||||
* @see \Illuminate\View\Factory
|
||||
*/
|
||||
class View extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'view';
|
||||
}
|
||||
}
|
192
vendor/illuminate/support/Fluent.php
vendored
Executable file
192
vendor/illuminate/support/Fluent.php
vendored
Executable file
@ -0,0 +1,192 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support;
|
||||
|
||||
use ArrayAccess;
|
||||
use Illuminate\Contracts\Support\Arrayable;
|
||||
use Illuminate\Contracts\Support\Jsonable;
|
||||
use JsonSerializable;
|
||||
|
||||
class Fluent implements Arrayable, ArrayAccess, Jsonable, JsonSerializable
|
||||
{
|
||||
/**
|
||||
* All of the attributes set on the fluent instance.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $attributes = [];
|
||||
|
||||
/**
|
||||
* Create a new fluent instance.
|
||||
*
|
||||
* @param array|object $attributes
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($attributes = [])
|
||||
{
|
||||
foreach ($attributes as $key => $value) {
|
||||
$this->attributes[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an attribute from the fluent instance.
|
||||
*
|
||||
* @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 fluent instance.
|
||||
*
|
||||
* @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->jsonSerialize(), $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given offset exists.
|
||||
*
|
||||
* @param string $offset
|
||||
* @return bool
|
||||
*/
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return isset($this->attributes[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value for a given offset.
|
||||
*
|
||||
* @param string $offset
|
||||
* @return mixed
|
||||
*/
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->get($offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value at the given offset.
|
||||
*
|
||||
* @param string $offset
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
$this->attributes[$offset] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unset the value at the given offset.
|
||||
*
|
||||
* @param string $offset
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
unset($this->attributes[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle dynamic calls to the fluent instance 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->offsetSet($key, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically check if an attribute is set.
|
||||
*
|
||||
* @param string $key
|
||||
* @return bool
|
||||
*/
|
||||
public function __isset($key)
|
||||
{
|
||||
return $this->offsetExists($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically unset an attribute.
|
||||
*
|
||||
* @param string $key
|
||||
* @return void
|
||||
*/
|
||||
public function __unset($key)
|
||||
{
|
||||
$this->offsetUnset($key);
|
||||
}
|
||||
}
|
63
vendor/illuminate/support/HigherOrderCollectionProxy.php
vendored
Normal file
63
vendor/illuminate/support/HigherOrderCollectionProxy.php
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support;
|
||||
|
||||
/**
|
||||
* @mixin \Illuminate\Support\Enumerable
|
||||
*/
|
||||
class HigherOrderCollectionProxy
|
||||
{
|
||||
/**
|
||||
* The collection being operated on.
|
||||
*
|
||||
* @var \Illuminate\Support\Enumerable
|
||||
*/
|
||||
protected $collection;
|
||||
|
||||
/**
|
||||
* The method being proxied.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $method;
|
||||
|
||||
/**
|
||||
* Create a new proxy instance.
|
||||
*
|
||||
* @param \Illuminate\Support\Enumerable $collection
|
||||
* @param string $method
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Enumerable $collection, $method)
|
||||
{
|
||||
$this->method = $method;
|
||||
$this->collection = $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Proxy accessing an attribute onto the collection items.
|
||||
*
|
||||
* @param string $key
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($key)
|
||||
{
|
||||
return $this->collection->{$this->method}(function ($value) use ($key) {
|
||||
return is_array($value) ? $value[$key] : $value->{$key};
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Proxy a method call onto the collection items.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
return $this->collection->{$this->method}(function ($value) use ($method, $parameters) {
|
||||
return $value->{$method}(...$parameters);
|
||||
});
|
||||
}
|
||||
}
|
38
vendor/illuminate/support/HigherOrderTapProxy.php
vendored
Normal file
38
vendor/illuminate/support/HigherOrderTapProxy.php
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support;
|
||||
|
||||
class HigherOrderTapProxy
|
||||
{
|
||||
/**
|
||||
* The target being tapped.
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
public $target;
|
||||
|
||||
/**
|
||||
* Create a new tap proxy instance.
|
||||
*
|
||||
* @param mixed $target
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($target)
|
||||
{
|
||||
$this->target = $target;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically pass method calls to the target.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
$this->target->{$method}(...$parameters);
|
||||
|
||||
return $this->target;
|
||||
}
|
||||
}
|
63
vendor/illuminate/support/HigherOrderWhenProxy.php
vendored
Normal file
63
vendor/illuminate/support/HigherOrderWhenProxy.php
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support;
|
||||
|
||||
/**
|
||||
* @mixin \Illuminate\Support\Enumerable
|
||||
*/
|
||||
class HigherOrderWhenProxy
|
||||
{
|
||||
/**
|
||||
* The collection being operated on.
|
||||
*
|
||||
* @var \Illuminate\Support\Enumerable
|
||||
*/
|
||||
protected $collection;
|
||||
|
||||
/**
|
||||
* The condition for proxying.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $condition;
|
||||
|
||||
/**
|
||||
* Create a new proxy instance.
|
||||
*
|
||||
* @param \Illuminate\Support\Enumerable $collection
|
||||
* @param bool $condition
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Enumerable $collection, $condition)
|
||||
{
|
||||
$this->condition = $condition;
|
||||
$this->collection = $collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Proxy accessing an attribute onto the collection.
|
||||
*
|
||||
* @param string $key
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($key)
|
||||
{
|
||||
return $this->condition
|
||||
? $this->collection->{$key}
|
||||
: $this->collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Proxy a method call onto the collection.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
return $this->condition
|
||||
? $this->collection->{$method}(...$parameters)
|
||||
: $this->collection;
|
||||
}
|
||||
}
|
56
vendor/illuminate/support/HtmlString.php
vendored
Normal file
56
vendor/illuminate/support/HtmlString.php
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support;
|
||||
|
||||
use Illuminate\Contracts\Support\Htmlable;
|
||||
|
||||
class HtmlString implements Htmlable
|
||||
{
|
||||
/**
|
||||
* The HTML string.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $html;
|
||||
|
||||
/**
|
||||
* Create a new HTML string instance.
|
||||
*
|
||||
* @param string $html
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($html = '')
|
||||
{
|
||||
$this->html = $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the HTML string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toHtml()
|
||||
{
|
||||
return $this->html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given HTML string is empty.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isEmpty()
|
||||
{
|
||||
return $this->html === '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the HTML string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->toHtml();
|
||||
}
|
||||
}
|
64
vendor/illuminate/support/InteractsWithTime.php
vendored
Normal file
64
vendor/illuminate/support/InteractsWithTime.php
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support;
|
||||
|
||||
use DateInterval;
|
||||
use DateTimeInterface;
|
||||
|
||||
trait InteractsWithTime
|
||||
{
|
||||
/**
|
||||
* Get the number of seconds until the given DateTime.
|
||||
*
|
||||
* @param \DateTimeInterface|\DateInterval|int $delay
|
||||
* @return int
|
||||
*/
|
||||
protected function secondsUntil($delay)
|
||||
{
|
||||
$delay = $this->parseDateInterval($delay);
|
||||
|
||||
return $delay instanceof DateTimeInterface
|
||||
? max(0, $delay->getTimestamp() - $this->currentTime())
|
||||
: (int) $delay;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the "available at" UNIX timestamp.
|
||||
*
|
||||
* @param \DateTimeInterface|\DateInterval|int $delay
|
||||
* @return int
|
||||
*/
|
||||
protected function availableAt($delay = 0)
|
||||
{
|
||||
$delay = $this->parseDateInterval($delay);
|
||||
|
||||
return $delay instanceof DateTimeInterface
|
||||
? $delay->getTimestamp()
|
||||
: Carbon::now()->addRealSeconds($delay)->getTimestamp();
|
||||
}
|
||||
|
||||
/**
|
||||
* If the given value is an interval, convert it to a DateTime instance.
|
||||
*
|
||||
* @param \DateTimeInterface|\DateInterval|int $delay
|
||||
* @return \DateTimeInterface|int
|
||||
*/
|
||||
protected function parseDateInterval($delay)
|
||||
{
|
||||
if ($delay instanceof DateInterval) {
|
||||
$delay = Carbon::now()->add($delay);
|
||||
}
|
||||
|
||||
return $delay;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current system time as a UNIX timestamp.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
protected function currentTime()
|
||||
{
|
||||
return Carbon::now()->getTimestamp();
|
||||
}
|
||||
}
|
21
vendor/illuminate/support/LICENSE.md
vendored
Normal file
21
vendor/illuminate/support/LICENSE.md
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Taylor Otwell
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
1375
vendor/illuminate/support/LazyCollection.php
vendored
Normal file
1375
vendor/illuminate/support/LazyCollection.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
168
vendor/illuminate/support/Manager.php
vendored
Executable file
168
vendor/illuminate/support/Manager.php
vendored
Executable file
@ -0,0 +1,168 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use InvalidArgumentException;
|
||||
|
||||
abstract class Manager
|
||||
{
|
||||
/**
|
||||
* The container instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Container\Container
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
/**
|
||||
* The container instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Container\Container
|
||||
*
|
||||
* @deprecated Use the $container property instead.
|
||||
*/
|
||||
protected $app;
|
||||
|
||||
/**
|
||||
* The configuration repository instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Config\Repository
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* The registered custom driver creators.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $customCreators = [];
|
||||
|
||||
/**
|
||||
* The array of created "drivers".
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $drivers = [];
|
||||
|
||||
/**
|
||||
* Create a new manager instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Container\Container $container
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Container $container)
|
||||
{
|
||||
$this->app = $container;
|
||||
$this->container = $container;
|
||||
$this->config = $container->make('config');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default driver name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract public function getDefaultDriver();
|
||||
|
||||
/**
|
||||
* Get a driver instance.
|
||||
*
|
||||
* @param string|null $driver
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function driver($driver = null)
|
||||
{
|
||||
$driver = $driver ?: $this->getDefaultDriver();
|
||||
|
||||
if (is_null($driver)) {
|
||||
throw new InvalidArgumentException(sprintf(
|
||||
'Unable to resolve NULL driver for [%s].', static::class
|
||||
));
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
// First, we will determine if a custom driver creator exists for the given driver and
|
||||
// if it does not we will check for a creator method for the driver. Custom creator
|
||||
// callbacks allow developers to build their own "drivers" easily using Closures.
|
||||
if (isset($this->customCreators[$driver])) {
|
||||
return $this->callCustomCreator($driver);
|
||||
} else {
|
||||
$method = 'create'.Str::studly($driver).'Driver';
|
||||
|
||||
if (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->container);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 $this->driver()->$method(...$parameters);
|
||||
}
|
||||
}
|
417
vendor/illuminate/support/MessageBag.php
vendored
Executable file
417
vendor/illuminate/support/MessageBag.php
vendored
Executable file
@ -0,0 +1,417 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support;
|
||||
|
||||
use Countable;
|
||||
use Illuminate\Contracts\Support\Arrayable;
|
||||
use Illuminate\Contracts\Support\Jsonable;
|
||||
use Illuminate\Contracts\Support\MessageBag as MessageBagContract;
|
||||
use Illuminate\Contracts\Support\MessageProvider;
|
||||
use JsonSerializable;
|
||||
|
||||
class MessageBag implements Arrayable, Countable, Jsonable, JsonSerializable, MessageBagContract, MessageProvider
|
||||
{
|
||||
/**
|
||||
* All of the registered messages.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $messages = [];
|
||||
|
||||
/**
|
||||
* 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 = [])
|
||||
{
|
||||
foreach ($messages as $key => $value) {
|
||||
$value = $value instanceof Arrayable ? $value->toArray() : (array) $value;
|
||||
|
||||
$this->messages[$key] = array_unique($value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the keys present in the message bag.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function keys()
|
||||
{
|
||||
return array_keys($this->messages);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a message to the message 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a message to the message bag if the given conditional is "true".
|
||||
*
|
||||
* @param bool $boolean
|
||||
* @param string $key
|
||||
* @param string $message
|
||||
* @return $this
|
||||
*/
|
||||
public function addIf($boolean, $key, $message)
|
||||
{
|
||||
return $boolean ? $this->add($key, $message) : $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]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge a new array of messages into the message 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 messages exist for all of the given keys.
|
||||
*
|
||||
* @param array|string|null $key
|
||||
* @return bool
|
||||
*/
|
||||
public function has($key)
|
||||
{
|
||||
if ($this->isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_null($key)) {
|
||||
return $this->any();
|
||||
}
|
||||
|
||||
$keys = is_array($key) ? $key : func_get_args();
|
||||
|
||||
foreach ($keys as $key) {
|
||||
if ($this->first($key) === '') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if messages exist for any of the given keys.
|
||||
*
|
||||
* @param array|string $keys
|
||||
* @return bool
|
||||
*/
|
||||
public function hasAny($keys = [])
|
||||
{
|
||||
if ($this->isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$keys = is_array($keys) ? $keys : func_get_args();
|
||||
|
||||
foreach ($keys as $key) {
|
||||
if ($this->has($key)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the first message from the message bag for a given key.
|
||||
*
|
||||
* @param string|null $key
|
||||
* @param string|null $format
|
||||
* @return string
|
||||
*/
|
||||
public function first($key = null, $format = null)
|
||||
{
|
||||
$messages = is_null($key) ? $this->all($format) : $this->get($key, $format);
|
||||
|
||||
$firstMessage = Arr::first($messages, null, '');
|
||||
|
||||
return is_array($firstMessage) ? Arr::first($firstMessage) : $firstMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the messages from the message bag for a given key.
|
||||
*
|
||||
* @param string $key
|
||||
* @param string|null $format
|
||||
* @return array
|
||||
*/
|
||||
public function get($key, $format = null)
|
||||
{
|
||||
// If the message exists in the message bag, we will transform it and return
|
||||
// the message. Otherwise, we will check if the key is implicit & collect
|
||||
// all the messages that match the given key and output it as an array.
|
||||
if (array_key_exists($key, $this->messages)) {
|
||||
return $this->transform(
|
||||
$this->messages[$key], $this->checkFormat($format), $key
|
||||
);
|
||||
}
|
||||
|
||||
if (Str::contains($key, '*')) {
|
||||
return $this->getMessagesForWildcardKey($key, $format);
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the messages for a wildcard key.
|
||||
*
|
||||
* @param string $key
|
||||
* @param string|null $format
|
||||
* @return array
|
||||
*/
|
||||
protected function getMessagesForWildcardKey($key, $format)
|
||||
{
|
||||
return collect($this->messages)
|
||||
->filter(function ($messages, $messageKey) use ($key) {
|
||||
return Str::is($key, $messageKey);
|
||||
})
|
||||
->map(function ($messages, $messageKey) use ($format) {
|
||||
return $this->transform(
|
||||
$messages, $this->checkFormat($format), $messageKey
|
||||
);
|
||||
})->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the messages for every key in the message bag.
|
||||
*
|
||||
* @param string|null $format
|
||||
* @return array
|
||||
*/
|
||||
public function all($format = null)
|
||||
{
|
||||
$format = $this->checkFormat($format);
|
||||
|
||||
$all = [];
|
||||
|
||||
foreach ($this->messages as $key => $messages) {
|
||||
$all = array_merge($all, $this->transform($messages, $format, $key));
|
||||
}
|
||||
|
||||
return $all;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the unique messages for every key in the message bag.
|
||||
*
|
||||
* @param string|null $format
|
||||
* @return array
|
||||
*/
|
||||
public function unique($format = null)
|
||||
{
|
||||
return array_unique($this->all($format));
|
||||
}
|
||||
|
||||
/**
|
||||
* Format an array of messages.
|
||||
*
|
||||
* @param array $messages
|
||||
* @param string $format
|
||||
* @param string $messageKey
|
||||
* @return array
|
||||
*/
|
||||
protected function transform($messages, $format, $messageKey)
|
||||
{
|
||||
return collect((array) $messages)
|
||||
->map(function ($message) use ($format, $messageKey) {
|
||||
// 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.
|
||||
return str_replace([':message', ':key'], [$message, $messageKey], $format);
|
||||
})->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 message bag.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages()
|
||||
{
|
||||
return $this->messages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the raw messages in the message bag.
|
||||
*
|
||||
* @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 isNotEmpty()
|
||||
{
|
||||
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 message bag.
|
||||
*
|
||||
* @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->jsonSerialize(), $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the message bag to its string representation.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->toJson();
|
||||
}
|
||||
}
|
102
vendor/illuminate/support/NamespacedItemResolver.php
vendored
Executable file
102
vendor/illuminate/support/NamespacedItemResolver.php
vendored
Executable file
@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support;
|
||||
|
||||
class NamespacedItemResolver
|
||||
{
|
||||
/**
|
||||
* A cache of the parsed items.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $parsed = [];
|
||||
|
||||
/**
|
||||
* 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 there is more than one segment in this group, it means we are pulling
|
||||
// a specific item out of a group and will need to return this item name
|
||||
// as well as the group so we know which item to pull from the arrays.
|
||||
$item = count($segments) === 1
|
||||
? null
|
||||
: implode('.', array_slice($segments, 1));
|
||||
|
||||
return [null, $group, $item];
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse an array of namespaced segments.
|
||||
*
|
||||
* @param string $key
|
||||
* @return array
|
||||
*/
|
||||
protected function parseNamespacedSegments($key)
|
||||
{
|
||||
[$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([$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;
|
||||
}
|
||||
}
|
130
vendor/illuminate/support/Optional.php
vendored
Normal file
130
vendor/illuminate/support/Optional.php
vendored
Normal file
@ -0,0 +1,130 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support;
|
||||
|
||||
use ArrayAccess;
|
||||
use ArrayObject;
|
||||
|
||||
class Optional implements ArrayAccess
|
||||
{
|
||||
use Traits\Macroable {
|
||||
__call as macroCall;
|
||||
}
|
||||
|
||||
/**
|
||||
* The underlying object.
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
protected $value;
|
||||
|
||||
/**
|
||||
* Create a new optional instance.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically access a property on the underlying object.
|
||||
*
|
||||
* @param string $key
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($key)
|
||||
{
|
||||
if (is_object($this->value)) {
|
||||
return $this->value->{$key} ?? null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically check a property exists on the underlying object.
|
||||
*
|
||||
* @param mixed $name
|
||||
* @return bool
|
||||
*/
|
||||
public function __isset($name)
|
||||
{
|
||||
if (is_object($this->value)) {
|
||||
return isset($this->value->{$name});
|
||||
}
|
||||
|
||||
if (is_array($this->value) || $this->value instanceof ArrayObject) {
|
||||
return isset($this->value[$name]);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if an item exists at an offset.
|
||||
*
|
||||
* @param mixed $key
|
||||
* @return bool
|
||||
*/
|
||||
public function offsetExists($key)
|
||||
{
|
||||
return Arr::accessible($this->value) && Arr::exists($this->value, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an item at a given offset.
|
||||
*
|
||||
* @param mixed $key
|
||||
* @return mixed
|
||||
*/
|
||||
public function offsetGet($key)
|
||||
{
|
||||
return Arr::get($this->value, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the item at a given offset.
|
||||
*
|
||||
* @param mixed $key
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($key, $value)
|
||||
{
|
||||
if (Arr::accessible($this->value)) {
|
||||
$this->value[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unset the item at a given offset.
|
||||
*
|
||||
* @param string $key
|
||||
* @return void
|
||||
*/
|
||||
public function offsetUnset($key)
|
||||
{
|
||||
if (Arr::accessible($this->value)) {
|
||||
unset($this->value[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically pass a method to the underlying object.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
if (static::hasMacro($method)) {
|
||||
return $this->macroCall($method, $parameters);
|
||||
}
|
||||
|
||||
if (is_object($this->value)) {
|
||||
return $this->value->{$method}(...$parameters);
|
||||
}
|
||||
}
|
||||
}
|
147
vendor/illuminate/support/Pluralizer.php
vendored
Executable file
147
vendor/illuminate/support/Pluralizer.php
vendored
Executable file
@ -0,0 +1,147 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support;
|
||||
|
||||
use Doctrine\Inflector\CachedWordInflector;
|
||||
use Doctrine\Inflector\Inflector;
|
||||
use Doctrine\Inflector\Rules\English;
|
||||
use Doctrine\Inflector\RulesetInflector;
|
||||
|
||||
class Pluralizer
|
||||
{
|
||||
/**
|
||||
* Uncountable word forms.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $uncountable = [
|
||||
'audio',
|
||||
'bison',
|
||||
'cattle',
|
||||
'chassis',
|
||||
'compensation',
|
||||
'coreopsis',
|
||||
'data',
|
||||
'deer',
|
||||
'education',
|
||||
'emoji',
|
||||
'equipment',
|
||||
'evidence',
|
||||
'feedback',
|
||||
'firmware',
|
||||
'fish',
|
||||
'furniture',
|
||||
'gold',
|
||||
'hardware',
|
||||
'information',
|
||||
'jedi',
|
||||
'kin',
|
||||
'knowledge',
|
||||
'love',
|
||||
'metadata',
|
||||
'money',
|
||||
'moose',
|
||||
'news',
|
||||
'nutrition',
|
||||
'offspring',
|
||||
'plankton',
|
||||
'pokemon',
|
||||
'police',
|
||||
'rain',
|
||||
'recommended',
|
||||
'related',
|
||||
'rice',
|
||||
'series',
|
||||
'sheep',
|
||||
'software',
|
||||
'species',
|
||||
'swine',
|
||||
'traffic',
|
||||
'wheat',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the plural form of an English word.
|
||||
*
|
||||
* @param string $value
|
||||
* @param int $count
|
||||
* @return string
|
||||
*/
|
||||
public static function plural($value, $count = 2)
|
||||
{
|
||||
if ((int) abs($count) === 1 || static::uncountable($value)) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
$plural = static::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 = static::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 = ['mb_strtolower', 'mb_strtoupper', 'ucfirst', 'ucwords'];
|
||||
|
||||
foreach ($functions as $function) {
|
||||
if ($function($comparison) === $comparison) {
|
||||
return $function($value);
|
||||
}
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the inflector instance.
|
||||
*
|
||||
* @return \Doctrine\Inflector\Inflector
|
||||
*/
|
||||
public static function inflector()
|
||||
{
|
||||
static $inflector;
|
||||
|
||||
if (is_null($inflector)) {
|
||||
$inflector = new Inflector(
|
||||
new CachedWordInflector(new RulesetInflector(
|
||||
English\Rules::getSingularRuleset()
|
||||
)),
|
||||
new CachedWordInflector(new RulesetInflector(
|
||||
English\Rules::getPluralRuleset()
|
||||
))
|
||||
);
|
||||
}
|
||||
|
||||
return $inflector;
|
||||
}
|
||||
}
|
69
vendor/illuminate/support/ProcessUtils.php
vendored
Normal file
69
vendor/illuminate/support/ProcessUtils.php
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support;
|
||||
|
||||
/**
|
||||
* ProcessUtils is a bunch of utility methods.
|
||||
*
|
||||
* This class was originally copied from Symfony 3.
|
||||
*/
|
||||
class ProcessUtils
|
||||
{
|
||||
/**
|
||||
* Escapes a string to be used as a shell argument.
|
||||
*
|
||||
* @param string $argument
|
||||
* @return string
|
||||
*/
|
||||
public static function escapeArgument($argument)
|
||||
{
|
||||
// Fix for PHP bug #43784 escapeshellarg removes % from given string
|
||||
// Fix for PHP bug #49446 escapeshellarg doesn't work on Windows
|
||||
// @see https://bugs.php.net/bug.php?id=43784
|
||||
// @see https://bugs.php.net/bug.php?id=49446
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('' === $argument) {
|
||||
return '""';
|
||||
}
|
||||
|
||||
$escapedArgument = '';
|
||||
$quote = false;
|
||||
|
||||
foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
|
||||
if ('"' === $part) {
|
||||
$escapedArgument .= '\\"';
|
||||
} elseif (self::isSurroundedBy($part, '%')) {
|
||||
// Avoid environment variable expansion
|
||||
$escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
|
||||
} else {
|
||||
// escape trailing backslash
|
||||
if ('\\' === substr($part, -1)) {
|
||||
$part .= '\\';
|
||||
}
|
||||
$quote = true;
|
||||
$escapedArgument .= $part;
|
||||
}
|
||||
}
|
||||
|
||||
if ($quote) {
|
||||
$escapedArgument = '"'.$escapedArgument.'"';
|
||||
}
|
||||
|
||||
return $escapedArgument;
|
||||
}
|
||||
|
||||
return "'".str_replace("'", "'\\''", $argument)."'";
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the given string surrounded by the given character?
|
||||
*
|
||||
* @param string $arg
|
||||
* @param string $char
|
||||
* @return bool
|
||||
*/
|
||||
protected static function isSurroundedBy($arg, $char)
|
||||
{
|
||||
return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1];
|
||||
}
|
||||
}
|
102
vendor/illuminate/support/Reflector.php
vendored
Normal file
102
vendor/illuminate/support/Reflector.php
vendored
Normal file
@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support;
|
||||
|
||||
use ReflectionClass;
|
||||
use ReflectionMethod;
|
||||
use ReflectionNamedType;
|
||||
|
||||
class Reflector
|
||||
{
|
||||
/**
|
||||
* This is a PHP 7.4 compatible implementation of is_callable.
|
||||
*
|
||||
* @param mixed $var
|
||||
* @param bool $syntaxOnly
|
||||
* @return bool
|
||||
*/
|
||||
public static function isCallable($var, $syntaxOnly = false)
|
||||
{
|
||||
if (! is_array($var)) {
|
||||
return is_callable($var, $syntaxOnly);
|
||||
}
|
||||
|
||||
if ((! isset($var[0]) || ! isset($var[1])) ||
|
||||
! is_string($var[1] ?? null)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($syntaxOnly &&
|
||||
(is_string($var[0]) || is_object($var[0])) &&
|
||||
is_string($var[1])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$class = is_object($var[0]) ? get_class($var[0]) : $var[0];
|
||||
|
||||
$method = $var[1];
|
||||
|
||||
if (! class_exists($class)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (method_exists($class, $method)) {
|
||||
return (new ReflectionMethod($class, $method))->isPublic();
|
||||
}
|
||||
|
||||
if (is_object($var[0]) && method_exists($class, '__call')) {
|
||||
return (new ReflectionMethod($class, '__call'))->isPublic();
|
||||
}
|
||||
|
||||
if (! is_object($var[0]) && method_exists($class, '__callStatic')) {
|
||||
return (new ReflectionMethod($class, '__callStatic'))->isPublic();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the class name of the given parameter's type, if possible.
|
||||
*
|
||||
* @param \ReflectionParameter $parameter
|
||||
* @return string|null
|
||||
*/
|
||||
public static function getParameterClassName($parameter)
|
||||
{
|
||||
$type = $parameter->getType();
|
||||
|
||||
if (! $type instanceof ReflectionNamedType || $type->isBuiltin()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$name = $type->getName();
|
||||
|
||||
if (! is_null($class = $parameter->getDeclaringClass())) {
|
||||
if ($name === 'self') {
|
||||
return $class->getName();
|
||||
}
|
||||
|
||||
if ($name === 'parent' && $parent = $class->getParentClass()) {
|
||||
return $parent->getName();
|
||||
}
|
||||
}
|
||||
|
||||
return $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the parameter's type is a subclass of the given type.
|
||||
*
|
||||
* @param \ReflectionParameter $parameter
|
||||
* @param string $className
|
||||
* @return bool
|
||||
*/
|
||||
public static function isParameterSubclassOf($parameter, $className)
|
||||
{
|
||||
$paramClassName = static::getParameterClassName($parameter);
|
||||
|
||||
return ($paramClassName && class_exists($paramClassName))
|
||||
? (new ReflectionClass($paramClassName))->isSubclassOf($className)
|
||||
: false;
|
||||
}
|
||||
}
|
366
vendor/illuminate/support/ServiceProvider.php
vendored
Executable file
366
vendor/illuminate/support/ServiceProvider.php
vendored
Executable file
@ -0,0 +1,366 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support;
|
||||
|
||||
use Illuminate\Console\Application as Artisan;
|
||||
use Illuminate\Contracts\Foundation\CachesConfiguration;
|
||||
use Illuminate\Contracts\Foundation\CachesRoutes;
|
||||
use Illuminate\Contracts\Support\DeferrableProvider;
|
||||
use Illuminate\Database\Eloquent\Factory as ModelFactory;
|
||||
use Illuminate\View\Compilers\BladeCompiler;
|
||||
|
||||
abstract class ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The application instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Foundation\Application
|
||||
*/
|
||||
protected $app;
|
||||
|
||||
/**
|
||||
* The paths that should be published.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $publishes = [];
|
||||
|
||||
/**
|
||||
* The paths that should be published by group.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $publishGroups = [];
|
||||
|
||||
/**
|
||||
* Create a new service provider instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Foundation\Application $app
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($app)
|
||||
{
|
||||
$this->app = $app;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge the given configuration with the existing configuration.
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $key
|
||||
* @return void
|
||||
*/
|
||||
protected function mergeConfigFrom($path, $key)
|
||||
{
|
||||
if (! ($this->app instanceof CachesConfiguration && $this->app->configurationIsCached())) {
|
||||
$config = $this->app->make('config');
|
||||
|
||||
$config->set($key, array_merge(
|
||||
require $path, $config->get($key, [])
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the given routes file if routes are not already cached.
|
||||
*
|
||||
* @param string $path
|
||||
* @return void
|
||||
*/
|
||||
protected function loadRoutesFrom($path)
|
||||
{
|
||||
if (! ($this->app instanceof CachesRoutes && $this->app->routesAreCached())) {
|
||||
require $path;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a view file namespace.
|
||||
*
|
||||
* @param string|array $path
|
||||
* @param string $namespace
|
||||
* @return void
|
||||
*/
|
||||
protected function loadViewsFrom($path, $namespace)
|
||||
{
|
||||
$this->callAfterResolving('view', function ($view) use ($path, $namespace) {
|
||||
if (isset($this->app->config['view']['paths']) &&
|
||||
is_array($this->app->config['view']['paths'])) {
|
||||
foreach ($this->app->config['view']['paths'] as $viewPath) {
|
||||
if (is_dir($appPath = $viewPath.'/vendor/'.$namespace)) {
|
||||
$view->addNamespace($namespace, $appPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$view->addNamespace($namespace, $path);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the given view components with a custom prefix.
|
||||
*
|
||||
* @param string $prefix
|
||||
* @param array $components
|
||||
* @return void
|
||||
*/
|
||||
protected function loadViewComponentsAs($prefix, array $components)
|
||||
{
|
||||
$this->callAfterResolving(BladeCompiler::class, function ($blade) use ($prefix, $components) {
|
||||
foreach ($components as $alias => $component) {
|
||||
$blade->component($component, is_string($alias) ? $alias : null, $prefix);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a translation file namespace.
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $namespace
|
||||
* @return void
|
||||
*/
|
||||
protected function loadTranslationsFrom($path, $namespace)
|
||||
{
|
||||
$this->callAfterResolving('translator', function ($translator) use ($path, $namespace) {
|
||||
$translator->addNamespace($namespace, $path);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a JSON translation file path.
|
||||
*
|
||||
* @param string $path
|
||||
* @return void
|
||||
*/
|
||||
protected function loadJsonTranslationsFrom($path)
|
||||
{
|
||||
$this->callAfterResolving('translator', function ($translator) use ($path) {
|
||||
$translator->addJsonPath($path);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register database migration paths.
|
||||
*
|
||||
* @param array|string $paths
|
||||
* @return void
|
||||
*/
|
||||
protected function loadMigrationsFrom($paths)
|
||||
{
|
||||
$this->callAfterResolving('migrator', function ($migrator) use ($paths) {
|
||||
foreach ((array) $paths as $path) {
|
||||
$migrator->path($path);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register Eloquent model factory paths.
|
||||
*
|
||||
* @param array|string $paths
|
||||
* @return void
|
||||
*/
|
||||
protected function loadFactoriesFrom($paths)
|
||||
{
|
||||
$this->callAfterResolving(ModelFactory::class, function ($factory) use ($paths) {
|
||||
foreach ((array) $paths as $path) {
|
||||
$factory->load($path);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup an after resolving listener, or fire immediately if already resolved.
|
||||
*
|
||||
* @param string $name
|
||||
* @param callable $callback
|
||||
* @return void
|
||||
*/
|
||||
protected function callAfterResolving($name, $callback)
|
||||
{
|
||||
$this->app->afterResolving($name, $callback);
|
||||
|
||||
if ($this->app->resolved($name)) {
|
||||
$callback($this->app->make($name), $this->app);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register paths to be published by the publish command.
|
||||
*
|
||||
* @param array $paths
|
||||
* @param mixed $groups
|
||||
* @return void
|
||||
*/
|
||||
protected function publishes(array $paths, $groups = null)
|
||||
{
|
||||
$this->ensurePublishArrayInitialized($class = static::class);
|
||||
|
||||
static::$publishes[$class] = array_merge(static::$publishes[$class], $paths);
|
||||
|
||||
foreach ((array) $groups as $group) {
|
||||
$this->addPublishGroup($group, $paths);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure the publish array for the service provider is initialized.
|
||||
*
|
||||
* @param string $class
|
||||
* @return void
|
||||
*/
|
||||
protected function ensurePublishArrayInitialized($class)
|
||||
{
|
||||
if (! array_key_exists($class, static::$publishes)) {
|
||||
static::$publishes[$class] = [];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a publish group / tag to the service provider.
|
||||
*
|
||||
* @param string $group
|
||||
* @param array $paths
|
||||
* @return void
|
||||
*/
|
||||
protected function addPublishGroup($group, $paths)
|
||||
{
|
||||
if (! array_key_exists($group, static::$publishGroups)) {
|
||||
static::$publishGroups[$group] = [];
|
||||
}
|
||||
|
||||
static::$publishGroups[$group] = array_merge(
|
||||
static::$publishGroups[$group], $paths
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the paths to publish.
|
||||
*
|
||||
* @param string|null $provider
|
||||
* @param string|null $group
|
||||
* @return array
|
||||
*/
|
||||
public static function pathsToPublish($provider = null, $group = null)
|
||||
{
|
||||
if (! is_null($paths = static::pathsForProviderOrGroup($provider, $group))) {
|
||||
return $paths;
|
||||
}
|
||||
|
||||
return collect(static::$publishes)->reduce(function ($paths, $p) {
|
||||
return array_merge($paths, $p);
|
||||
}, []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the paths for the provider or group (or both).
|
||||
*
|
||||
* @param string|null $provider
|
||||
* @param string|null $group
|
||||
* @return array
|
||||
*/
|
||||
protected static function pathsForProviderOrGroup($provider, $group)
|
||||
{
|
||||
if ($provider && $group) {
|
||||
return static::pathsForProviderAndGroup($provider, $group);
|
||||
} elseif ($group && array_key_exists($group, static::$publishGroups)) {
|
||||
return static::$publishGroups[$group];
|
||||
} elseif ($provider && array_key_exists($provider, static::$publishes)) {
|
||||
return static::$publishes[$provider];
|
||||
} elseif ($group || $provider) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the paths for the provider and group.
|
||||
*
|
||||
* @param string $provider
|
||||
* @param string $group
|
||||
* @return array
|
||||
*/
|
||||
protected static function pathsForProviderAndGroup($provider, $group)
|
||||
{
|
||||
if (! empty(static::$publishes[$provider]) && ! empty(static::$publishGroups[$group])) {
|
||||
return array_intersect_key(static::$publishes[$provider], static::$publishGroups[$group]);
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the service providers available for publishing.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function publishableProviders()
|
||||
{
|
||||
return array_keys(static::$publishes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the groups available for publishing.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function publishableGroups()
|
||||
{
|
||||
return array_keys(static::$publishGroups);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the package's custom Artisan commands.
|
||||
*
|
||||
* @param array|mixed $commands
|
||||
* @return void
|
||||
*/
|
||||
public function commands($commands)
|
||||
{
|
||||
$commands = is_array($commands) ? $commands : func_get_args();
|
||||
|
||||
Artisan::starting(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 instanceof DeferrableProvider;
|
||||
}
|
||||
}
|
776
vendor/illuminate/support/Str.php
vendored
Normal file
776
vendor/illuminate/support/Str.php
vendored
Normal file
@ -0,0 +1,776 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support;
|
||||
|
||||
use Illuminate\Support\Traits\Macroable;
|
||||
use Ramsey\Uuid\Codec\TimestampFirstCombCodec;
|
||||
use Ramsey\Uuid\Generator\CombGenerator;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Ramsey\Uuid\UuidFactory;
|
||||
use voku\helper\ASCII;
|
||||
|
||||
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 = [];
|
||||
|
||||
/**
|
||||
* The callback that should be used to generate UUIDs.
|
||||
*
|
||||
* @var callable
|
||||
*/
|
||||
protected static $uuidFactory;
|
||||
|
||||
/**
|
||||
* Get a new stringable object from the given string.
|
||||
*
|
||||
* @param string $string
|
||||
* @return \Illuminate\Support\Stringable
|
||||
*/
|
||||
public static function of($string)
|
||||
{
|
||||
return new Stringable($string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the remainder of a string after the first occurrence of a given value.
|
||||
*
|
||||
* @param string $subject
|
||||
* @param string $search
|
||||
* @return string
|
||||
*/
|
||||
public static function after($subject, $search)
|
||||
{
|
||||
return $search === '' ? $subject : array_reverse(explode($search, $subject, 2))[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the remainder of a string after the last occurrence of a given value.
|
||||
*
|
||||
* @param string $subject
|
||||
* @param string $search
|
||||
* @return string
|
||||
*/
|
||||
public static function afterLast($subject, $search)
|
||||
{
|
||||
if ($search === '') {
|
||||
return $subject;
|
||||
}
|
||||
|
||||
$position = strrpos($subject, (string) $search);
|
||||
|
||||
if ($position === false) {
|
||||
return $subject;
|
||||
}
|
||||
|
||||
return substr($subject, $position + strlen($search));
|
||||
}
|
||||
|
||||
/**
|
||||
* Transliterate a UTF-8 value to ASCII.
|
||||
*
|
||||
* @param string $value
|
||||
* @param string $language
|
||||
* @return string
|
||||
*/
|
||||
public static function ascii($value, $language = 'en')
|
||||
{
|
||||
return ASCII::to_ascii((string) $value, $language);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the portion of a string before the first occurrence of a given value.
|
||||
*
|
||||
* @param string $subject
|
||||
* @param string $search
|
||||
* @return string
|
||||
*/
|
||||
public static function before($subject, $search)
|
||||
{
|
||||
return $search === '' ? $subject : explode($search, $subject)[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the portion of a string before the last occurrence of a given value.
|
||||
*
|
||||
* @param string $subject
|
||||
* @param string $search
|
||||
* @return string
|
||||
*/
|
||||
public static function beforeLast($subject, $search)
|
||||
{
|
||||
if ($search === '') {
|
||||
return $subject;
|
||||
}
|
||||
|
||||
$pos = mb_strrpos($subject, $search);
|
||||
|
||||
if ($pos === false) {
|
||||
return $subject;
|
||||
}
|
||||
|
||||
return static::substr($subject, 0, $pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the portion of a string between two given values.
|
||||
*
|
||||
* @param string $subject
|
||||
* @param string $from
|
||||
* @param string $to
|
||||
* @return string
|
||||
*/
|
||||
public static function between($subject, $from, $to)
|
||||
{
|
||||
if ($from === '' || $to === '') {
|
||||
return $subject;
|
||||
}
|
||||
|
||||
return static::beforeLast(static::after($subject, $from), $to);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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|string[] $needles
|
||||
* @return bool
|
||||
*/
|
||||
public static function contains($haystack, $needles)
|
||||
{
|
||||
foreach ((array) $needles as $needle) {
|
||||
if ($needle !== '' && mb_strpos($haystack, $needle) !== false) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a given string contains all array values.
|
||||
*
|
||||
* @param string $haystack
|
||||
* @param string[] $needles
|
||||
* @return bool
|
||||
*/
|
||||
public static function containsAll($haystack, array $needles)
|
||||
{
|
||||
foreach ($needles as $needle) {
|
||||
if (! static::contains($haystack, $needle)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a given string ends with a given substring.
|
||||
*
|
||||
* @param string $haystack
|
||||
* @param string|string[] $needles
|
||||
* @return bool
|
||||
*/
|
||||
public static function endsWith($haystack, $needles)
|
||||
{
|
||||
foreach ((array) $needles as $needle) {
|
||||
if ($needle !== '' && substr($haystack, -strlen($needle)) === (string) $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.')+$/u', '', $value).$cap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a given string matches a given pattern.
|
||||
*
|
||||
* @param string|array $pattern
|
||||
* @param string $value
|
||||
* @return bool
|
||||
*/
|
||||
public static function is($pattern, $value)
|
||||
{
|
||||
$patterns = Arr::wrap($pattern);
|
||||
|
||||
if (empty($patterns)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($patterns as $pattern) {
|
||||
// If the given value is an exact match we can of course return true right
|
||||
// from the beginning. Otherwise, we will translate asterisks and do an
|
||||
// actual pattern match against the two strings to see if they match.
|
||||
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);
|
||||
|
||||
if (preg_match('#^'.$pattern.'\z#u', $value) === 1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a given string is 7 bit ASCII.
|
||||
*
|
||||
* @param string $value
|
||||
* @return bool
|
||||
*/
|
||||
public static function isAscii($value)
|
||||
{
|
||||
return ASCII::is_ascii((string) $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a given string is a valid UUID.
|
||||
*
|
||||
* @param string $value
|
||||
* @return bool
|
||||
*/
|
||||
public static function isUuid($value)
|
||||
{
|
||||
if (! is_string($value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return preg_match('/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iD', $value) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a string to kebab case.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public static function kebab($value)
|
||||
{
|
||||
return static::snake($value, '-');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the length of the given string.
|
||||
*
|
||||
* @param string $value
|
||||
* @param string|null $encoding
|
||||
* @return int
|
||||
*/
|
||||
public static function length($value, $encoding = null)
|
||||
{
|
||||
if ($encoding) {
|
||||
return mb_strlen($value, $encoding);
|
||||
}
|
||||
|
||||
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_strwidth($value, 'UTF-8') <= $limit) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
return rtrim(mb_strimwidth($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, 'UTF-8');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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]) || static::length($value) === static::length($matches[0])) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
return rtrim($matches[0]).$end;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pad both sides of a string with another.
|
||||
*
|
||||
* @param string $value
|
||||
* @param int $length
|
||||
* @param string $pad
|
||||
* @return string
|
||||
*/
|
||||
public static function padBoth($value, $length, $pad = ' ')
|
||||
{
|
||||
return str_pad($value, $length, $pad, STR_PAD_BOTH);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pad the left side of a string with another.
|
||||
*
|
||||
* @param string $value
|
||||
* @param int $length
|
||||
* @param string $pad
|
||||
* @return string
|
||||
*/
|
||||
public static function padLeft($value, $length, $pad = ' ')
|
||||
{
|
||||
return str_pad($value, $length, $pad, STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pad the right side of a string with another.
|
||||
*
|
||||
* @param string $value
|
||||
* @param int $length
|
||||
* @param string $pad
|
||||
* @return string
|
||||
*/
|
||||
public static function padRight($value, $length, $pad = ' ')
|
||||
{
|
||||
return str_pad($value, $length, $pad, STR_PAD_RIGHT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a Class[@]method style callback into class and method.
|
||||
*
|
||||
* @param string $callback
|
||||
* @param string|null $default
|
||||
* @return array<int, string|null>
|
||||
*/
|
||||
public static function parseCallback($callback, $default = null)
|
||||
{
|
||||
return static::contains($callback, '@') ? explode('@', $callback, 2) : [$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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pluralize the last word of an English, studly caps case string.
|
||||
*
|
||||
* @param string $value
|
||||
* @param int $count
|
||||
* @return string
|
||||
*/
|
||||
public static function pluralStudly($value, $count = 2)
|
||||
{
|
||||
$parts = preg_split('/(.)(?=[A-Z])/u', $value, -1, PREG_SPLIT_DELIM_CAPTURE);
|
||||
|
||||
$lastWord = array_pop($parts);
|
||||
|
||||
return implode('', $parts).self::plural($lastWord, $count);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a more truly "random" alpha-numeric string.
|
||||
*
|
||||
* @param int $length
|
||||
* @return string
|
||||
*/
|
||||
public static function random($length = 16)
|
||||
{
|
||||
$string = '';
|
||||
|
||||
while (($len = strlen($string)) < $length) {
|
||||
$size = $length - $len;
|
||||
|
||||
$bytes = random_bytes($size);
|
||||
|
||||
$string .= substr(str_replace(['/', '+', '='], '', base64_encode($bytes)), 0, $size);
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace a given value in the string sequentially with an array.
|
||||
*
|
||||
* @param string $search
|
||||
* @param array<int|string, string> $replace
|
||||
* @param string $subject
|
||||
* @return string
|
||||
*/
|
||||
public static function replaceArray($search, array $replace, $subject)
|
||||
{
|
||||
$segments = explode($search, $subject);
|
||||
|
||||
$result = array_shift($segments);
|
||||
|
||||
foreach ($segments as $segment) {
|
||||
$result .= (array_shift($replace) ?? $search).$segment;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the first occurrence of a given value in the string.
|
||||
*
|
||||
* @param string $search
|
||||
* @param string $replace
|
||||
* @param string $subject
|
||||
* @return string
|
||||
*/
|
||||
public static function replaceFirst($search, $replace, $subject)
|
||||
{
|
||||
if ($search == '') {
|
||||
return $subject;
|
||||
}
|
||||
|
||||
$position = strpos($subject, $search);
|
||||
|
||||
if ($position !== false) {
|
||||
return substr_replace($subject, $replace, $position, strlen($search));
|
||||
}
|
||||
|
||||
return $subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the last occurrence of a given value in the string.
|
||||
*
|
||||
* @param string $search
|
||||
* @param string $replace
|
||||
* @param string $subject
|
||||
* @return string
|
||||
*/
|
||||
public static function replaceLast($search, $replace, $subject)
|
||||
{
|
||||
if ($search === '') {
|
||||
return $subject;
|
||||
}
|
||||
|
||||
$position = strrpos($subject, $search);
|
||||
|
||||
if ($position !== false) {
|
||||
return substr_replace($subject, $replace, $position, strlen($search));
|
||||
}
|
||||
|
||||
return $subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Begin a string with a single instance of a given value.
|
||||
*
|
||||
* @param string $value
|
||||
* @param string $prefix
|
||||
* @return string
|
||||
*/
|
||||
public static function start($value, $prefix)
|
||||
{
|
||||
$quoted = preg_quote($prefix, '/');
|
||||
|
||||
return $prefix.preg_replace('/^(?:'.$quoted.')+/u', '', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given string to upper-case.
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public static function upper($value)
|
||||
{
|
||||
return mb_strtoupper($value, 'UTF-8');
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @param string|null $language
|
||||
* @return string
|
||||
*/
|
||||
public static function slug($title, $separator = '-', $language = 'en')
|
||||
{
|
||||
$title = $language ? static::ascii($title, $language) : $title;
|
||||
|
||||
// Convert all dashes/underscores into separator
|
||||
$flip = $separator === '-' ? '_' : '-';
|
||||
|
||||
$title = preg_replace('!['.preg_quote($flip).']+!u', $separator, $title);
|
||||
|
||||
// Replace @ with the word 'at'
|
||||
$title = str_replace('@', $separator.'at'.$separator, $title);
|
||||
|
||||
// Remove all characters that are not the separator, letters, numbers, or whitespace.
|
||||
$title = preg_replace('![^'.preg_quote($separator).'\pL\pN\s]+!u', '', static::lower($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;
|
||||
|
||||
if (isset(static::$snakeCache[$key][$delimiter])) {
|
||||
return static::$snakeCache[$key][$delimiter];
|
||||
}
|
||||
|
||||
if (! ctype_lower($value)) {
|
||||
$value = preg_replace('/\s+/u', '', ucwords($value));
|
||||
|
||||
$value = static::lower(preg_replace('/(.)(?=[A-Z])/u', '$1'.$delimiter, $value));
|
||||
}
|
||||
|
||||
return static::$snakeCache[$key][$delimiter] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a given string starts with a given substring.
|
||||
*
|
||||
* @param string $haystack
|
||||
* @param string|string[] $needles
|
||||
* @return bool
|
||||
*/
|
||||
public static function startsWith($haystack, $needles)
|
||||
{
|
||||
foreach ((array) $needles as $needle) {
|
||||
if ((string) $needle !== '' && strncmp($haystack, $needle, strlen($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(['-', '_'], ' ', $value));
|
||||
|
||||
return static::$studlyCache[$key] = str_replace(' ', '', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the portion of string specified by the start and length parameters.
|
||||
*
|
||||
* @param string $string
|
||||
* @param int $start
|
||||
* @param int|null $length
|
||||
* @return string
|
||||
*/
|
||||
public static function substr($string, $start, $length = null)
|
||||
{
|
||||
return mb_substr($string, $start, $length, 'UTF-8');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of substring occurrences.
|
||||
*
|
||||
* @param string $haystack
|
||||
* @param string $needle
|
||||
* @param int $offset
|
||||
* @param int|null $length
|
||||
* @return int
|
||||
*/
|
||||
public static function substrCount($haystack, $needle, $offset = 0, $length = null)
|
||||
{
|
||||
if (! is_null($length)) {
|
||||
return substr_count($haystack, $needle, $offset, $length);
|
||||
} else {
|
||||
return substr_count($haystack, $needle, $offset);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a string's first character uppercase.
|
||||
*
|
||||
* @param string $string
|
||||
* @return string
|
||||
*/
|
||||
public static function ucfirst($string)
|
||||
{
|
||||
return static::upper(static::substr($string, 0, 1)).static::substr($string, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a UUID (version 4).
|
||||
*
|
||||
* @return \Ramsey\Uuid\UuidInterface
|
||||
*/
|
||||
public static function uuid()
|
||||
{
|
||||
return static::$uuidFactory
|
||||
? call_user_func(static::$uuidFactory)
|
||||
: Uuid::uuid4();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a time-ordered UUID (version 4).
|
||||
*
|
||||
* @return \Ramsey\Uuid\UuidInterface
|
||||
*/
|
||||
public static function orderedUuid()
|
||||
{
|
||||
if (static::$uuidFactory) {
|
||||
return call_user_func(static::$uuidFactory);
|
||||
}
|
||||
|
||||
$factory = new UuidFactory();
|
||||
|
||||
$factory->setRandomGenerator(new CombGenerator(
|
||||
$factory->getRandomGenerator(),
|
||||
$factory->getNumberConverter()
|
||||
));
|
||||
|
||||
$factory->setCodec(new TimestampFirstCombCodec(
|
||||
$factory->getUuidBuilder()
|
||||
));
|
||||
|
||||
return $factory->uuid4();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the callable that will be used to generate UUIDs.
|
||||
*
|
||||
* @param callable|null $factory
|
||||
* @return void
|
||||
*/
|
||||
public static function createUuidsUsing(callable $factory = null)
|
||||
{
|
||||
static::$uuidFactory = $factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that UUIDs should be created normally and not using a custom factory.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function createUuidsNormally()
|
||||
{
|
||||
static::$uuidFactory = null;
|
||||
}
|
||||
}
|
731
vendor/illuminate/support/Stringable.php
vendored
Normal file
731
vendor/illuminate/support/Stringable.php
vendored
Normal file
@ -0,0 +1,731 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Support\Traits\Macroable;
|
||||
use Symfony\Component\VarDumper\VarDumper;
|
||||
|
||||
class Stringable
|
||||
{
|
||||
use Macroable;
|
||||
|
||||
/**
|
||||
* The underlying string value.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $value;
|
||||
|
||||
/**
|
||||
* Create a new instance of the class.
|
||||
*
|
||||
* @param string $value
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($value = '')
|
||||
{
|
||||
$this->value = (string) $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the remainder of a string after the first occurrence of a given value.
|
||||
*
|
||||
* @param string $search
|
||||
* @return static
|
||||
*/
|
||||
public function after($search)
|
||||
{
|
||||
return new static(Str::after($this->value, $search));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the remainder of a string after the last occurrence of a given value.
|
||||
*
|
||||
* @param string $search
|
||||
* @return static
|
||||
*/
|
||||
public function afterLast($search)
|
||||
{
|
||||
return new static(Str::afterLast($this->value, $search));
|
||||
}
|
||||
|
||||
/**
|
||||
* Append the given values to the string.
|
||||
*
|
||||
* @param array $values
|
||||
* @return static
|
||||
*/
|
||||
public function append(...$values)
|
||||
{
|
||||
return new static($this->value.implode('', $values));
|
||||
}
|
||||
|
||||
/**
|
||||
* Transliterate a UTF-8 value to ASCII.
|
||||
*
|
||||
* @param string $language
|
||||
* @return static
|
||||
*/
|
||||
public function ascii($language = 'en')
|
||||
{
|
||||
return new static(Str::ascii($this->value, $language));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the trailing name component of the path.
|
||||
*
|
||||
* @param string $suffix
|
||||
* @return static
|
||||
*/
|
||||
public function basename($suffix = '')
|
||||
{
|
||||
return new static(basename($this->value, $suffix));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the portion of a string before the first occurrence of a given value.
|
||||
*
|
||||
* @param string $search
|
||||
* @return static
|
||||
*/
|
||||
public function before($search)
|
||||
{
|
||||
return new static(Str::before($this->value, $search));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the portion of a string before the last occurrence of a given value.
|
||||
*
|
||||
* @param string $search
|
||||
* @return static
|
||||
*/
|
||||
public function beforeLast($search)
|
||||
{
|
||||
return new static(Str::beforeLast($this->value, $search));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the portion of a string between two given values.
|
||||
*
|
||||
* @param string $from
|
||||
* @param string $to
|
||||
* @return static
|
||||
*/
|
||||
public function between($from, $to)
|
||||
{
|
||||
return new static(Str::between($this->value, $from, $to));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a value to camel case.
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function camel()
|
||||
{
|
||||
return new static(Str::camel($this->value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a given string contains a given substring.
|
||||
*
|
||||
* @param string|array $needles
|
||||
* @return bool
|
||||
*/
|
||||
public function contains($needles)
|
||||
{
|
||||
return Str::contains($this->value, $needles);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a given string contains all array values.
|
||||
*
|
||||
* @param array $needles
|
||||
* @return bool
|
||||
*/
|
||||
public function containsAll(array $needles)
|
||||
{
|
||||
return Str::containsAll($this->value, $needles);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the parent directory's path.
|
||||
*
|
||||
* @param int $levels
|
||||
* @return static
|
||||
*/
|
||||
public function dirname($levels = 1)
|
||||
{
|
||||
return new static(dirname($this->value, $levels));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a given string ends with a given substring.
|
||||
*
|
||||
* @param string|array $needles
|
||||
* @return bool
|
||||
*/
|
||||
public function endsWith($needles)
|
||||
{
|
||||
return Str::endsWith($this->value, $needles);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the string is an exact match with the given value.
|
||||
*
|
||||
* @param string $value
|
||||
* @return bool
|
||||
*/
|
||||
public function exactly($value)
|
||||
{
|
||||
return $this->value === $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Explode the string into an array.
|
||||
*
|
||||
* @param string $delimiter
|
||||
* @param int $limit
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function explode($delimiter, $limit = PHP_INT_MAX)
|
||||
{
|
||||
return collect(explode($delimiter, $this->value, $limit));
|
||||
}
|
||||
|
||||
/**
|
||||
* Split a string using a regular expression.
|
||||
*
|
||||
* @param string $pattern
|
||||
* @param int $limit
|
||||
* @param int $flags
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function split($pattern, $limit = -1, $flags = 0)
|
||||
{
|
||||
$segments = preg_split($pattern, $this->value, $limit, $flags);
|
||||
|
||||
return ! empty($segments) ? collect($segments) : collect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Cap a string with a single instance of a given value.
|
||||
*
|
||||
* @param string $cap
|
||||
* @return static
|
||||
*/
|
||||
public function finish($cap)
|
||||
{
|
||||
return new static(Str::finish($this->value, $cap));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a given string matches a given pattern.
|
||||
*
|
||||
* @param string|array $pattern
|
||||
* @return bool
|
||||
*/
|
||||
public function is($pattern)
|
||||
{
|
||||
return Str::is($pattern, $this->value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a given string is 7 bit ASCII.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isAscii()
|
||||
{
|
||||
return Str::isAscii($this->value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given string is empty.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isEmpty()
|
||||
{
|
||||
return $this->value === '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given string is not empty.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isNotEmpty()
|
||||
{
|
||||
return ! $this->isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a string to kebab case.
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function kebab()
|
||||
{
|
||||
return new static(Str::kebab($this->value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the length of the given string.
|
||||
*
|
||||
* @param string $encoding
|
||||
* @return int
|
||||
*/
|
||||
public function length($encoding = null)
|
||||
{
|
||||
return Str::length($this->value, $encoding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Limit the number of characters in a string.
|
||||
*
|
||||
* @param int $limit
|
||||
* @param string $end
|
||||
* @return static
|
||||
*/
|
||||
public function limit($limit = 100, $end = '...')
|
||||
{
|
||||
return new static(Str::limit($this->value, $limit, $end));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given string to lower-case.
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function lower()
|
||||
{
|
||||
return new static(Str::lower($this->value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the string matching the given pattern.
|
||||
*
|
||||
* @param string $pattern
|
||||
* @return static|null
|
||||
*/
|
||||
public function match($pattern)
|
||||
{
|
||||
preg_match($pattern, $this->value, $matches);
|
||||
|
||||
if (! $matches) {
|
||||
return new static;
|
||||
}
|
||||
|
||||
return new static($matches[1] ?? $matches[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the string matching the given pattern.
|
||||
*
|
||||
* @param string $pattern
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function matchAll($pattern)
|
||||
{
|
||||
preg_match_all($pattern, $this->value, $matches);
|
||||
|
||||
if (empty($matches[0])) {
|
||||
return collect();
|
||||
}
|
||||
|
||||
return collect($matches[1] ?? $matches[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pad both sides of the string with another.
|
||||
*
|
||||
* @param int $length
|
||||
* @param string $pad
|
||||
* @return static
|
||||
*/
|
||||
public function padBoth($length, $pad = ' ')
|
||||
{
|
||||
return new static(Str::padBoth($this->value, $length, $pad));
|
||||
}
|
||||
|
||||
/**
|
||||
* Pad the left side of the string with another.
|
||||
*
|
||||
* @param int $length
|
||||
* @param string $pad
|
||||
* @return static
|
||||
*/
|
||||
public function padLeft($length, $pad = ' ')
|
||||
{
|
||||
return new static(Str::padLeft($this->value, $length, $pad));
|
||||
}
|
||||
|
||||
/**
|
||||
* Pad the right side of the string with another.
|
||||
*
|
||||
* @param int $length
|
||||
* @param string $pad
|
||||
* @return static
|
||||
*/
|
||||
public function padRight($length, $pad = ' ')
|
||||
{
|
||||
return new static(Str::padRight($this->value, $length, $pad));
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a Class@method style callback into class and method.
|
||||
*
|
||||
* @param string|null $default
|
||||
* @return array
|
||||
*/
|
||||
public function parseCallback($default = null)
|
||||
{
|
||||
return Str::parseCallback($this->value, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plural form of an English word.
|
||||
*
|
||||
* @param int $count
|
||||
* @return static
|
||||
*/
|
||||
public function plural($count = 2)
|
||||
{
|
||||
return new static(Str::plural($this->value, $count));
|
||||
}
|
||||
|
||||
/**
|
||||
* Pluralize the last word of an English, studly caps case string.
|
||||
*
|
||||
* @param int $count
|
||||
* @return static
|
||||
*/
|
||||
public function pluralStudly($count = 2)
|
||||
{
|
||||
return new static(Str::pluralStudly($this->value, $count));
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepend the given values to the string.
|
||||
*
|
||||
* @param array $values
|
||||
* @return static
|
||||
*/
|
||||
public function prepend(...$values)
|
||||
{
|
||||
return new static(implode('', $values).$this->value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the given value in the given string.
|
||||
*
|
||||
* @param string|string[] $search
|
||||
* @param string|string[] $replace
|
||||
* @return static
|
||||
*/
|
||||
public function replace($search, $replace)
|
||||
{
|
||||
return new static(str_replace($search, $replace, $this->value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace a given value in the string sequentially with an array.
|
||||
*
|
||||
* @param string $search
|
||||
* @param array $replace
|
||||
* @return static
|
||||
*/
|
||||
public function replaceArray($search, array $replace)
|
||||
{
|
||||
return new static(Str::replaceArray($search, $replace, $this->value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the first occurrence of a given value in the string.
|
||||
*
|
||||
* @param string $search
|
||||
* @param string $replace
|
||||
* @return static
|
||||
*/
|
||||
public function replaceFirst($search, $replace)
|
||||
{
|
||||
return new static(Str::replaceFirst($search, $replace, $this->value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the last occurrence of a given value in the string.
|
||||
*
|
||||
* @param string $search
|
||||
* @param string $replace
|
||||
* @return static
|
||||
*/
|
||||
public function replaceLast($search, $replace)
|
||||
{
|
||||
return new static(Str::replaceLast($search, $replace, $this->value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the patterns matching the given regular expression.
|
||||
*
|
||||
* @param string $pattern
|
||||
* @param \Closure|string $replace
|
||||
* @param int $limit
|
||||
* @return static
|
||||
*/
|
||||
public function replaceMatches($pattern, $replace, $limit = -1)
|
||||
{
|
||||
if ($replace instanceof Closure) {
|
||||
return new static(preg_replace_callback($pattern, $replace, $this->value, $limit));
|
||||
}
|
||||
|
||||
return new static(preg_replace($pattern, $replace, $this->value, $limit));
|
||||
}
|
||||
|
||||
/**
|
||||
* Begin a string with a single instance of a given value.
|
||||
*
|
||||
* @param string $prefix
|
||||
* @return static
|
||||
*/
|
||||
public function start($prefix)
|
||||
{
|
||||
return new static(Str::start($this->value, $prefix));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given string to upper-case.
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function upper()
|
||||
{
|
||||
return new static(Str::upper($this->value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given string to title case.
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function title()
|
||||
{
|
||||
return new static(Str::title($this->value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the singular form of an English word.
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function singular()
|
||||
{
|
||||
return new static(Str::singular($this->value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a URL friendly "slug" from a given string.
|
||||
*
|
||||
* @param string $separator
|
||||
* @param string|null $language
|
||||
* @return static
|
||||
*/
|
||||
public function slug($separator = '-', $language = 'en')
|
||||
{
|
||||
return new static(Str::slug($this->value, $separator, $language));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a string to snake case.
|
||||
*
|
||||
* @param string $delimiter
|
||||
* @return static
|
||||
*/
|
||||
public function snake($delimiter = '_')
|
||||
{
|
||||
return new static(Str::snake($this->value, $delimiter));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a given string starts with a given substring.
|
||||
*
|
||||
* @param string|array $needles
|
||||
* @return bool
|
||||
*/
|
||||
public function startsWith($needles)
|
||||
{
|
||||
return Str::startsWith($this->value, $needles);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a value to studly caps case.
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function studly()
|
||||
{
|
||||
return new static(Str::studly($this->value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the portion of string specified by the start and length parameters.
|
||||
*
|
||||
* @param int $start
|
||||
* @param int|null $length
|
||||
* @return static
|
||||
*/
|
||||
public function substr($start, $length = null)
|
||||
{
|
||||
return new static(Str::substr($this->value, $start, $length));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of substring occurrences.
|
||||
*
|
||||
* @param string $needle
|
||||
* @param int|null $offset
|
||||
* @param int|null $length
|
||||
* @return int
|
||||
*/
|
||||
public function substrCount($needle, $offset = null, $length = null)
|
||||
{
|
||||
return Str::substrCount($this->value, $needle, $offset, $length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Trim the string of the given characters.
|
||||
*
|
||||
* @param string $characters
|
||||
* @return static
|
||||
*/
|
||||
public function trim($characters = null)
|
||||
{
|
||||
return new static(trim(...array_merge([$this->value], func_get_args())));
|
||||
}
|
||||
|
||||
/**
|
||||
* Left trim the string of the given characters.
|
||||
*
|
||||
* @param string $characters
|
||||
* @return static
|
||||
*/
|
||||
public function ltrim($characters = null)
|
||||
{
|
||||
return new static(ltrim(...array_merge([$this->value], func_get_args())));
|
||||
}
|
||||
|
||||
/**
|
||||
* Right trim the string of the given characters.
|
||||
*
|
||||
* @param string $characters
|
||||
* @return static
|
||||
*/
|
||||
public function rtrim($characters = null)
|
||||
{
|
||||
return new static(rtrim(...array_merge([$this->value], func_get_args())));
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a string's first character uppercase.
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function ucfirst()
|
||||
{
|
||||
return new static(Str::ucfirst($this->value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the callback's string changes if the given "value" is true.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param callable $callback
|
||||
* @param callable|null $default
|
||||
* @return mixed|$this
|
||||
*/
|
||||
public function when($value, $callback, $default = null)
|
||||
{
|
||||
if ($value) {
|
||||
return $callback($this, $value) ?: $this;
|
||||
} elseif ($default) {
|
||||
return $default($this, $value) ?: $this;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the given callback if the string is empty.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return static
|
||||
*/
|
||||
public function whenEmpty($callback)
|
||||
{
|
||||
if ($this->isEmpty()) {
|
||||
$result = $callback($this);
|
||||
|
||||
return is_null($result) ? $this : $result;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Limit the number of words in a string.
|
||||
*
|
||||
* @param int $words
|
||||
* @param string $end
|
||||
* @return static
|
||||
*/
|
||||
public function words($words = 100, $end = '...')
|
||||
{
|
||||
return new static(Str::words($this->value, $words, $end));
|
||||
}
|
||||
|
||||
/**
|
||||
* Dump the string.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function dump()
|
||||
{
|
||||
VarDumper::dump($this->value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dump the string and end the script.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function dd()
|
||||
{
|
||||
$this->dump();
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Proxy dynamic properties onto methods.
|
||||
*
|
||||
* @param string $key
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($key)
|
||||
{
|
||||
return $this->{$key}();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the raw string value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return (string) $this->value;
|
||||
}
|
||||
}
|
372
vendor/illuminate/support/Testing/Fakes/BusFake.php
vendored
Normal file
372
vendor/illuminate/support/Testing/Fakes/BusFake.php
vendored
Normal file
@ -0,0 +1,372 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Testing\Fakes;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Bus\QueueingDispatcher;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Traits\ReflectsClosures;
|
||||
use PHPUnit\Framework\Assert as PHPUnit;
|
||||
|
||||
class BusFake implements QueueingDispatcher
|
||||
{
|
||||
use ReflectsClosures;
|
||||
|
||||
/**
|
||||
* The original Bus dispatcher implementation.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Bus\QueueingDispatcher
|
||||
*/
|
||||
protected $dispatcher;
|
||||
|
||||
/**
|
||||
* The job types that should be intercepted instead of dispatched.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $jobsToFake;
|
||||
|
||||
/**
|
||||
* The commands that have been dispatched.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $commands = [];
|
||||
|
||||
/**
|
||||
* The commands that have been dispatched after the response has been sent.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $commandsAfterResponse = [];
|
||||
|
||||
/**
|
||||
* Create a new bus fake instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Bus\QueueingDispatcher $dispatcher
|
||||
* @param array|string $jobsToFake
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(QueueingDispatcher $dispatcher, $jobsToFake = [])
|
||||
{
|
||||
$this->dispatcher = $dispatcher;
|
||||
|
||||
$this->jobsToFake = Arr::wrap($jobsToFake);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert if a job was dispatched based on a truth-test callback.
|
||||
*
|
||||
* @param string|\Closure $command
|
||||
* @param callable|int|null $callback
|
||||
* @return void
|
||||
*/
|
||||
public function assertDispatched($command, $callback = null)
|
||||
{
|
||||
if ($command instanceof Closure) {
|
||||
[$command, $callback] = [$this->firstClosureParameterType($command), $command];
|
||||
}
|
||||
|
||||
if (is_numeric($callback)) {
|
||||
return $this->assertDispatchedTimes($command, $callback);
|
||||
}
|
||||
|
||||
PHPUnit::assertTrue(
|
||||
$this->dispatched($command, $callback)->count() > 0 ||
|
||||
$this->dispatchedAfterResponse($command, $callback)->count() > 0,
|
||||
"The expected [{$command}] job was not dispatched."
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert if a job was pushed a number of times.
|
||||
*
|
||||
* @param string $command
|
||||
* @param int $times
|
||||
* @return void
|
||||
*/
|
||||
public function assertDispatchedTimes($command, $times = 1)
|
||||
{
|
||||
$count = $this->dispatched($command)->count() +
|
||||
$this->dispatchedAfterResponse($command)->count();
|
||||
|
||||
PHPUnit::assertSame(
|
||||
$times, $count,
|
||||
"The expected [{$command}] job was pushed {$count} times instead of {$times} times."
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a job was dispatched based on a truth-test callback.
|
||||
*
|
||||
* @param string|\Closure $command
|
||||
* @param callable|null $callback
|
||||
* @return void
|
||||
*/
|
||||
public function assertNotDispatched($command, $callback = null)
|
||||
{
|
||||
if ($command instanceof Closure) {
|
||||
[$command, $callback] = [$this->firstClosureParameterType($command), $command];
|
||||
}
|
||||
|
||||
PHPUnit::assertTrue(
|
||||
$this->dispatched($command, $callback)->count() === 0 &&
|
||||
$this->dispatchedAfterResponse($command, $callback)->count() === 0,
|
||||
"The unexpected [{$command}] job was dispatched."
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert if a job was dispatched after the response was sent based on a truth-test callback.
|
||||
*
|
||||
* @param string|\Closure $command
|
||||
* @param callable|int|null $callback
|
||||
* @return void
|
||||
*/
|
||||
public function assertDispatchedAfterResponse($command, $callback = null)
|
||||
{
|
||||
if ($command instanceof Closure) {
|
||||
[$command, $callback] = [$this->firstClosureParameterType($command), $command];
|
||||
}
|
||||
|
||||
if (is_numeric($callback)) {
|
||||
return $this->assertDispatchedAfterResponseTimes($command, $callback);
|
||||
}
|
||||
|
||||
PHPUnit::assertTrue(
|
||||
$this->dispatchedAfterResponse($command, $callback)->count() > 0,
|
||||
"The expected [{$command}] job was not dispatched for after sending the response."
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert if a job was pushed after the response was sent a number of times.
|
||||
*
|
||||
* @param string $command
|
||||
* @param int $times
|
||||
* @return void
|
||||
*/
|
||||
public function assertDispatchedAfterResponseTimes($command, $times = 1)
|
||||
{
|
||||
$count = $this->dispatchedAfterResponse($command)->count();
|
||||
|
||||
PHPUnit::assertSame(
|
||||
$times, $count,
|
||||
"The expected [{$command}] job was pushed {$count} times instead of {$times} times."
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a job was dispatched based on a truth-test callback.
|
||||
*
|
||||
* @param string|\Closure $command
|
||||
* @param callable|null $callback
|
||||
* @return void
|
||||
*/
|
||||
public function assertNotDispatchedAfterResponse($command, $callback = null)
|
||||
{
|
||||
if ($command instanceof Closure) {
|
||||
[$command, $callback] = [$this->firstClosureParameterType($command), $command];
|
||||
}
|
||||
|
||||
PHPUnit::assertCount(
|
||||
0, $this->dispatchedAfterResponse($command, $callback),
|
||||
"The unexpected [{$command}] job was dispatched for after sending the response."
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the jobs matching a truth-test callback.
|
||||
*
|
||||
* @param string $command
|
||||
* @param callable|null $callback
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function dispatched($command, $callback = null)
|
||||
{
|
||||
if (! $this->hasDispatched($command)) {
|
||||
return collect();
|
||||
}
|
||||
|
||||
$callback = $callback ?: function () {
|
||||
return true;
|
||||
};
|
||||
|
||||
return collect($this->commands[$command])->filter(function ($command) use ($callback) {
|
||||
return $callback($command);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the jobs dispatched after the response was sent matching a truth-test callback.
|
||||
*
|
||||
* @param string $command
|
||||
* @param callable|null $callback
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function dispatchedAfterResponse(string $command, $callback = null)
|
||||
{
|
||||
if (! $this->hasDispatchedAfterResponse($command)) {
|
||||
return collect();
|
||||
}
|
||||
|
||||
$callback = $callback ?: function () {
|
||||
return true;
|
||||
};
|
||||
|
||||
return collect($this->commandsAfterResponse[$command])->filter(function ($command) use ($callback) {
|
||||
return $callback($command);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if there are any stored commands for a given class.
|
||||
*
|
||||
* @param string $command
|
||||
* @return bool
|
||||
*/
|
||||
public function hasDispatched($command)
|
||||
{
|
||||
return isset($this->commands[$command]) && ! empty($this->commands[$command]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if there are any stored commands for a given class.
|
||||
*
|
||||
* @param string $command
|
||||
* @return bool
|
||||
*/
|
||||
public function hasDispatchedAfterResponse($command)
|
||||
{
|
||||
return isset($this->commandsAfterResponse[$command]) && ! empty($this->commandsAfterResponse[$command]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch a command to its appropriate handler.
|
||||
*
|
||||
* @param mixed $command
|
||||
* @return mixed
|
||||
*/
|
||||
public function dispatch($command)
|
||||
{
|
||||
if ($this->shouldFakeJob($command)) {
|
||||
$this->commands[get_class($command)][] = $command;
|
||||
} else {
|
||||
return $this->dispatcher->dispatch($command);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch a command to its appropriate handler in the current process.
|
||||
*
|
||||
* @param mixed $command
|
||||
* @param mixed $handler
|
||||
* @return mixed
|
||||
*/
|
||||
public function dispatchNow($command, $handler = null)
|
||||
{
|
||||
if ($this->shouldFakeJob($command)) {
|
||||
$this->commands[get_class($command)][] = $command;
|
||||
} else {
|
||||
return $this->dispatcher->dispatchNow($command, $handler);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch a command to its appropriate handler behind a queue.
|
||||
*
|
||||
* @param mixed $command
|
||||
* @return mixed
|
||||
*/
|
||||
public function dispatchToQueue($command)
|
||||
{
|
||||
if ($this->shouldFakeJob($command)) {
|
||||
$this->commands[get_class($command)][] = $command;
|
||||
} else {
|
||||
return $this->dispatcher->dispatchToQueue($command);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch a command to its appropriate handler.
|
||||
*
|
||||
* @param mixed $command
|
||||
* @return mixed
|
||||
*/
|
||||
public function dispatchAfterResponse($command)
|
||||
{
|
||||
if ($this->shouldFakeJob($command)) {
|
||||
$this->commandsAfterResponse[get_class($command)][] = $command;
|
||||
} else {
|
||||
return $this->dispatcher->dispatch($command);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if an command should be faked or actually dispatched.
|
||||
*
|
||||
* @param mixed $command
|
||||
* @return bool
|
||||
*/
|
||||
protected function shouldFakeJob($command)
|
||||
{
|
||||
if (empty($this->jobsToFake)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return collect($this->jobsToFake)
|
||||
->filter(function ($job) use ($command) {
|
||||
return $job instanceof Closure
|
||||
? $job($command)
|
||||
: $job === get_class($command);
|
||||
})->isNotEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the pipes commands should be piped through before dispatching.
|
||||
*
|
||||
* @param array $pipes
|
||||
* @return $this
|
||||
*/
|
||||
public function pipeThrough(array $pipes)
|
||||
{
|
||||
$this->dispatcher->pipeThrough($pipes);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given command has a handler.
|
||||
*
|
||||
* @param mixed $command
|
||||
* @return bool
|
||||
*/
|
||||
public function hasCommandHandler($command)
|
||||
{
|
||||
return $this->dispatcher->hasCommandHandler($command);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the handler for a command.
|
||||
*
|
||||
* @param mixed $command
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCommandHandler($command)
|
||||
{
|
||||
return $this->dispatcher->getCommandHandler($command);
|
||||
}
|
||||
|
||||
/**
|
||||
* Map a command to a handler.
|
||||
*
|
||||
* @param array $map
|
||||
* @return $this
|
||||
*/
|
||||
public function map(array $map)
|
||||
{
|
||||
$this->dispatcher->map($map);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
272
vendor/illuminate/support/Testing/Fakes/EventFake.php
vendored
Normal file
272
vendor/illuminate/support/Testing/Fakes/EventFake.php
vendored
Normal file
@ -0,0 +1,272 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Testing\Fakes;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Traits\ReflectsClosures;
|
||||
use PHPUnit\Framework\Assert as PHPUnit;
|
||||
|
||||
class EventFake implements Dispatcher
|
||||
{
|
||||
use ReflectsClosures;
|
||||
|
||||
/**
|
||||
* The original event dispatcher.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Events\Dispatcher
|
||||
*/
|
||||
protected $dispatcher;
|
||||
|
||||
/**
|
||||
* The event types that should be intercepted instead of dispatched.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $eventsToFake;
|
||||
|
||||
/**
|
||||
* All of the events that have been intercepted keyed by type.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $events = [];
|
||||
|
||||
/**
|
||||
* Create a new event fake instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Events\Dispatcher $dispatcher
|
||||
* @param array|string $eventsToFake
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Dispatcher $dispatcher, $eventsToFake = [])
|
||||
{
|
||||
$this->dispatcher = $dispatcher;
|
||||
|
||||
$this->eventsToFake = Arr::wrap($eventsToFake);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert if an event was dispatched based on a truth-test callback.
|
||||
*
|
||||
* @param string|\Closure $event
|
||||
* @param callable|int|null $callback
|
||||
* @return void
|
||||
*/
|
||||
public function assertDispatched($event, $callback = null)
|
||||
{
|
||||
if ($event instanceof Closure) {
|
||||
[$event, $callback] = [$this->firstClosureParameterType($event), $event];
|
||||
}
|
||||
|
||||
if (is_int($callback)) {
|
||||
return $this->assertDispatchedTimes($event, $callback);
|
||||
}
|
||||
|
||||
PHPUnit::assertTrue(
|
||||
$this->dispatched($event, $callback)->count() > 0,
|
||||
"The expected [{$event}] event was not dispatched."
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert if an event was dispatched a number of times.
|
||||
*
|
||||
* @param string $event
|
||||
* @param int $times
|
||||
* @return void
|
||||
*/
|
||||
public function assertDispatchedTimes($event, $times = 1)
|
||||
{
|
||||
$count = $this->dispatched($event)->count();
|
||||
|
||||
PHPUnit::assertSame(
|
||||
$times, $count,
|
||||
"The expected [{$event}] event was dispatched {$count} times instead of {$times} times."
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if an event was dispatched based on a truth-test callback.
|
||||
*
|
||||
* @param string|\Closure $event
|
||||
* @param callable|null $callback
|
||||
* @return void
|
||||
*/
|
||||
public function assertNotDispatched($event, $callback = null)
|
||||
{
|
||||
if ($event instanceof Closure) {
|
||||
[$event, $callback] = [$this->firstClosureParameterType($event), $event];
|
||||
}
|
||||
|
||||
PHPUnit::assertCount(
|
||||
0, $this->dispatched($event, $callback),
|
||||
"The unexpected [{$event}] event was dispatched."
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the events matching a truth-test callback.
|
||||
*
|
||||
* @param string $event
|
||||
* @param callable|null $callback
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function dispatched($event, $callback = null)
|
||||
{
|
||||
if (! $this->hasDispatched($event)) {
|
||||
return collect();
|
||||
}
|
||||
|
||||
$callback = $callback ?: function () {
|
||||
return true;
|
||||
};
|
||||
|
||||
return collect($this->events[$event])->filter(function ($arguments) use ($callback) {
|
||||
return $callback(...$arguments);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given event has been dispatched.
|
||||
*
|
||||
* @param string $event
|
||||
* @return bool
|
||||
*/
|
||||
public function hasDispatched($event)
|
||||
{
|
||||
return isset($this->events[$event]) && ! empty($this->events[$event]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register an event listener with the dispatcher.
|
||||
*
|
||||
* @param string|array $events
|
||||
* @param mixed $listener
|
||||
* @return void
|
||||
*/
|
||||
public function listen($events, $listener)
|
||||
{
|
||||
$this->dispatcher->listen($events, $listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a given event has listeners.
|
||||
*
|
||||
* @param string $eventName
|
||||
* @return bool
|
||||
*/
|
||||
public function hasListeners($eventName)
|
||||
{
|
||||
return $this->dispatcher->hasListeners($eventName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register an event and payload to be dispatched later.
|
||||
*
|
||||
* @param string $event
|
||||
* @param array $payload
|
||||
* @return void
|
||||
*/
|
||||
public function push($event, $payload = [])
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Register an event subscriber with the dispatcher.
|
||||
*
|
||||
* @param object|string $subscriber
|
||||
* @return void
|
||||
*/
|
||||
public function subscribe($subscriber)
|
||||
{
|
||||
$this->dispatcher->subscribe($subscriber);
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush a set of pushed events.
|
||||
*
|
||||
* @param string $event
|
||||
* @return void
|
||||
*/
|
||||
public function flush($event)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Fire an event and call the listeners.
|
||||
*
|
||||
* @param string|object $event
|
||||
* @param mixed $payload
|
||||
* @param bool $halt
|
||||
* @return array|null
|
||||
*/
|
||||
public function dispatch($event, $payload = [], $halt = false)
|
||||
{
|
||||
$name = is_object($event) ? get_class($event) : (string) $event;
|
||||
|
||||
if ($this->shouldFakeEvent($name, $payload)) {
|
||||
$this->events[$name][] = func_get_args();
|
||||
} else {
|
||||
return $this->dispatcher->dispatch($event, $payload, $halt);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if an event should be faked or actually dispatched.
|
||||
*
|
||||
* @param string $eventName
|
||||
* @param mixed $payload
|
||||
* @return bool
|
||||
*/
|
||||
protected function shouldFakeEvent($eventName, $payload)
|
||||
{
|
||||
if (empty($this->eventsToFake)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return collect($this->eventsToFake)
|
||||
->filter(function ($event) use ($eventName, $payload) {
|
||||
return $event instanceof Closure
|
||||
? $event($eventName, $payload)
|
||||
: $event === $eventName;
|
||||
})
|
||||
->isNotEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a set of listeners from the dispatcher.
|
||||
*
|
||||
* @param string $event
|
||||
* @return void
|
||||
*/
|
||||
public function forget($event)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Forget all of the queued listeners.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function forgetPushed()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch an event and call the listeners.
|
||||
*
|
||||
* @param string|object $event
|
||||
* @param mixed $payload
|
||||
* @return void
|
||||
*/
|
||||
public function until($event, $payload = [])
|
||||
{
|
||||
return $this->dispatch($event, $payload, true);
|
||||
}
|
||||
}
|
389
vendor/illuminate/support/Testing/Fakes/MailFake.php
vendored
Normal file
389
vendor/illuminate/support/Testing/Fakes/MailFake.php
vendored
Normal file
@ -0,0 +1,389 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Testing\Fakes;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Mail\Factory;
|
||||
use Illuminate\Contracts\Mail\Mailable;
|
||||
use Illuminate\Contracts\Mail\Mailer;
|
||||
use Illuminate\Contracts\Mail\MailQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Support\Traits\ReflectsClosures;
|
||||
use PHPUnit\Framework\Assert as PHPUnit;
|
||||
|
||||
class MailFake implements Factory, Mailer, MailQueue
|
||||
{
|
||||
use ReflectsClosures;
|
||||
|
||||
/**
|
||||
* The mailer currently being used to send a message.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $currentMailer;
|
||||
|
||||
/**
|
||||
* All of the mailables that have been sent.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $mailables = [];
|
||||
|
||||
/**
|
||||
* All of the mailables that have been queued.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $queuedMailables = [];
|
||||
|
||||
/**
|
||||
* Assert if a mailable was sent based on a truth-test callback.
|
||||
*
|
||||
* @param string|\Closure $mailable
|
||||
* @param callable|int|null $callback
|
||||
* @return void
|
||||
*/
|
||||
public function assertSent($mailable, $callback = null)
|
||||
{
|
||||
if ($mailable instanceof Closure) {
|
||||
[$mailable, $callback] = [$this->firstClosureParameterType($mailable), $mailable];
|
||||
}
|
||||
|
||||
if (is_numeric($callback)) {
|
||||
return $this->assertSentTimes($mailable, $callback);
|
||||
}
|
||||
|
||||
$message = "The expected [{$mailable}] mailable was not sent.";
|
||||
|
||||
if (count($this->queuedMailables) > 0) {
|
||||
$message .= ' Did you mean to use assertQueued() instead?';
|
||||
}
|
||||
|
||||
PHPUnit::assertTrue(
|
||||
$this->sent($mailable, $callback)->count() > 0,
|
||||
$message
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert if a mailable was sent a number of times.
|
||||
*
|
||||
* @param string $mailable
|
||||
* @param int $times
|
||||
* @return void
|
||||
*/
|
||||
protected function assertSentTimes($mailable, $times = 1)
|
||||
{
|
||||
$count = $this->sent($mailable)->count();
|
||||
|
||||
PHPUnit::assertSame(
|
||||
$times, $count,
|
||||
"The expected [{$mailable}] mailable was sent {$count} times instead of {$times} times."
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a mailable was not sent based on a truth-test callback.
|
||||
*
|
||||
* @param string $mailable
|
||||
* @param callable|null $callback
|
||||
* @return void
|
||||
*/
|
||||
public function assertNotSent($mailable, $callback = null)
|
||||
{
|
||||
PHPUnit::assertCount(
|
||||
0, $this->sent($mailable, $callback),
|
||||
"The unexpected [{$mailable}] mailable was sent."
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that no mailables were sent.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function assertNothingSent()
|
||||
{
|
||||
$mailableNames = collect($this->mailables)->map(function ($mailable) {
|
||||
return get_class($mailable);
|
||||
})->join(', ');
|
||||
|
||||
PHPUnit::assertEmpty($this->mailables, 'The following mailables were sent unexpectedly: '.$mailableNames);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert if a mailable was queued based on a truth-test callback.
|
||||
*
|
||||
* @param string|\Closure $mailable
|
||||
* @param callable|int|null $callback
|
||||
* @return void
|
||||
*/
|
||||
public function assertQueued($mailable, $callback = null)
|
||||
{
|
||||
if ($mailable instanceof Closure) {
|
||||
[$mailable, $callback] = [$this->firstClosureParameterType($mailable), $mailable];
|
||||
}
|
||||
|
||||
if (is_numeric($callback)) {
|
||||
return $this->assertQueuedTimes($mailable, $callback);
|
||||
}
|
||||
|
||||
PHPUnit::assertTrue(
|
||||
$this->queued($mailable, $callback)->count() > 0,
|
||||
"The expected [{$mailable}] mailable was not queued."
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert if a mailable was queued a number of times.
|
||||
*
|
||||
* @param string $mailable
|
||||
* @param int $times
|
||||
* @return void
|
||||
*/
|
||||
protected function assertQueuedTimes($mailable, $times = 1)
|
||||
{
|
||||
$count = $this->queued($mailable)->count();
|
||||
|
||||
PHPUnit::assertSame(
|
||||
$times, $count,
|
||||
"The expected [{$mailable}] mailable was queued {$count} times instead of {$times} times."
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a mailable was not queued based on a truth-test callback.
|
||||
*
|
||||
* @param string $mailable
|
||||
* @param callable|null $callback
|
||||
* @return void
|
||||
*/
|
||||
public function assertNotQueued($mailable, $callback = null)
|
||||
{
|
||||
PHPUnit::assertCount(
|
||||
0, $this->queued($mailable, $callback),
|
||||
"The unexpected [{$mailable}] mailable was queued."
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that no mailables were queued.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function assertNothingQueued()
|
||||
{
|
||||
$mailableNames = collect($this->queuedMailables)->map(function ($mailable) {
|
||||
return get_class($mailable);
|
||||
})->join(', ');
|
||||
|
||||
PHPUnit::assertEmpty($this->queuedMailables, 'The following mailables were queued unexpectedly: '.$mailableNames);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the mailables matching a truth-test callback.
|
||||
*
|
||||
* @param string $mailable
|
||||
* @param callable|null $callback
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function sent($mailable, $callback = null)
|
||||
{
|
||||
if (! $this->hasSent($mailable)) {
|
||||
return collect();
|
||||
}
|
||||
|
||||
$callback = $callback ?: function () {
|
||||
return true;
|
||||
};
|
||||
|
||||
return $this->mailablesOf($mailable)->filter(function ($mailable) use ($callback) {
|
||||
return $callback($mailable);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given mailable has been sent.
|
||||
*
|
||||
* @param string $mailable
|
||||
* @return bool
|
||||
*/
|
||||
public function hasSent($mailable)
|
||||
{
|
||||
return $this->mailablesOf($mailable)->count() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the queued mailables matching a truth-test callback.
|
||||
*
|
||||
* @param string $mailable
|
||||
* @param callable|null $callback
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function queued($mailable, $callback = null)
|
||||
{
|
||||
if (! $this->hasQueued($mailable)) {
|
||||
return collect();
|
||||
}
|
||||
|
||||
$callback = $callback ?: function () {
|
||||
return true;
|
||||
};
|
||||
|
||||
return $this->queuedMailablesOf($mailable)->filter(function ($mailable) use ($callback) {
|
||||
return $callback($mailable);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given mailable has been queued.
|
||||
*
|
||||
* @param string $mailable
|
||||
* @return bool
|
||||
*/
|
||||
public function hasQueued($mailable)
|
||||
{
|
||||
return $this->queuedMailablesOf($mailable)->count() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the mailed mailables for a given type.
|
||||
*
|
||||
* @param string $type
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
protected function mailablesOf($type)
|
||||
{
|
||||
return collect($this->mailables)->filter(function ($mailable) use ($type) {
|
||||
return $mailable instanceof $type;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the mailed mailables for a given type.
|
||||
*
|
||||
* @param string $type
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
protected function queuedMailablesOf($type)
|
||||
{
|
||||
return collect($this->queuedMailables)->filter(function ($mailable) use ($type) {
|
||||
return $mailable instanceof $type;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a mailer instance by name.
|
||||
*
|
||||
* @param string|null $name
|
||||
* @return \Illuminate\Mail\Mailer
|
||||
*/
|
||||
public function mailer($name = null)
|
||||
{
|
||||
$this->currentMailer = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Begin the process of mailing a mailable class instance.
|
||||
*
|
||||
* @param mixed $users
|
||||
* @return \Illuminate\Mail\PendingMail
|
||||
*/
|
||||
public function to($users)
|
||||
{
|
||||
return (new PendingMailFake($this))->to($users);
|
||||
}
|
||||
|
||||
/**
|
||||
* Begin the process of mailing a mailable class instance.
|
||||
*
|
||||
* @param mixed $users
|
||||
* @return \Illuminate\Mail\PendingMail
|
||||
*/
|
||||
public function bcc($users)
|
||||
{
|
||||
return (new PendingMailFake($this))->bcc($users);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a new message with only a raw text part.
|
||||
*
|
||||
* @param string $text
|
||||
* @param \Closure|string $callback
|
||||
* @return void
|
||||
*/
|
||||
public function raw($text, $callback)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a new message using a view.
|
||||
*
|
||||
* @param string|array $view
|
||||
* @param array $data
|
||||
* @param \Closure|string|null $callback
|
||||
* @return void
|
||||
*/
|
||||
public function send($view, array $data = [], $callback = null)
|
||||
{
|
||||
if (! $view instanceof Mailable) {
|
||||
return;
|
||||
}
|
||||
|
||||
$view->mailer($this->currentMailer);
|
||||
|
||||
$this->currentMailer = null;
|
||||
|
||||
if ($view instanceof ShouldQueue) {
|
||||
return $this->queue($view, $data);
|
||||
}
|
||||
|
||||
$this->mailables[] = $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue a new e-mail message for sending.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Mail\Mailable|string|array $view
|
||||
* @param string|null $queue
|
||||
* @return mixed
|
||||
*/
|
||||
public function queue($view, $queue = null)
|
||||
{
|
||||
if (! $view instanceof Mailable) {
|
||||
return;
|
||||
}
|
||||
|
||||
$view->mailer($this->currentMailer);
|
||||
|
||||
$this->currentMailer = null;
|
||||
|
||||
$this->queuedMailables[] = $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue a new e-mail message for sending after (n) seconds.
|
||||
*
|
||||
* @param \DateTimeInterface|\DateInterval|int $delay
|
||||
* @param \Illuminate\Contracts\Mail\Mailable|string|array $view
|
||||
* @param string|null $queue
|
||||
* @return mixed
|
||||
*/
|
||||
public function later($delay, $view, $queue = null)
|
||||
{
|
||||
$this->queue($view, $queue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the array of failed recipients.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function failures()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
271
vendor/illuminate/support/Testing/Fakes/NotificationFake.php
vendored
Normal file
271
vendor/illuminate/support/Testing/Fakes/NotificationFake.php
vendored
Normal file
@ -0,0 +1,271 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Testing\Fakes;
|
||||
|
||||
use Closure;
|
||||
use Exception;
|
||||
use Illuminate\Contracts\Notifications\Dispatcher as NotificationDispatcher;
|
||||
use Illuminate\Contracts\Notifications\Factory as NotificationFactory;
|
||||
use Illuminate\Contracts\Translation\HasLocalePreference;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Traits\Macroable;
|
||||
use Illuminate\Support\Traits\ReflectsClosures;
|
||||
use PHPUnit\Framework\Assert as PHPUnit;
|
||||
|
||||
class NotificationFake implements NotificationDispatcher, NotificationFactory
|
||||
{
|
||||
use Macroable, ReflectsClosures;
|
||||
|
||||
/**
|
||||
* All of the notifications that have been sent.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $notifications = [];
|
||||
|
||||
/**
|
||||
* Locale used when sending notifications.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $locale;
|
||||
|
||||
/**
|
||||
* Assert if a notification was sent based on a truth-test callback.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @param string|\Closure $notification
|
||||
* @param callable|null $callback
|
||||
* @return void
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function assertSentTo($notifiable, $notification, $callback = null)
|
||||
{
|
||||
if (is_array($notifiable) || $notifiable instanceof Collection) {
|
||||
if (count($notifiable) === 0) {
|
||||
throw new Exception('No notifiable given.');
|
||||
}
|
||||
|
||||
foreach ($notifiable as $singleNotifiable) {
|
||||
$this->assertSentTo($singleNotifiable, $notification, $callback);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($notification instanceof Closure) {
|
||||
[$notification, $callback] = [$this->firstClosureParameterType($notification), $notification];
|
||||
}
|
||||
|
||||
if (is_numeric($callback)) {
|
||||
return $this->assertSentToTimes($notifiable, $notification, $callback);
|
||||
}
|
||||
|
||||
PHPUnit::assertTrue(
|
||||
$this->sent($notifiable, $notification, $callback)->count() > 0,
|
||||
"The expected [{$notification}] notification was not sent."
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert if a notification was sent a number of times.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @param string $notification
|
||||
* @param int $times
|
||||
* @return void
|
||||
*/
|
||||
public function assertSentToTimes($notifiable, $notification, $times = 1)
|
||||
{
|
||||
$count = $this->sent($notifiable, $notification)->count();
|
||||
|
||||
PHPUnit::assertSame(
|
||||
$times, $count,
|
||||
"Expected [{$notification}] to be sent {$times} times, but was sent {$count} times."
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a notification was sent based on a truth-test callback.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @param string|\Closure $notification
|
||||
* @param callable|null $callback
|
||||
* @return void
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function assertNotSentTo($notifiable, $notification, $callback = null)
|
||||
{
|
||||
if (is_array($notifiable) || $notifiable instanceof Collection) {
|
||||
if (count($notifiable) === 0) {
|
||||
throw new Exception('No notifiable given.');
|
||||
}
|
||||
|
||||
foreach ($notifiable as $singleNotifiable) {
|
||||
$this->assertNotSentTo($singleNotifiable, $notification, $callback);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($notification instanceof Closure) {
|
||||
[$notification, $callback] = [$this->firstClosureParameterType($notification), $notification];
|
||||
}
|
||||
|
||||
PHPUnit::assertCount(
|
||||
0, $this->sent($notifiable, $notification, $callback),
|
||||
"The unexpected [{$notification}] notification was sent."
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that no notifications were sent.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function assertNothingSent()
|
||||
{
|
||||
PHPUnit::assertEmpty($this->notifications, 'Notifications were sent unexpectedly.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert the total amount of times a notification was sent.
|
||||
*
|
||||
* @param int $expectedCount
|
||||
* @param string $notification
|
||||
* @return void
|
||||
*/
|
||||
public function assertTimesSent($expectedCount, $notification)
|
||||
{
|
||||
$actualCount = collect($this->notifications)
|
||||
->flatten(1)
|
||||
->reduce(function ($count, $sent) use ($notification) {
|
||||
return $count + count($sent[$notification] ?? []);
|
||||
}, 0);
|
||||
|
||||
PHPUnit::assertSame(
|
||||
$expectedCount, $actualCount,
|
||||
"Expected [{$notification}] to be sent {$expectedCount} times, but was sent {$actualCount} times."
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the notifications matching a truth-test callback.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @param string $notification
|
||||
* @param callable|null $callback
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function sent($notifiable, $notification, $callback = null)
|
||||
{
|
||||
if (! $this->hasSent($notifiable, $notification)) {
|
||||
return collect();
|
||||
}
|
||||
|
||||
$callback = $callback ?: function () {
|
||||
return true;
|
||||
};
|
||||
|
||||
$notifications = collect($this->notificationsFor($notifiable, $notification));
|
||||
|
||||
return $notifications->filter(function ($arguments) use ($callback) {
|
||||
return $callback(...array_values($arguments));
|
||||
})->pluck('notification');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if there are more notifications left to inspect.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @param string $notification
|
||||
* @return bool
|
||||
*/
|
||||
public function hasSent($notifiable, $notification)
|
||||
{
|
||||
return ! empty($this->notificationsFor($notifiable, $notification));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the notifications for a notifiable entity by type.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @param string $notification
|
||||
* @return array
|
||||
*/
|
||||
protected function notificationsFor($notifiable, $notification)
|
||||
{
|
||||
return $this->notifications[get_class($notifiable)][$notifiable->getKey()][$notification] ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the given notification to the given notifiable entities.
|
||||
*
|
||||
* @param \Illuminate\Support\Collection|array|mixed $notifiables
|
||||
* @param mixed $notification
|
||||
* @return void
|
||||
*/
|
||||
public function send($notifiables, $notification)
|
||||
{
|
||||
return $this->sendNow($notifiables, $notification);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the given notification immediately.
|
||||
*
|
||||
* @param \Illuminate\Support\Collection|array|mixed $notifiables
|
||||
* @param mixed $notification
|
||||
* @param array|null $channels
|
||||
* @return void
|
||||
*/
|
||||
public function sendNow($notifiables, $notification, array $channels = null)
|
||||
{
|
||||
if (! $notifiables instanceof Collection && ! is_array($notifiables)) {
|
||||
$notifiables = [$notifiables];
|
||||
}
|
||||
|
||||
foreach ($notifiables as $notifiable) {
|
||||
if (! $notification->id) {
|
||||
$notification->id = Str::uuid()->toString();
|
||||
}
|
||||
|
||||
$this->notifications[get_class($notifiable)][$notifiable->getKey()][get_class($notification)][] = [
|
||||
'notification' => $notification,
|
||||
'channels' => $channels ?: $notification->via($notifiable),
|
||||
'notifiable' => $notifiable,
|
||||
'locale' => $notification->locale ?? $this->locale ?? value(function () use ($notifiable) {
|
||||
if ($notifiable instanceof HasLocalePreference) {
|
||||
return $notifiable->preferredLocale();
|
||||
}
|
||||
}),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a channel instance by name.
|
||||
*
|
||||
* @param string|null $name
|
||||
* @return mixed
|
||||
*/
|
||||
public function channel($name = null)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the locale of notifications.
|
||||
*
|
||||
* @param string $locale
|
||||
* @return $this
|
||||
*/
|
||||
public function locale($locale)
|
||||
{
|
||||
$this->locale = $locale;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
55
vendor/illuminate/support/Testing/Fakes/PendingMailFake.php
vendored
Normal file
55
vendor/illuminate/support/Testing/Fakes/PendingMailFake.php
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Testing\Fakes;
|
||||
|
||||
use Illuminate\Contracts\Mail\Mailable;
|
||||
use Illuminate\Mail\PendingMail;
|
||||
|
||||
class PendingMailFake extends PendingMail
|
||||
{
|
||||
/**
|
||||
* Create a new instance.
|
||||
*
|
||||
* @param \Illuminate\Support\Testing\Fakes\MailFake $mailer
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($mailer)
|
||||
{
|
||||
$this->mailer = $mailer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a new mailable message instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Mail\Mailable $mailable
|
||||
* @return mixed
|
||||
*/
|
||||
public function send(Mailable $mailable)
|
||||
{
|
||||
return $this->mailer->send($this->fill($mailable));
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a mailable message immediately.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Mail\Mailable $mailable
|
||||
* @return mixed
|
||||
*
|
||||
* @deprecated Use send() instead.
|
||||
*/
|
||||
public function sendNow(Mailable $mailable)
|
||||
{
|
||||
return $this->send($mailable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Push the given mailable onto the queue.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Mail\Mailable $mailable
|
||||
* @return mixed
|
||||
*/
|
||||
public function queue(Mailable $mailable)
|
||||
{
|
||||
return $this->mailer->queue($this->fill($mailable));
|
||||
}
|
||||
}
|
414
vendor/illuminate/support/Testing/Fakes/QueueFake.php
vendored
Normal file
414
vendor/illuminate/support/Testing/Fakes/QueueFake.php
vendored
Normal file
@ -0,0 +1,414 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Testing\Fakes;
|
||||
|
||||
use BadMethodCallException;
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Queue\Queue;
|
||||
use Illuminate\Queue\QueueManager;
|
||||
use Illuminate\Support\Traits\ReflectsClosures;
|
||||
use PHPUnit\Framework\Assert as PHPUnit;
|
||||
|
||||
class QueueFake extends QueueManager implements Queue
|
||||
{
|
||||
use ReflectsClosures;
|
||||
|
||||
/**
|
||||
* All of the jobs that have been pushed.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $jobs = [];
|
||||
|
||||
/**
|
||||
* Assert if a job was pushed based on a truth-test callback.
|
||||
*
|
||||
* @param string|\Closure $job
|
||||
* @param callable|int|null $callback
|
||||
* @return void
|
||||
*/
|
||||
public function assertPushed($job, $callback = null)
|
||||
{
|
||||
if ($job instanceof Closure) {
|
||||
[$job, $callback] = [$this->firstClosureParameterType($job), $job];
|
||||
}
|
||||
|
||||
if (is_numeric($callback)) {
|
||||
return $this->assertPushedTimes($job, $callback);
|
||||
}
|
||||
|
||||
PHPUnit::assertTrue(
|
||||
$this->pushed($job, $callback)->count() > 0,
|
||||
"The expected [{$job}] job was not pushed."
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert if a job was pushed a number of times.
|
||||
*
|
||||
* @param string $job
|
||||
* @param int $times
|
||||
* @return void
|
||||
*/
|
||||
protected function assertPushedTimes($job, $times = 1)
|
||||
{
|
||||
$count = $this->pushed($job)->count();
|
||||
|
||||
PHPUnit::assertSame(
|
||||
$times, $count,
|
||||
"The expected [{$job}] job was pushed {$count} times instead of {$times} times."
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert if a job was pushed based on a truth-test callback.
|
||||
*
|
||||
* @param string $queue
|
||||
* @param string|\Closure $job
|
||||
* @param callable|null $callback
|
||||
* @return void
|
||||
*/
|
||||
public function assertPushedOn($queue, $job, $callback = null)
|
||||
{
|
||||
if ($job instanceof Closure) {
|
||||
[$job, $callback] = [$this->firstClosureParameterType($job), $job];
|
||||
}
|
||||
|
||||
return $this->assertPushed($job, function ($job, $pushedQueue) use ($callback, $queue) {
|
||||
if ($pushedQueue !== $queue) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $callback ? $callback(...func_get_args()) : true;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert if a job was pushed with chained jobs based on a truth-test callback.
|
||||
*
|
||||
* @param string $job
|
||||
* @param array $expectedChain
|
||||
* @param callable|null $callback
|
||||
* @return void
|
||||
*/
|
||||
public function assertPushedWithChain($job, $expectedChain = [], $callback = null)
|
||||
{
|
||||
PHPUnit::assertTrue(
|
||||
$this->pushed($job, $callback)->isNotEmpty(),
|
||||
"The expected [{$job}] job was not pushed."
|
||||
);
|
||||
|
||||
PHPUnit::assertTrue(
|
||||
collect($expectedChain)->isNotEmpty(),
|
||||
'The expected chain can not be empty.'
|
||||
);
|
||||
|
||||
$this->isChainOfObjects($expectedChain)
|
||||
? $this->assertPushedWithChainOfObjects($job, $expectedChain, $callback)
|
||||
: $this->assertPushedWithChainOfClasses($job, $expectedChain, $callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert if a job was pushed with an empty chain based on a truth-test callback.
|
||||
*
|
||||
* @param string $job
|
||||
* @param callable|null $callback
|
||||
* @return void
|
||||
*/
|
||||
public function assertPushedWithoutChain($job, $callback = null)
|
||||
{
|
||||
PHPUnit::assertTrue(
|
||||
$this->pushed($job, $callback)->isNotEmpty(),
|
||||
"The expected [{$job}] job was not pushed."
|
||||
);
|
||||
|
||||
$this->assertPushedWithChainOfClasses($job, [], $callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert if a job was pushed with chained jobs based on a truth-test callback.
|
||||
*
|
||||
* @param string $job
|
||||
* @param array $expectedChain
|
||||
* @param callable|null $callback
|
||||
* @return void
|
||||
*/
|
||||
protected function assertPushedWithChainOfObjects($job, $expectedChain, $callback)
|
||||
{
|
||||
$chain = collect($expectedChain)->map(function ($job) {
|
||||
return serialize($job);
|
||||
})->all();
|
||||
|
||||
PHPUnit::assertTrue(
|
||||
$this->pushed($job, $callback)->filter(function ($job) use ($chain) {
|
||||
return $job->chained == $chain;
|
||||
})->isNotEmpty(),
|
||||
'The expected chain was not pushed.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert if a job was pushed with chained jobs based on a truth-test callback.
|
||||
*
|
||||
* @param string $job
|
||||
* @param array $expectedChain
|
||||
* @param callable|null $callback
|
||||
* @return void
|
||||
*/
|
||||
protected function assertPushedWithChainOfClasses($job, $expectedChain, $callback)
|
||||
{
|
||||
$matching = $this->pushed($job, $callback)->map->chained->map(function ($chain) {
|
||||
return collect($chain)->map(function ($job) {
|
||||
return get_class(unserialize($job));
|
||||
});
|
||||
})->filter(function ($chain) use ($expectedChain) {
|
||||
return $chain->all() === $expectedChain;
|
||||
});
|
||||
|
||||
PHPUnit::assertTrue(
|
||||
$matching->isNotEmpty(), 'The expected chain was not pushed.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given chain is entirely composed of objects.
|
||||
*
|
||||
* @param array $chain
|
||||
* @return bool
|
||||
*/
|
||||
protected function isChainOfObjects($chain)
|
||||
{
|
||||
return ! collect($chain)->contains(function ($job) {
|
||||
return ! is_object($job);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a job was pushed based on a truth-test callback.
|
||||
*
|
||||
* @param string|\Closure $job
|
||||
* @param callable|null $callback
|
||||
* @return void
|
||||
*/
|
||||
public function assertNotPushed($job, $callback = null)
|
||||
{
|
||||
if ($job instanceof Closure) {
|
||||
[$job, $callback] = [$this->firstClosureParameterType($job), $job];
|
||||
}
|
||||
|
||||
PHPUnit::assertCount(
|
||||
0, $this->pushed($job, $callback),
|
||||
"The unexpected [{$job}] job was pushed."
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that no jobs were pushed.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function assertNothingPushed()
|
||||
{
|
||||
PHPUnit::assertEmpty($this->jobs, 'Jobs were pushed unexpectedly.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the jobs matching a truth-test callback.
|
||||
*
|
||||
* @param string $job
|
||||
* @param callable|null $callback
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function pushed($job, $callback = null)
|
||||
{
|
||||
if (! $this->hasPushed($job)) {
|
||||
return collect();
|
||||
}
|
||||
|
||||
$callback = $callback ?: function () {
|
||||
return true;
|
||||
};
|
||||
|
||||
return collect($this->jobs[$job])->filter(function ($data) use ($callback) {
|
||||
return $callback($data['job'], $data['queue']);
|
||||
})->pluck('job');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if there are any stored jobs for a given class.
|
||||
*
|
||||
* @param string $job
|
||||
* @return bool
|
||||
*/
|
||||
public function hasPushed($job)
|
||||
{
|
||||
return isset($this->jobs[$job]) && ! empty($this->jobs[$job]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve a queue connection instance.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return \Illuminate\Contracts\Queue\Queue
|
||||
*/
|
||||
public function connection($value = null)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the size of the queue.
|
||||
*
|
||||
* @param string|null $queue
|
||||
* @return int
|
||||
*/
|
||||
public function size($queue = null)
|
||||
{
|
||||
return collect($this->jobs)->flatten(1)->filter(function ($job) use ($queue) {
|
||||
return $job['queue'] === $queue;
|
||||
})->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* Push a new job onto the queue.
|
||||
*
|
||||
* @param string $job
|
||||
* @param mixed $data
|
||||
* @param string|null $queue
|
||||
* @return mixed
|
||||
*/
|
||||
public function push($job, $data = '', $queue = null)
|
||||
{
|
||||
$this->jobs[is_object($job) ? get_class($job) : $job][] = [
|
||||
'job' => $job,
|
||||
'queue' => $queue,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Push a raw payload onto the queue.
|
||||
*
|
||||
* @param string $payload
|
||||
* @param string|null $queue
|
||||
* @param array $options
|
||||
* @return mixed
|
||||
*/
|
||||
public function pushRaw($payload, $queue = null, array $options = [])
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Push a new job onto the queue after a delay.
|
||||
*
|
||||
* @param \DateTimeInterface|\DateInterval|int $delay
|
||||
* @param string $job
|
||||
* @param mixed $data
|
||||
* @param string|null $queue
|
||||
* @return mixed
|
||||
*/
|
||||
public function later($delay, $job, $data = '', $queue = null)
|
||||
{
|
||||
return $this->push($job, $data, $queue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Push a new job onto the queue.
|
||||
*
|
||||
* @param string $queue
|
||||
* @param string $job
|
||||
* @param mixed $data
|
||||
* @return mixed
|
||||
*/
|
||||
public function pushOn($queue, $job, $data = '')
|
||||
{
|
||||
return $this->push($job, $data, $queue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Push a new job onto the queue after a delay.
|
||||
*
|
||||
* @param string $queue
|
||||
* @param \DateTimeInterface|\DateInterval|int $delay
|
||||
* @param string $job
|
||||
* @param mixed $data
|
||||
* @return mixed
|
||||
*/
|
||||
public function laterOn($queue, $delay, $job, $data = '')
|
||||
{
|
||||
return $this->push($job, $data, $queue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pop the next job off of the queue.
|
||||
*
|
||||
* @param string|null $queue
|
||||
* @return \Illuminate\Contracts\Queue\Job|null
|
||||
*/
|
||||
public function pop($queue = null)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Push an array of jobs onto the queue.
|
||||
*
|
||||
* @param array $jobs
|
||||
* @param mixed $data
|
||||
* @param string|null $queue
|
||||
* @return mixed
|
||||
*/
|
||||
public function bulk($jobs, $data = '', $queue = null)
|
||||
{
|
||||
foreach ($jobs as $job) {
|
||||
$this->push($job, $data, $queue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the jobs that have been pushed.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function pushedJobs()
|
||||
{
|
||||
return $this->jobs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the connection name for the queue.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getConnectionName()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the connection name for the queue.
|
||||
*
|
||||
* @param string $name
|
||||
* @return $this
|
||||
*/
|
||||
public function setConnectionName($name)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override the QueueManager to prevent circular dependency.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
throw new BadMethodCallException(sprintf(
|
||||
'Call to undefined method %s::%s()', static::class, $method
|
||||
));
|
||||
}
|
||||
}
|
69
vendor/illuminate/support/Traits/CapsuleManagerTrait.php
vendored
Normal file
69
vendor/illuminate/support/Traits/CapsuleManagerTrait.php
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Traits;
|
||||
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Support\Fluent;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
982
vendor/illuminate/support/Traits/EnumeratesValues.php
vendored
Normal file
982
vendor/illuminate/support/Traits/EnumeratesValues.php
vendored
Normal file
@ -0,0 +1,982 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Traits;
|
||||
|
||||
use CachingIterator;
|
||||
use Closure;
|
||||
use Exception;
|
||||
use Illuminate\Contracts\Support\Arrayable;
|
||||
use Illuminate\Contracts\Support\Jsonable;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Enumerable;
|
||||
use Illuminate\Support\HigherOrderCollectionProxy;
|
||||
use Illuminate\Support\HigherOrderWhenProxy;
|
||||
use JsonSerializable;
|
||||
use Symfony\Component\VarDumper\VarDumper;
|
||||
use Traversable;
|
||||
|
||||
/**
|
||||
* @property-read HigherOrderCollectionProxy $average
|
||||
* @property-read HigherOrderCollectionProxy $avg
|
||||
* @property-read HigherOrderCollectionProxy $contains
|
||||
* @property-read HigherOrderCollectionProxy $each
|
||||
* @property-read HigherOrderCollectionProxy $every
|
||||
* @property-read HigherOrderCollectionProxy $filter
|
||||
* @property-read HigherOrderCollectionProxy $first
|
||||
* @property-read HigherOrderCollectionProxy $flatMap
|
||||
* @property-read HigherOrderCollectionProxy $groupBy
|
||||
* @property-read HigherOrderCollectionProxy $keyBy
|
||||
* @property-read HigherOrderCollectionProxy $map
|
||||
* @property-read HigherOrderCollectionProxy $max
|
||||
* @property-read HigherOrderCollectionProxy $min
|
||||
* @property-read HigherOrderCollectionProxy $partition
|
||||
* @property-read HigherOrderCollectionProxy $reject
|
||||
* @property-read HigherOrderCollectionProxy $some
|
||||
* @property-read HigherOrderCollectionProxy $sortBy
|
||||
* @property-read HigherOrderCollectionProxy $sortByDesc
|
||||
* @property-read HigherOrderCollectionProxy $sum
|
||||
* @property-read HigherOrderCollectionProxy $unique
|
||||
* @property-read HigherOrderCollectionProxy $until
|
||||
*/
|
||||
trait EnumeratesValues
|
||||
{
|
||||
/**
|
||||
* The methods that can be proxied.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $proxies = [
|
||||
'average',
|
||||
'avg',
|
||||
'contains',
|
||||
'each',
|
||||
'every',
|
||||
'filter',
|
||||
'first',
|
||||
'flatMap',
|
||||
'groupBy',
|
||||
'keyBy',
|
||||
'map',
|
||||
'max',
|
||||
'min',
|
||||
'partition',
|
||||
'reject',
|
||||
'skipUntil',
|
||||
'skipWhile',
|
||||
'some',
|
||||
'sortBy',
|
||||
'sortByDesc',
|
||||
'sum',
|
||||
'takeUntil',
|
||||
'takeWhile',
|
||||
'unique',
|
||||
'until',
|
||||
];
|
||||
|
||||
/**
|
||||
* Create a new collection instance if the value isn't one already.
|
||||
*
|
||||
* @param mixed $items
|
||||
* @return static
|
||||
*/
|
||||
public static function make($items = [])
|
||||
{
|
||||
return new static($items);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap the given value in a collection if applicable.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return static
|
||||
*/
|
||||
public static function wrap($value)
|
||||
{
|
||||
return $value instanceof Enumerable
|
||||
? new static($value)
|
||||
: new static(Arr::wrap($value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the underlying items from the given collection if applicable.
|
||||
*
|
||||
* @param array|static $value
|
||||
* @return array
|
||||
*/
|
||||
public static function unwrap($value)
|
||||
{
|
||||
return $value instanceof Enumerable ? $value->all() : $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias for the "avg" method.
|
||||
*
|
||||
* @param callable|string|null $callback
|
||||
* @return mixed
|
||||
*/
|
||||
public function average($callback = null)
|
||||
{
|
||||
return $this->avg($callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias for the "contains" method.
|
||||
*
|
||||
* @param mixed $key
|
||||
* @param mixed $operator
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public function some($key, $operator = null, $value = null)
|
||||
{
|
||||
return $this->contains(...func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if an item exists, using strict comparison.
|
||||
*
|
||||
* @param mixed $key
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public function containsStrict($key, $value = null)
|
||||
{
|
||||
if (func_num_args() === 2) {
|
||||
return $this->contains(function ($item) use ($key, $value) {
|
||||
return data_get($item, $key) === $value;
|
||||
});
|
||||
}
|
||||
|
||||
if ($this->useAsCallable($key)) {
|
||||
return ! is_null($this->first($key));
|
||||
}
|
||||
|
||||
foreach ($this as $item) {
|
||||
if ($item === $key) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dump the items and end the script.
|
||||
*
|
||||
* @param mixed ...$args
|
||||
* @return void
|
||||
*/
|
||||
public function dd(...$args)
|
||||
{
|
||||
$this->dump(...$args);
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dump the items.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function dump()
|
||||
{
|
||||
(new Collection(func_get_args()))
|
||||
->push($this->all())
|
||||
->each(function ($item) {
|
||||
VarDumper::dump($item);
|
||||
});
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a callback over each item.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return $this
|
||||
*/
|
||||
public function each(callable $callback)
|
||||
{
|
||||
foreach ($this as $key => $item) {
|
||||
if ($callback($item, $key) === false) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a callback over each nested chunk of items.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return static
|
||||
*/
|
||||
public function eachSpread(callable $callback)
|
||||
{
|
||||
return $this->each(function ($chunk, $key) use ($callback) {
|
||||
$chunk[] = $key;
|
||||
|
||||
return $callback(...$chunk);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if all items pass the given truth test.
|
||||
*
|
||||
* @param string|callable $key
|
||||
* @param mixed $operator
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public function every($key, $operator = null, $value = null)
|
||||
{
|
||||
if (func_num_args() === 1) {
|
||||
$callback = $this->valueRetriever($key);
|
||||
|
||||
foreach ($this as $k => $v) {
|
||||
if (! $callback($v, $k)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return $this->every($this->operatorForWhere(...func_get_args()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the first item by the given key value pair.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $operator
|
||||
* @param mixed $value
|
||||
* @return mixed
|
||||
*/
|
||||
public function firstWhere($key, $operator = null, $value = null)
|
||||
{
|
||||
return $this->first($this->operatorForWhere(...func_get_args()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the collection is not empty.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isNotEmpty()
|
||||
{
|
||||
return ! $this->isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Run a map over each nested chunk of items.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return static
|
||||
*/
|
||||
public function mapSpread(callable $callback)
|
||||
{
|
||||
return $this->map(function ($chunk, $key) use ($callback) {
|
||||
$chunk[] = $key;
|
||||
|
||||
return $callback(...$chunk);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Run a grouping map over the items.
|
||||
*
|
||||
* The callback should return an associative array with a single key/value pair.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return static
|
||||
*/
|
||||
public function mapToGroups(callable $callback)
|
||||
{
|
||||
$groups = $this->mapToDictionary($callback);
|
||||
|
||||
return $groups->map([$this, 'make']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Map a collection and flatten the result by a single level.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return static
|
||||
*/
|
||||
public function flatMap(callable $callback)
|
||||
{
|
||||
return $this->map($callback)->collapse();
|
||||
}
|
||||
|
||||
/**
|
||||
* Map the values into a new class.
|
||||
*
|
||||
* @param string $class
|
||||
* @return static
|
||||
*/
|
||||
public function mapInto($class)
|
||||
{
|
||||
return $this->map(function ($value, $key) use ($class) {
|
||||
return new $class($value, $key);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the min value of a given key.
|
||||
*
|
||||
* @param callable|string|null $callback
|
||||
* @return mixed
|
||||
*/
|
||||
public function min($callback = null)
|
||||
{
|
||||
$callback = $this->valueRetriever($callback);
|
||||
|
||||
return $this->map(function ($value) use ($callback) {
|
||||
return $callback($value);
|
||||
})->filter(function ($value) {
|
||||
return ! is_null($value);
|
||||
})->reduce(function ($result, $value) {
|
||||
return is_null($result) || $value < $result ? $value : $result;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the max value of a given key.
|
||||
*
|
||||
* @param callable|string|null $callback
|
||||
* @return mixed
|
||||
*/
|
||||
public function max($callback = null)
|
||||
{
|
||||
$callback = $this->valueRetriever($callback);
|
||||
|
||||
return $this->filter(function ($value) {
|
||||
return ! is_null($value);
|
||||
})->reduce(function ($result, $item) use ($callback) {
|
||||
$value = $callback($item);
|
||||
|
||||
return is_null($result) || $value > $result ? $value : $result;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* "Paginate" the collection by slicing it into a smaller collection.
|
||||
*
|
||||
* @param int $page
|
||||
* @param int $perPage
|
||||
* @return static
|
||||
*/
|
||||
public function forPage($page, $perPage)
|
||||
{
|
||||
$offset = max(0, ($page - 1) * $perPage);
|
||||
|
||||
return $this->slice($offset, $perPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Partition the collection into two arrays using the given callback or key.
|
||||
*
|
||||
* @param callable|string $key
|
||||
* @param mixed $operator
|
||||
* @param mixed $value
|
||||
* @return static
|
||||
*/
|
||||
public function partition($key, $operator = null, $value = null)
|
||||
{
|
||||
$passed = [];
|
||||
$failed = [];
|
||||
|
||||
$callback = func_num_args() === 1
|
||||
? $this->valueRetriever($key)
|
||||
: $this->operatorForWhere(...func_get_args());
|
||||
|
||||
foreach ($this as $key => $item) {
|
||||
if ($callback($item, $key)) {
|
||||
$passed[$key] = $item;
|
||||
} else {
|
||||
$failed[$key] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
return new static([new static($passed), new static($failed)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the sum of the given values.
|
||||
*
|
||||
* @param callable|string|null $callback
|
||||
* @return mixed
|
||||
*/
|
||||
public function sum($callback = null)
|
||||
{
|
||||
$callback = is_null($callback)
|
||||
? $this->identity()
|
||||
: $this->valueRetriever($callback);
|
||||
|
||||
return $this->reduce(function ($result, $item) use ($callback) {
|
||||
return $result + $callback($item);
|
||||
}, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the callback if the value is truthy.
|
||||
*
|
||||
* @param bool|mixed $value
|
||||
* @param callable|null $callback
|
||||
* @param callable|null $default
|
||||
* @return static|mixed
|
||||
*/
|
||||
public function when($value, callable $callback = null, callable $default = null)
|
||||
{
|
||||
if (! $callback) {
|
||||
return new HigherOrderWhenProxy($this, $value);
|
||||
}
|
||||
|
||||
if ($value) {
|
||||
return $callback($this, $value);
|
||||
} elseif ($default) {
|
||||
return $default($this, $value);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the callback if the collection is empty.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @param callable|null $default
|
||||
* @return static|mixed
|
||||
*/
|
||||
public function whenEmpty(callable $callback, callable $default = null)
|
||||
{
|
||||
return $this->when($this->isEmpty(), $callback, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the callback if the collection is not empty.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @param callable|null $default
|
||||
* @return static|mixed
|
||||
*/
|
||||
public function whenNotEmpty(callable $callback, callable $default = null)
|
||||
{
|
||||
return $this->when($this->isNotEmpty(), $callback, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the callback if the value is falsy.
|
||||
*
|
||||
* @param bool $value
|
||||
* @param callable $callback
|
||||
* @param callable|null $default
|
||||
* @return static|mixed
|
||||
*/
|
||||
public function unless($value, callable $callback, callable $default = null)
|
||||
{
|
||||
return $this->when(! $value, $callback, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the callback unless the collection is empty.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @param callable|null $default
|
||||
* @return static|mixed
|
||||
*/
|
||||
public function unlessEmpty(callable $callback, callable $default = null)
|
||||
{
|
||||
return $this->whenNotEmpty($callback, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the callback unless the collection is not empty.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @param callable|null $default
|
||||
* @return static|mixed
|
||||
*/
|
||||
public function unlessNotEmpty(callable $callback, callable $default = null)
|
||||
{
|
||||
return $this->whenEmpty($callback, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter items by the given key value pair.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $operator
|
||||
* @param mixed $value
|
||||
* @return static
|
||||
*/
|
||||
public function where($key, $operator = null, $value = null)
|
||||
{
|
||||
return $this->filter($this->operatorForWhere(...func_get_args()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter items where the given key is not null.
|
||||
*
|
||||
* @param string|null $key
|
||||
* @return static
|
||||
*/
|
||||
public function whereNull($key = null)
|
||||
{
|
||||
return $this->whereStrict($key, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter items where the given key is null.
|
||||
*
|
||||
* @param string|null $key
|
||||
* @return static
|
||||
*/
|
||||
public function whereNotNull($key = null)
|
||||
{
|
||||
return $this->where($key, '!==', null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter items by the given key value pair using strict comparison.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @return static
|
||||
*/
|
||||
public function whereStrict($key, $value)
|
||||
{
|
||||
return $this->where($key, '===', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter items by the given key value pair.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $values
|
||||
* @param bool $strict
|
||||
* @return static
|
||||
*/
|
||||
public function whereIn($key, $values, $strict = false)
|
||||
{
|
||||
$values = $this->getArrayableItems($values);
|
||||
|
||||
return $this->filter(function ($item) use ($key, $values, $strict) {
|
||||
return in_array(data_get($item, $key), $values, $strict);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter items by the given key value pair using strict comparison.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $values
|
||||
* @return static
|
||||
*/
|
||||
public function whereInStrict($key, $values)
|
||||
{
|
||||
return $this->whereIn($key, $values, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter items such that the value of the given key is between the given values.
|
||||
*
|
||||
* @param string $key
|
||||
* @param array $values
|
||||
* @return static
|
||||
*/
|
||||
public function whereBetween($key, $values)
|
||||
{
|
||||
return $this->where($key, '>=', reset($values))->where($key, '<=', end($values));
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter items such that the value of the given key is not between the given values.
|
||||
*
|
||||
* @param string $key
|
||||
* @param array $values
|
||||
* @return static
|
||||
*/
|
||||
public function whereNotBetween($key, $values)
|
||||
{
|
||||
return $this->filter(function ($item) use ($key, $values) {
|
||||
return data_get($item, $key) < reset($values) || data_get($item, $key) > end($values);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter items by the given key value pair.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $values
|
||||
* @param bool $strict
|
||||
* @return static
|
||||
*/
|
||||
public function whereNotIn($key, $values, $strict = false)
|
||||
{
|
||||
$values = $this->getArrayableItems($values);
|
||||
|
||||
return $this->reject(function ($item) use ($key, $values, $strict) {
|
||||
return in_array(data_get($item, $key), $values, $strict);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter items by the given key value pair using strict comparison.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $values
|
||||
* @return static
|
||||
*/
|
||||
public function whereNotInStrict($key, $values)
|
||||
{
|
||||
return $this->whereNotIn($key, $values, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the items, removing any items that don't match the given type.
|
||||
*
|
||||
* @param string $type
|
||||
* @return static
|
||||
*/
|
||||
public function whereInstanceOf($type)
|
||||
{
|
||||
return $this->filter(function ($value) use ($type) {
|
||||
return $value instanceof $type;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Pass the collection to the given callback and return the result.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return mixed
|
||||
*/
|
||||
public function pipe(callable $callback)
|
||||
{
|
||||
return $callback($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pass the collection to the given callback and then return it.
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return $this
|
||||
*/
|
||||
public function tap(callable $callback)
|
||||
{
|
||||
$callback(clone $this);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a collection of all elements that do not pass a given truth test.
|
||||
*
|
||||
* @param callable|mixed $callback
|
||||
* @return static
|
||||
*/
|
||||
public function reject($callback = true)
|
||||
{
|
||||
$useAsCallable = $this->useAsCallable($callback);
|
||||
|
||||
return $this->filter(function ($value, $key) use ($callback, $useAsCallable) {
|
||||
return $useAsCallable
|
||||
? ! $callback($value, $key)
|
||||
: $value != $callback;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Return only unique items from the collection array.
|
||||
*
|
||||
* @param string|callable|null $key
|
||||
* @param bool $strict
|
||||
* @return static
|
||||
*/
|
||||
public function unique($key = null, $strict = false)
|
||||
{
|
||||
$callback = $this->valueRetriever($key);
|
||||
|
||||
$exists = [];
|
||||
|
||||
return $this->reject(function ($item, $key) use ($callback, $strict, &$exists) {
|
||||
if (in_array($id = $callback($item, $key), $exists, $strict)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$exists[] = $id;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Return only unique items from the collection array using strict comparison.
|
||||
*
|
||||
* @param string|callable|null $key
|
||||
* @return static
|
||||
*/
|
||||
public function uniqueStrict($key = null)
|
||||
{
|
||||
return $this->unique($key, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Take items in the collection until the given condition is met.
|
||||
*
|
||||
* This is an alias to the "takeUntil" method.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return static
|
||||
*
|
||||
* @deprecated Use the "takeUntil" method directly.
|
||||
*/
|
||||
public function until($value)
|
||||
{
|
||||
return $this->takeUntil($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Collect the values into a collection.
|
||||
*
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function collect()
|
||||
{
|
||||
return new Collection($this->all());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the collection of items as a plain array.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray()
|
||||
{
|
||||
return $this->map(function ($value) {
|
||||
return $value instanceof Arrayable ? $value->toArray() : $value;
|
||||
})->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the object into something JSON serializable.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return array_map(function ($value) {
|
||||
if ($value instanceof JsonSerializable) {
|
||||
return $value->jsonSerialize();
|
||||
} elseif ($value instanceof Jsonable) {
|
||||
return json_decode($value->toJson(), true);
|
||||
} elseif ($value instanceof Arrayable) {
|
||||
return $value->toArray();
|
||||
}
|
||||
|
||||
return $value;
|
||||
}, $this->all());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the collection of items as JSON.
|
||||
*
|
||||
* @param int $options
|
||||
* @return string
|
||||
*/
|
||||
public function toJson($options = 0)
|
||||
{
|
||||
return json_encode($this->jsonSerialize(), $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a CachingIterator instance.
|
||||
*
|
||||
* @param int $flags
|
||||
* @return \CachingIterator
|
||||
*/
|
||||
public function getCachingIterator($flags = CachingIterator::CALL_TOSTRING)
|
||||
{
|
||||
return new CachingIterator($this->getIterator(), $flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the collection to its string representation.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->toJson();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a method to the list of proxied methods.
|
||||
*
|
||||
* @param string $method
|
||||
* @return void
|
||||
*/
|
||||
public static function proxy($method)
|
||||
{
|
||||
static::$proxies[] = $method;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically access collection proxies.
|
||||
*
|
||||
* @param string $key
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __get($key)
|
||||
{
|
||||
if (! in_array($key, static::$proxies)) {
|
||||
throw new Exception("Property [{$key}] does not exist on this collection instance.");
|
||||
}
|
||||
|
||||
return new HigherOrderCollectionProxy($this, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Results array of items from Collection or Arrayable.
|
||||
*
|
||||
* @param mixed $items
|
||||
* @return array
|
||||
*/
|
||||
protected function getArrayableItems($items)
|
||||
{
|
||||
if (is_array($items)) {
|
||||
return $items;
|
||||
} elseif ($items instanceof Enumerable) {
|
||||
return $items->all();
|
||||
} elseif ($items instanceof Arrayable) {
|
||||
return $items->toArray();
|
||||
} elseif ($items instanceof Jsonable) {
|
||||
return json_decode($items->toJson(), true);
|
||||
} elseif ($items instanceof JsonSerializable) {
|
||||
return (array) $items->jsonSerialize();
|
||||
} elseif ($items instanceof Traversable) {
|
||||
return iterator_to_array($items);
|
||||
}
|
||||
|
||||
return (array) $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an operator checker callback.
|
||||
*
|
||||
* @param string $key
|
||||
* @param string|null $operator
|
||||
* @param mixed $value
|
||||
* @return \Closure
|
||||
*/
|
||||
protected function operatorForWhere($key, $operator = null, $value = null)
|
||||
{
|
||||
if (func_num_args() === 1) {
|
||||
$value = true;
|
||||
|
||||
$operator = '=';
|
||||
}
|
||||
|
||||
if (func_num_args() === 2) {
|
||||
$value = $operator;
|
||||
|
||||
$operator = '=';
|
||||
}
|
||||
|
||||
return function ($item) use ($key, $operator, $value) {
|
||||
$retrieved = data_get($item, $key);
|
||||
|
||||
$strings = array_filter([$retrieved, $value], function ($value) {
|
||||
return is_string($value) || (is_object($value) && method_exists($value, '__toString'));
|
||||
});
|
||||
|
||||
if (count($strings) < 2 && count(array_filter([$retrieved, $value], 'is_object')) == 1) {
|
||||
return in_array($operator, ['!=', '<>', '!==']);
|
||||
}
|
||||
|
||||
switch ($operator) {
|
||||
default:
|
||||
case '=':
|
||||
case '==': return $retrieved == $value;
|
||||
case '!=':
|
||||
case '<>': return $retrieved != $value;
|
||||
case '<': return $retrieved < $value;
|
||||
case '>': return $retrieved > $value;
|
||||
case '<=': return $retrieved <= $value;
|
||||
case '>=': return $retrieved >= $value;
|
||||
case '===': return $retrieved === $value;
|
||||
case '!==': return $retrieved !== $value;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 a value retrieving callback.
|
||||
*
|
||||
* @param callable|string|null $value
|
||||
* @return callable
|
||||
*/
|
||||
protected function valueRetriever($value)
|
||||
{
|
||||
if ($this->useAsCallable($value)) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
return function ($item) use ($value) {
|
||||
return data_get($item, $value);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a function to check an item's equality.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return \Closure
|
||||
*/
|
||||
protected function equality($value)
|
||||
{
|
||||
return function ($item) use ($value) {
|
||||
return $item === $value;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a function using another function, by negating its result.
|
||||
*
|
||||
* @param \Closure $callback
|
||||
* @return \Closure
|
||||
*/
|
||||
protected function negate(Closure $callback)
|
||||
{
|
||||
return function (...$params) use ($callback) {
|
||||
return ! $callback(...$params);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a function that returns what's passed to it.
|
||||
*
|
||||
* @return \Closure
|
||||
*/
|
||||
protected function identity()
|
||||
{
|
||||
return function ($value) {
|
||||
return $value;
|
||||
};
|
||||
}
|
||||
}
|
54
vendor/illuminate/support/Traits/ForwardsCalls.php
vendored
Normal file
54
vendor/illuminate/support/Traits/ForwardsCalls.php
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Traits;
|
||||
|
||||
use BadMethodCallException;
|
||||
use Error;
|
||||
|
||||
trait ForwardsCalls
|
||||
{
|
||||
/**
|
||||
* Forward a method call to the given object.
|
||||
*
|
||||
* @param mixed $object
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
protected function forwardCallTo($object, $method, $parameters)
|
||||
{
|
||||
try {
|
||||
return $object->{$method}(...$parameters);
|
||||
} catch (Error|BadMethodCallException $e) {
|
||||
$pattern = '~^Call to undefined method (?P<class>[^:]+)::(?P<method>[^\(]+)\(\)$~';
|
||||
|
||||
if (! preg_match($pattern, $e->getMessage(), $matches)) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
if ($matches['class'] != get_class($object) ||
|
||||
$matches['method'] != $method) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
static::throwBadMethodCallException($method);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Throw a bad method call exception for the given method.
|
||||
*
|
||||
* @param string $method
|
||||
* @return void
|
||||
*
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
protected static function throwBadMethodCallException($method)
|
||||
{
|
||||
throw new BadMethodCallException(sprintf(
|
||||
'Call to undefined method %s::%s()', static::class, $method
|
||||
));
|
||||
}
|
||||
}
|
34
vendor/illuminate/support/Traits/Localizable.php
vendored
Normal file
34
vendor/illuminate/support/Traits/Localizable.php
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Traits;
|
||||
|
||||
use Illuminate\Container\Container;
|
||||
|
||||
trait Localizable
|
||||
{
|
||||
/**
|
||||
* Run the callback with the given locale.
|
||||
*
|
||||
* @param string $locale
|
||||
* @param \Closure $callback
|
||||
* @return mixed
|
||||
*/
|
||||
public function withLocale($locale, $callback)
|
||||
{
|
||||
if (! $locale) {
|
||||
return $callback();
|
||||
}
|
||||
|
||||
$app = Container::getInstance();
|
||||
|
||||
$original = $app->getLocale();
|
||||
|
||||
try {
|
||||
$app->setLocale($locale);
|
||||
|
||||
return $callback();
|
||||
} finally {
|
||||
$app->setLocale($original);
|
||||
}
|
||||
}
|
||||
}
|
116
vendor/illuminate/support/Traits/Macroable.php
vendored
Normal file
116
vendor/illuminate/support/Traits/Macroable.php
vendored
Normal file
@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Traits;
|
||||
|
||||
use BadMethodCallException;
|
||||
use Closure;
|
||||
use ReflectionClass;
|
||||
use ReflectionMethod;
|
||||
|
||||
trait Macroable
|
||||
{
|
||||
/**
|
||||
* The registered string macros.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $macros = [];
|
||||
|
||||
/**
|
||||
* Register a custom macro.
|
||||
*
|
||||
* @param string $name
|
||||
* @param object|callable $macro
|
||||
* @return void
|
||||
*/
|
||||
public static function macro($name, $macro)
|
||||
{
|
||||
static::$macros[$name] = $macro;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mix another object into the class.
|
||||
*
|
||||
* @param object $mixin
|
||||
* @param bool $replace
|
||||
* @return void
|
||||
*
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public static function mixin($mixin, $replace = true)
|
||||
{
|
||||
$methods = (new ReflectionClass($mixin))->getMethods(
|
||||
ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PROTECTED
|
||||
);
|
||||
|
||||
foreach ($methods as $method) {
|
||||
if ($replace || ! static::hasMacro($method->name)) {
|
||||
$method->setAccessible(true);
|
||||
static::macro($method->name, $method->invoke($mixin));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)) {
|
||||
throw new BadMethodCallException(sprintf(
|
||||
'Method %s::%s does not exist.', static::class, $method
|
||||
));
|
||||
}
|
||||
|
||||
$macro = static::$macros[$method];
|
||||
|
||||
if ($macro instanceof Closure) {
|
||||
$macro = $macro->bindTo(null, static::class);
|
||||
}
|
||||
|
||||
return $macro(...$parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)) {
|
||||
throw new BadMethodCallException(sprintf(
|
||||
'Method %s::%s does not exist.', static::class, $method
|
||||
));
|
||||
}
|
||||
|
||||
$macro = static::$macros[$method];
|
||||
|
||||
if ($macro instanceof Closure) {
|
||||
$macro = $macro->bindTo($this, static::class);
|
||||
}
|
||||
|
||||
return $macro(...$parameters);
|
||||
}
|
||||
}
|
55
vendor/illuminate/support/Traits/ReflectsClosures.php
vendored
Normal file
55
vendor/illuminate/support/Traits/ReflectsClosures.php
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Traits;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Support\Reflector;
|
||||
use ReflectionFunction;
|
||||
use RuntimeException;
|
||||
|
||||
trait ReflectsClosures
|
||||
{
|
||||
/**
|
||||
* Get the class names / types of the parameters of the given Closure.
|
||||
*
|
||||
* @param \Closure $closure
|
||||
* @return array
|
||||
*
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
protected function closureParameterTypes(Closure $closure)
|
||||
{
|
||||
$reflection = new ReflectionFunction($closure);
|
||||
|
||||
return collect($reflection->getParameters())->mapWithKeys(function ($parameter) {
|
||||
if ($parameter->isVariadic()) {
|
||||
return [$parameter->getName() => null];
|
||||
}
|
||||
|
||||
return [$parameter->getName() => Reflector::getParameterClassName($parameter)];
|
||||
})->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the class name of the first parameter of the given Closure.
|
||||
*
|
||||
* @param \Closure $closure
|
||||
* @return string
|
||||
*
|
||||
* @throws \ReflectionException|\RuntimeException
|
||||
*/
|
||||
protected function firstClosureParameterType(Closure $closure)
|
||||
{
|
||||
$types = array_values($this->closureParameterTypes($closure));
|
||||
|
||||
if (! $types) {
|
||||
throw new RuntimeException('The given Closure has no parameters.');
|
||||
}
|
||||
|
||||
if ($types[0] === null) {
|
||||
throw new RuntimeException('The first parameter of the given Closure is missing a type hint.');
|
||||
}
|
||||
|
||||
return $types[0];
|
||||
}
|
||||
}
|
17
vendor/illuminate/support/Traits/Tappable.php
vendored
Normal file
17
vendor/illuminate/support/Traits/Tappable.php
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support\Traits;
|
||||
|
||||
trait Tappable
|
||||
{
|
||||
/**
|
||||
* Call the given Closure with this instance then return the instance.
|
||||
*
|
||||
* @param callable|null $callback
|
||||
* @return mixed
|
||||
*/
|
||||
public function tap($callback = null)
|
||||
{
|
||||
return tap($this, $callback);
|
||||
}
|
||||
}
|
130
vendor/illuminate/support/ViewErrorBag.php
vendored
Normal file
130
vendor/illuminate/support/ViewErrorBag.php
vendored
Normal file
@ -0,0 +1,130 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Support;
|
||||
|
||||
use Countable;
|
||||
use Illuminate\Contracts\Support\MessageBag as MessageBagContract;
|
||||
|
||||
/**
|
||||
* @mixin \Illuminate\Contracts\Support\MessageBag
|
||||
*/
|
||||
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 Arr::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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the default message bag has any messages.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function any()
|
||||
{
|
||||
return $this->count() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of messages in the default bag.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
return $this->getBag('default')->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically call methods on the default bag.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
return $this->getBag('default')->$method(...$parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically access a view error bag.
|
||||
*
|
||||
* @param string $key
|
||||
* @return \Illuminate\Contracts\Support\MessageBag
|
||||
*/
|
||||
public function __get($key)
|
||||
{
|
||||
return $this->getBag($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically set a view error bag.
|
||||
*
|
||||
* @param string $key
|
||||
* @param \Illuminate\Contracts\Support\MessageBag $value
|
||||
* @return void
|
||||
*/
|
||||
public function __set($key, $value)
|
||||
{
|
||||
$this->put($key, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the default bag to its string representation.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return (string) $this->getBag('default');
|
||||
}
|
||||
}
|
53
vendor/illuminate/support/composer.json
vendored
Normal file
53
vendor/illuminate/support/composer.json
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
{
|
||||
"name": "illuminate/support",
|
||||
"description": "The Illuminate Support package.",
|
||||
"license": "MIT",
|
||||
"homepage": "https://laravel.com",
|
||||
"support": {
|
||||
"issues": "https://github.com/laravel/framework/issues",
|
||||
"source": "https://github.com/laravel/framework"
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "Taylor Otwell",
|
||||
"email": "taylor@laravel.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.2.5|^8.0",
|
||||
"ext-json": "*",
|
||||
"ext-mbstring": "*",
|
||||
"doctrine/inflector": "^1.4|^2.0",
|
||||
"illuminate/contracts": "^7.0",
|
||||
"nesbot/carbon": "^2.31",
|
||||
"voku/portable-ascii": "^1.4.8"
|
||||
},
|
||||
"conflict": {
|
||||
"tightenco/collect": "<5.5.33"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Illuminate\\Support\\": ""
|
||||
},
|
||||
"files": [
|
||||
"helpers.php"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "7.x-dev"
|
||||
}
|
||||
},
|
||||
"suggest": {
|
||||
"illuminate/filesystem": "Required to use the composer class (^7.0).",
|
||||
"moontoast/math": "Required to use ordered UUIDs (^1.1).",
|
||||
"ramsey/uuid": "Required to use Str::uuid() (^3.7|^4.0).",
|
||||
"symfony/process": "Required to use the composer class (^5.0).",
|
||||
"symfony/var-dumper": "Required to use the dd function (^5.0).",
|
||||
"vlucas/phpdotenv": "Required to use the Env class and env helper (^4.0)."
|
||||
},
|
||||
"config": {
|
||||
"sort-packages": true
|
||||
},
|
||||
"minimum-stability": "dev"
|
||||
}
|
560
vendor/illuminate/support/helpers.php
vendored
Executable file
560
vendor/illuminate/support/helpers.php
vendored
Executable file
@ -0,0 +1,560 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Contracts\Support\DeferringDisplayableValue;
|
||||
use Illuminate\Contracts\Support\Htmlable;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Env;
|
||||
use Illuminate\Support\HigherOrderTapProxy;
|
||||
use Illuminate\Support\Optional;
|
||||
|
||||
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] = Arr::pull($array, $key);
|
||||
}
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('blank')) {
|
||||
/**
|
||||
* Determine if the given value is "blank".
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
function blank($value)
|
||||
{
|
||||
if (is_null($value)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (is_string($value)) {
|
||||
return trim($value) === '';
|
||||
}
|
||||
|
||||
if (is_numeric($value) || is_bool($value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($value instanceof Countable) {
|
||||
return count($value) === 0;
|
||||
}
|
||||
|
||||
return empty($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 parent classes and trait of their traits.
|
||||
*
|
||||
* @param object|string $class
|
||||
* @return array
|
||||
*/
|
||||
function class_uses_recursive($class)
|
||||
{
|
||||
if (is_object($class)) {
|
||||
$class = get_class($class);
|
||||
}
|
||||
|
||||
$results = [];
|
||||
|
||||
foreach (array_reverse(class_parents($class)) + [$class => $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_fill')) {
|
||||
/**
|
||||
* Fill in data where it's missing.
|
||||
*
|
||||
* @param mixed $target
|
||||
* @param string|array $key
|
||||
* @param mixed $value
|
||||
* @return mixed
|
||||
*/
|
||||
function data_fill(&$target, $key, $value)
|
||||
{
|
||||
return data_set($target, $key, $value, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('data_get')) {
|
||||
/**
|
||||
* Get an item from an array or object using "dot" notation.
|
||||
*
|
||||
* @param mixed $target
|
||||
* @param string|array|int|null $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
function data_get($target, $key, $default = null)
|
||||
{
|
||||
if (is_null($key)) {
|
||||
return $target;
|
||||
}
|
||||
|
||||
$key = is_array($key) ? $key : explode('.', $key);
|
||||
|
||||
foreach ($key as $i => $segment) {
|
||||
unset($key[$i]);
|
||||
|
||||
if (is_null($segment)) {
|
||||
return $target;
|
||||
}
|
||||
|
||||
if ($segment === '*') {
|
||||
if ($target instanceof Collection) {
|
||||
$target = $target->all();
|
||||
} elseif (! is_array($target)) {
|
||||
return value($default);
|
||||
}
|
||||
|
||||
$result = [];
|
||||
|
||||
foreach ($target as $item) {
|
||||
$result[] = data_get($item, $key);
|
||||
}
|
||||
|
||||
return in_array('*', $key) ? Arr::collapse($result) : $result;
|
||||
}
|
||||
|
||||
if (Arr::accessible($target) && Arr::exists($target, $segment)) {
|
||||
$target = $target[$segment];
|
||||
} elseif (is_object($target) && isset($target->{$segment})) {
|
||||
$target = $target->{$segment};
|
||||
} else {
|
||||
return value($default);
|
||||
}
|
||||
}
|
||||
|
||||
return $target;
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('data_set')) {
|
||||
/**
|
||||
* Set an item on an array or object using dot notation.
|
||||
*
|
||||
* @param mixed $target
|
||||
* @param string|array $key
|
||||
* @param mixed $value
|
||||
* @param bool $overwrite
|
||||
* @return mixed
|
||||
*/
|
||||
function data_set(&$target, $key, $value, $overwrite = true)
|
||||
{
|
||||
$segments = is_array($key) ? $key : explode('.', $key);
|
||||
|
||||
if (($segment = array_shift($segments)) === '*') {
|
||||
if (! Arr::accessible($target)) {
|
||||
$target = [];
|
||||
}
|
||||
|
||||
if ($segments) {
|
||||
foreach ($target as &$inner) {
|
||||
data_set($inner, $segments, $value, $overwrite);
|
||||
}
|
||||
} elseif ($overwrite) {
|
||||
foreach ($target as &$inner) {
|
||||
$inner = $value;
|
||||
}
|
||||
}
|
||||
} elseif (Arr::accessible($target)) {
|
||||
if ($segments) {
|
||||
if (! Arr::exists($target, $segment)) {
|
||||
$target[$segment] = [];
|
||||
}
|
||||
|
||||
data_set($target[$segment], $segments, $value, $overwrite);
|
||||
} elseif ($overwrite || ! Arr::exists($target, $segment)) {
|
||||
$target[$segment] = $value;
|
||||
}
|
||||
} elseif (is_object($target)) {
|
||||
if ($segments) {
|
||||
if (! isset($target->{$segment})) {
|
||||
$target->{$segment} = [];
|
||||
}
|
||||
|
||||
data_set($target->{$segment}, $segments, $value, $overwrite);
|
||||
} elseif ($overwrite || ! isset($target->{$segment})) {
|
||||
$target->{$segment} = $value;
|
||||
}
|
||||
} else {
|
||||
$target = [];
|
||||
|
||||
if ($segments) {
|
||||
data_set($target[$segment], $segments, $value, $overwrite);
|
||||
} elseif ($overwrite) {
|
||||
$target[$segment] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $target;
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('e')) {
|
||||
/**
|
||||
* Encode HTML special characters in a string.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Support\DeferringDisplayableValue|\Illuminate\Contracts\Support\Htmlable|string $value
|
||||
* @param bool $doubleEncode
|
||||
* @return string
|
||||
*/
|
||||
function e($value, $doubleEncode = true)
|
||||
{
|
||||
if ($value instanceof DeferringDisplayableValue) {
|
||||
$value = $value->resolveDisplayableValue();
|
||||
}
|
||||
|
||||
if ($value instanceof Htmlable) {
|
||||
return $value->toHtml();
|
||||
}
|
||||
|
||||
return htmlspecialchars($value, ENT_QUOTES, 'UTF-8', $doubleEncode);
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('env')) {
|
||||
/**
|
||||
* Gets the value of an environment variable.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
function env($key, $default = null)
|
||||
{
|
||||
return Env::get($key, $default);
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('filled')) {
|
||||
/**
|
||||
* Determine if a value is "filled".
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
function filled($value)
|
||||
{
|
||||
return ! blank($value);
|
||||
}
|
||||
}
|
||||
|
||||
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|null $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('optional')) {
|
||||
/**
|
||||
* Provide access to optional objects.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param callable|null $callback
|
||||
* @return mixed
|
||||
*/
|
||||
function optional($value = null, callable $callback = null)
|
||||
{
|
||||
if (is_null($callback)) {
|
||||
return new Optional($value);
|
||||
} elseif (! is_null($value)) {
|
||||
return $callback($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('preg_replace_array')) {
|
||||
/**
|
||||
* 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_array($pattern, array $replacements, $subject)
|
||||
{
|
||||
return preg_replace_callback($pattern, function () use (&$replacements) {
|
||||
foreach ($replacements as $key => $value) {
|
||||
return array_shift($replacements);
|
||||
}
|
||||
}, $subject);
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('retry')) {
|
||||
/**
|
||||
* Retry an operation a given number of times.
|
||||
*
|
||||
* @param int $times
|
||||
* @param callable $callback
|
||||
* @param int $sleep
|
||||
* @param callable|null $when
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
function retry($times, callable $callback, $sleep = 0, $when = null)
|
||||
{
|
||||
$attempts = 0;
|
||||
|
||||
beginning:
|
||||
$attempts++;
|
||||
$times--;
|
||||
|
||||
try {
|
||||
return $callback($attempts);
|
||||
} catch (Exception $e) {
|
||||
if ($times < 1 || ($when && ! $when($e))) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
if ($sleep) {
|
||||
usleep($sleep * 1000);
|
||||
}
|
||||
|
||||
goto beginning;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('tap')) {
|
||||
/**
|
||||
* Call the given Closure with the given value then return the value.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param callable|null $callback
|
||||
* @return mixed
|
||||
*/
|
||||
function tap($value, $callback = null)
|
||||
{
|
||||
if (is_null($callback)) {
|
||||
return new HigherOrderTapProxy($value);
|
||||
}
|
||||
|
||||
$callback($value);
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('throw_if')) {
|
||||
/**
|
||||
* Throw the given exception if the given condition is true.
|
||||
*
|
||||
* @param mixed $condition
|
||||
* @param \Throwable|string $exception
|
||||
* @param array ...$parameters
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Throwable
|
||||
*/
|
||||
function throw_if($condition, $exception, ...$parameters)
|
||||
{
|
||||
if ($condition) {
|
||||
throw (is_string($exception) ? new $exception(...$parameters) : $exception);
|
||||
}
|
||||
|
||||
return $condition;
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('throw_unless')) {
|
||||
/**
|
||||
* Throw the given exception unless the given condition is true.
|
||||
*
|
||||
* @param mixed $condition
|
||||
* @param \Throwable|string $exception
|
||||
* @param array ...$parameters
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Throwable
|
||||
*/
|
||||
function throw_unless($condition, $exception, ...$parameters)
|
||||
{
|
||||
if (! $condition) {
|
||||
throw (is_string($exception) ? new $exception(...$parameters) : $exception);
|
||||
}
|
||||
|
||||
return $condition;
|
||||
}
|
||||
}
|
||||
|
||||
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('transform')) {
|
||||
/**
|
||||
* Transform the given value if it is present.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param callable $callback
|
||||
* @param mixed $default
|
||||
* @return mixed|null
|
||||
*/
|
||||
function transform($value, callable $callback, $default = null)
|
||||
{
|
||||
if (filled($value)) {
|
||||
return $callback($value);
|
||||
}
|
||||
|
||||
if (is_callable($default)) {
|
||||
return $default($value);
|
||||
}
|
||||
|
||||
return $default;
|
||||
}
|
||||
}
|
||||
|
||||
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('windows_os')) {
|
||||
/**
|
||||
* Determine whether the current environment is Windows based.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function windows_os()
|
||||
{
|
||||
return PHP_OS_FAMILY === 'Windows';
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('with')) {
|
||||
/**
|
||||
* Return the given value, optionally passed through the given callback.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param callable|null $callback
|
||||
* @return mixed
|
||||
*/
|
||||
function with($value, callable $callback = null)
|
||||
{
|
||||
return is_null($callback) ? $value : $callback($value);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user