Mail Parser: Completely remove Webklex IMAP and all dependcies

This commit is contained in:
johnnyq
2026-06-24 13:39:07 -04:00
parent 63ad3256ee
commit 171a0d38f8
779 changed files with 6408 additions and 82971 deletions

View File

@@ -1,688 +0,0 @@
<?php
namespace Illuminate\Pagination;
use ArrayAccess;
use Closure;
use Exception;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\Pivot;
use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use Illuminate\Support\Traits\ForwardsCalls;
use Illuminate\Support\Traits\Tappable;
use Illuminate\Support\Traits\TransformsToResourceCollection;
use Stringable;
use Traversable;
/**
* @template TKey of array-key
*
* @template-covariant TValue
*
* @mixin \Illuminate\Support\Collection<TKey, TValue>
*/
abstract class AbstractCursorPaginator implements Htmlable, Stringable
{
use ForwardsCalls, Tappable, TransformsToResourceCollection;
/**
* All of the items being paginated.
*
* @var \Illuminate\Support\Collection<TKey, TValue>
*/
protected $items;
/**
* The number of items to be shown per page.
*
* @var int
*/
protected $perPage;
/**
* The base path to assign to all URLs.
*
* @var string
*/
protected $path = '/';
/**
* The query parameters to add to all URLs.
*
* @var array
*/
protected $query = [];
/**
* The URL fragment to add to all URLs.
*
* @var string|null
*/
protected $fragment;
/**
* The cursor string variable used to store the page.
*
* @var string
*/
protected $cursorName = 'cursor';
/**
* The current cursor.
*
* @var \Illuminate\Pagination\Cursor|null
*/
protected $cursor;
/**
* The paginator parameters for the cursor.
*
* @var array
*/
protected $parameters;
/**
* The paginator options.
*
* @var array
*/
protected $options;
/**
* The current cursor resolver callback.
*
* @var \Closure
*/
protected static $currentCursorResolver;
/**
* Get the URL for a given cursor.
*
* @param \Illuminate\Pagination\Cursor|null $cursor
* @return string
*/
public function url($cursor)
{
// If we have any extra query string key / value pairs that need to be added
// onto the URL, we will put them in query string form and then attach it
// to the URL. This allows for extra information like sortings storage.
$parameters = is_null($cursor) ? [] : [$this->cursorName => $cursor->encode()];
if (count($this->query) > 0) {
$parameters = array_merge($this->query, $parameters);
}
return $this->path()
.(str_contains($this->path(), '?') ? '&' : '?')
.Arr::query($parameters)
.$this->buildFragment();
}
/**
* Get the URL for the previous page.
*
* @return string|null
*/
public function previousPageUrl()
{
if (is_null($previousCursor = $this->previousCursor())) {
return null;
}
return $this->url($previousCursor);
}
/**
* The URL for the next page, or null.
*
* @return string|null
*/
public function nextPageUrl()
{
if (is_null($nextCursor = $this->nextCursor())) {
return null;
}
return $this->url($nextCursor);
}
/**
* Get the "cursor" that points to the previous set of items.
*
* @return \Illuminate\Pagination\Cursor|null
*/
public function previousCursor()
{
if (is_null($this->cursor) ||
($this->cursor->pointsToPreviousItems() && ! $this->hasMore)) {
return null;
}
if ($this->items->isEmpty()) {
return null;
}
return $this->getCursorForItem($this->items->first(), false);
}
/**
* Get the "cursor" that points to the next set of items.
*
* @return \Illuminate\Pagination\Cursor|null
*/
public function nextCursor()
{
if ((is_null($this->cursor) && ! $this->hasMore) ||
(! is_null($this->cursor) && $this->cursor->pointsToNextItems() && ! $this->hasMore)) {
return null;
}
if ($this->items->isEmpty()) {
return null;
}
return $this->getCursorForItem($this->items->last(), true);
}
/**
* Get a cursor instance for the given item.
*
* @param \ArrayAccess|\stdClass $item
* @param bool $isNext
* @return \Illuminate\Pagination\Cursor
*/
public function getCursorForItem($item, $isNext = true)
{
return new Cursor($this->getParametersForItem($item), $isNext);
}
/**
* Get the cursor parameters for a given object.
*
* @param \ArrayAccess|\stdClass $item
* @return array
*
* @throws \Exception
*/
public function getParametersForItem($item)
{
return (new Collection($this->parameters))
->filter()
->flip()
->map(function ($_, $parameterName) use ($item) {
if ($item instanceof JsonResource) {
$item = $item->resource;
}
if ($item instanceof Model &&
! is_null($parameter = $this->getPivotParameterForItem($item, $parameterName))) {
return $parameter;
} elseif ($item instanceof ArrayAccess || is_array($item)) {
return $this->ensureParameterIsPrimitive(
$item[$parameterName] ?? $item[Str::afterLast($parameterName, '.')]
);
} elseif (is_object($item)) {
return $this->ensureParameterIsPrimitive(
$item->{$parameterName} ?? $item->{Str::afterLast($parameterName, '.')}
);
}
throw new Exception('Only arrays and objects are supported when cursor paginating items.');
})->toArray();
}
/**
* Get the cursor parameter value from a pivot model if applicable.
*
* @param \ArrayAccess|\stdClass $item
* @param string $parameterName
* @return string|null
*/
protected function getPivotParameterForItem($item, $parameterName)
{
$table = Str::beforeLast($parameterName, '.');
foreach ($item->getRelations() as $relation) {
if ($relation instanceof Pivot && $relation->getTable() === $table) {
return $this->ensureParameterIsPrimitive(
$relation->getAttribute(Str::afterLast($parameterName, '.'))
);
}
}
}
/**
* Ensure the parameter is a primitive type.
*
* This can resolve issues that arise the developer uses a value object for an attribute.
*
* @param mixed $parameter
* @return mixed
*/
protected function ensureParameterIsPrimitive($parameter)
{
return is_object($parameter) && method_exists($parameter, '__toString')
? (string) $parameter
: $parameter;
}
/**
* Get / set the URL fragment to be appended to URLs.
*
* @param string|null $fragment
* @return $this|string|null
*/
public function fragment($fragment = null)
{
if (is_null($fragment)) {
return $this->fragment;
}
$this->fragment = $fragment;
return $this;
}
/**
* Add a set of query string values to the paginator.
*
* @param array|string|null $key
* @param string|null $value
* @return $this
*/
public function appends($key, $value = null)
{
if (is_null($key)) {
return $this;
}
if (is_array($key)) {
return $this->appendArray($key);
}
return $this->addQuery($key, $value);
}
/**
* Add an array of query string values.
*
* @param array $keys
* @return $this
*/
protected function appendArray(array $keys)
{
foreach ($keys as $key => $value) {
$this->addQuery($key, $value);
}
return $this;
}
/**
* Add all current query string values to the paginator.
*
* @return $this
*/
public function withQueryString()
{
if (! is_null($query = Paginator::resolveQueryString())) {
return $this->appends($query);
}
return $this;
}
/**
* Add a query string value to the paginator.
*
* @param string $key
* @param string $value
* @return $this
*/
protected function addQuery($key, $value)
{
if ($key !== $this->cursorName) {
$this->query[$key] = $value;
}
return $this;
}
/**
* Build the full fragment portion of a URL.
*
* @return string
*/
protected function buildFragment()
{
return $this->fragment ? '#'.$this->fragment : '';
}
/**
* Load a set of relationships onto the mixed relationship collection.
*
* @param string $relation
* @param array $relations
* @return $this
*/
public function loadMorph($relation, $relations)
{
$this->getCollection()->loadMorph($relation, $relations);
return $this;
}
/**
* Load a set of relationship counts onto the mixed relationship collection.
*
* @param string $relation
* @param array $relations
* @return $this
*/
public function loadMorphCount($relation, $relations)
{
$this->getCollection()->loadMorphCount($relation, $relations);
return $this;
}
/**
* Get the slice of items being paginated.
*
* @return array<TKey, TValue>
*/
public function items()
{
return $this->items->all();
}
/**
* Transform each item in the slice of items using a callback.
*
* @template TThroughValue
*
* @param callable(TValue, TKey): TThroughValue $callback
* @return $this
*
* @phpstan-this-out static<TKey, TThroughValue>
*/
public function through(callable $callback)
{
$this->items->transform($callback);
return $this;
}
/**
* Get the number of items shown per page.
*
* @return int
*/
public function perPage()
{
return $this->perPage;
}
/**
* Get the current cursor being paginated.
*
* @return \Illuminate\Pagination\Cursor|null
*/
public function cursor()
{
return $this->cursor;
}
/**
* Get the query string variable used to store the cursor.
*
* @return string
*/
public function getCursorName()
{
return $this->cursorName;
}
/**
* Set the query string variable used to store the cursor.
*
* @param string $name
* @return $this
*/
public function setCursorName($name)
{
$this->cursorName = $name;
return $this;
}
/**
* Set the base path to assign to all URLs.
*
* @param string $path
* @return $this
*/
public function withPath($path)
{
return $this->setPath($path);
}
/**
* Set the base path to assign to all URLs.
*
* @param string $path
* @return $this
*/
public function setPath($path)
{
$this->path = $path;
return $this;
}
/**
* Get the base path for paginator generated URLs.
*
* @return string|null
*/
public function path()
{
return $this->path;
}
/**
* Resolve the current cursor or return the default value.
*
* @param string $cursorName
* @param \Illuminate\Pagination\Cursor|null $default
* @return \Illuminate\Pagination\Cursor|null
*/
public static function resolveCurrentCursor($cursorName = 'cursor', $default = null)
{
if (isset(static::$currentCursorResolver)) {
return call_user_func(static::$currentCursorResolver, $cursorName);
}
return $default;
}
/**
* Set the current cursor resolver callback.
*
* @param \Closure $resolver
* @return void
*/
public static function currentCursorResolver(Closure $resolver)
{
static::$currentCursorResolver = $resolver;
}
/**
* Get an instance of the view factory from the resolver.
*
* @return \Illuminate\Contracts\View\Factory
*/
public static function viewFactory()
{
return Paginator::viewFactory();
}
/**
* Get an iterator for the items.
*
* @return \ArrayIterator<TKey, TValue>
*/
public function getIterator(): Traversable
{
return $this->items->getIterator();
}
/**
* Determine if the list of items is empty.
*
* @return bool
*/
public function isEmpty()
{
return $this->items->isEmpty();
}
/**
* Determine if the list of items is not empty.
*
* @return bool
*/
public function isNotEmpty()
{
return $this->items->isNotEmpty();
}
/**
* Get the number of items for the current page.
*
* @return int
*/
public function count(): int
{
return $this->items->count();
}
/**
* Get the paginator's underlying collection.
*
* @return \Illuminate\Support\Collection<TKey, TValue>
*/
public function getCollection()
{
return $this->items;
}
/**
* Set the paginator's underlying collection.
*
* @template TSetKey of array-key
* @template TSetValue
*
* @param \Illuminate\Support\Collection<TSetKey, TSetValue> $collection
* @return $this
*
* @phpstan-this-out static<TSetKey, TSetValue>
*/
public function setCollection(Collection $collection)
{
$this->items = $collection;
return $this;
}
/**
* Get the paginator options.
*
* @return array
*/
public function getOptions()
{
return $this->options;
}
/**
* Determine if the given item exists.
*
* @param TKey $key
* @return bool
*/
public function offsetExists($key): bool
{
return $this->items->has($key);
}
/**
* Get the item at the given offset.
*
* @param TKey $key
* @return TValue|null
*/
public function offsetGet($key): mixed
{
return $this->items->get($key);
}
/**
* Set the item at the given offset.
*
* @param TKey|null $key
* @param TValue $value
* @return void
*/
public function offsetSet($key, $value): void
{
$this->items->put($key, $value);
}
/**
* Unset the item at the given key.
*
* @param TKey $key
* @return void
*/
public function offsetUnset($key): void
{
$this->items->forget($key);
}
/**
* Render the contents of the paginator to HTML.
*
* @return string
*/
public function toHtml()
{
return (string) $this->render();
}
/**
* Make dynamic calls into the collection.
*
* @param string $method
* @param array $parameters
* @return mixed
*/
public function __call($method, $parameters)
{
return $this->forwardCallTo($this->getCollection(), $method, $parameters);
}
/**
* Render the contents of the paginator when casting to a string.
*
* @return string
*/
public function __toString()
{
return (string) $this->render();
}
}

View File

@@ -1,830 +0,0 @@
<?php
namespace Illuminate\Pagination;
use Closure;
use Illuminate\Contracts\Support\CanBeEscapedWhenCastToString;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use Illuminate\Support\Traits\ForwardsCalls;
use Illuminate\Support\Traits\Tappable;
use Illuminate\Support\Traits\TransformsToResourceCollection;
use Stringable;
use Traversable;
/**
* @template TKey of array-key
*
* @template-covariant TValue
*
* @mixin \Illuminate\Support\Collection<TKey, TValue>
*/
abstract class AbstractPaginator implements CanBeEscapedWhenCastToString, Htmlable, Stringable
{
use ForwardsCalls, Tappable, TransformsToResourceCollection;
/**
* All of the items being paginated.
*
* @var \Illuminate\Support\Collection<TKey, TValue>
*/
protected $items;
/**
* The number of items to be shown per page.
*
* @var int
*/
protected $perPage;
/**
* The current page being "viewed".
*
* @var int
*/
protected $currentPage;
/**
* The base path to assign to all URLs.
*
* @var string
*/
protected $path = '/';
/**
* The query parameters to add to all URLs.
*
* @var array
*/
protected $query = [];
/**
* The URL fragment to add to all URLs.
*
* @var string|null
*/
protected $fragment;
/**
* The query string variable used to store the page.
*
* @var string
*/
protected $pageName = 'page';
/**
* Indicates that the paginator's string representation should be escaped when __toString is invoked.
*
* @var bool
*/
protected $escapeWhenCastingToString = false;
/**
* The number of links to display on each side of current page link.
*
* @var int
*/
public $onEachSide = 3;
/**
* The paginator options.
*
* @var array
*/
protected $options;
/**
* The current path resolver callback.
*
* @var \Closure
*/
protected static $currentPathResolver;
/**
* The current page resolver callback.
*
* @var \Closure
*/
protected static $currentPageResolver;
/**
* The query string resolver callback.
*
* @var \Closure
*/
protected static $queryStringResolver;
/**
* The view factory resolver callback.
*
* @var \Closure
*/
protected static $viewFactoryResolver;
/**
* The default pagination view.
*
* @var string
*/
public static $defaultView = 'pagination::tailwind';
/**
* The default "simple" pagination view.
*
* @var string
*/
public static $defaultSimpleView = 'pagination::simple-tailwind';
/**
* Determine if the given value is a valid page number.
*
* @param int $page
* @return bool
*/
protected function isValidPageNumber($page)
{
return $page >= 1 && filter_var($page, FILTER_VALIDATE_INT) !== false;
}
/**
* Get the URL for the previous page.
*
* @return string|null
*/
public function previousPageUrl()
{
if ($this->currentPage() > 1) {
return $this->url($this->currentPage() - 1);
}
}
/**
* Create a range of pagination URLs.
*
* @param int $start
* @param int $end
* @return array
*/
public function getUrlRange($start, $end)
{
return Collection::range($start, $end)
->mapWithKeys(fn ($page) => [$page => $this->url($page)])
->all();
}
/**
* Get the URL for a given page number.
*
* @param int $page
* @return string
*/
public function url($page)
{
if ($page <= 0) {
$page = 1;
}
// If we have any extra query string key / value pairs that need to be added
// onto the URL, we will put them in query string form and then attach it
// to the URL. This allows for extra information like sortings storage.
$parameters = [$this->pageName => $page];
if (count($this->query) > 0) {
$parameters = array_merge($this->query, $parameters);
}
return $this->path()
.(str_contains($this->path(), '?') ? '&' : '?')
.Arr::query($parameters)
.$this->buildFragment();
}
/**
* Get / set the URL fragment to be appended to URLs.
*
* @param string|null $fragment
* @return $this|string|null
*/
public function fragment($fragment = null)
{
if (is_null($fragment)) {
return $this->fragment;
}
$this->fragment = $fragment;
return $this;
}
/**
* Add a set of query string values to the paginator.
*
* @param array|string|null $key
* @param string|null $value
* @return $this
*/
public function appends($key, $value = null)
{
if (is_null($key)) {
return $this;
}
if (is_array($key)) {
return $this->appendArray($key);
}
return $this->addQuery($key, $value);
}
/**
* Add an array of query string values.
*
* @param array $keys
* @return $this
*/
protected function appendArray(array $keys)
{
foreach ($keys as $key => $value) {
$this->addQuery($key, $value);
}
return $this;
}
/**
* Add all current query string values to the paginator.
*
* @return $this
*/
public function withQueryString()
{
if (isset(static::$queryStringResolver)) {
return $this->appends(call_user_func(static::$queryStringResolver));
}
return $this;
}
/**
* Add a query string value to the paginator.
*
* @param string $key
* @param string $value
* @return $this
*/
protected function addQuery($key, $value)
{
if ($key !== $this->pageName) {
$this->query[$key] = $value;
}
return $this;
}
/**
* Build the full fragment portion of a URL.
*
* @return string
*/
protected function buildFragment()
{
return $this->fragment ? '#'.$this->fragment : '';
}
/**
* Load a set of relationships onto the mixed relationship collection.
*
* @param string $relation
* @param array $relations
* @return $this
*/
public function loadMorph($relation, $relations)
{
$this->getCollection()->loadMorph($relation, $relations);
return $this;
}
/**
* Load a set of relationship counts onto the mixed relationship collection.
*
* @param string $relation
* @param array $relations
* @return $this
*/
public function loadMorphCount($relation, $relations)
{
$this->getCollection()->loadMorphCount($relation, $relations);
return $this;
}
/**
* Get the slice of items being paginated.
*
* @return array<TKey, TValue>
*/
public function items()
{
return $this->items->all();
}
/**
* Get the number of the first item in the slice.
*
* @return int|null
*/
public function firstItem()
{
return count($this->items) > 0 ? ($this->currentPage - 1) * $this->perPage + 1 : null;
}
/**
* Get the number of the last item in the slice.
*
* @return int|null
*/
public function lastItem()
{
return count($this->items) > 0 ? $this->firstItem() + $this->count() - 1 : null;
}
/**
* Transform each item in the slice of items using a callback.
*
* @template TMapValue
*
* @param callable(TValue, TKey): TMapValue $callback
* @return $this
*
* @phpstan-this-out static<TKey, TMapValue>
*/
public function through(callable $callback)
{
$this->items->transform($callback);
return $this;
}
/**
* Get the number of items shown per page.
*
* @return int
*/
public function perPage()
{
return $this->perPage;
}
/**
* Determine if there are enough items to split into multiple pages.
*
* @return bool
*/
public function hasPages()
{
return $this->currentPage() != 1 || $this->hasMorePages();
}
/**
* Determine if the paginator is on the first page.
*
* @return bool
*/
public function onFirstPage()
{
return $this->currentPage() <= 1;
}
/**
* Determine if the paginator is on the last page.
*
* @return bool
*/
public function onLastPage()
{
return ! $this->hasMorePages();
}
/**
* Get the current page.
*
* @return int
*/
public function currentPage()
{
return $this->currentPage;
}
/**
* Get the query string variable used to store the page.
*
* @return string
*/
public function getPageName()
{
return $this->pageName;
}
/**
* Set the query string variable used to store the page.
*
* @param string $name
* @return $this
*/
public function setPageName($name)
{
$this->pageName = $name;
return $this;
}
/**
* Set the base path to assign to all URLs.
*
* @param string $path
* @return $this
*/
public function withPath($path)
{
return $this->setPath($path);
}
/**
* Set the base path to assign to all URLs.
*
* @param string $path
* @return $this
*/
public function setPath($path)
{
$this->path = $path;
return $this;
}
/**
* Set the number of links to display on each side of current page link.
*
* @param int $count
* @return $this
*/
public function onEachSide($count)
{
$this->onEachSide = $count;
return $this;
}
/**
* Get the base path for paginator generated URLs.
*
* @return string|null
*/
public function path()
{
return $this->path;
}
/**
* Resolve the current request path or return the default value.
*
* @param string $default
* @return string
*/
public static function resolveCurrentPath($default = '/')
{
if (isset(static::$currentPathResolver)) {
return call_user_func(static::$currentPathResolver);
}
return $default;
}
/**
* Set the current request path resolver callback.
*
* @param \Closure $resolver
* @return void
*/
public static function currentPathResolver(Closure $resolver)
{
static::$currentPathResolver = $resolver;
}
/**
* Resolve the current page or return the default value.
*
* @param string $pageName
* @param int $default
* @return int
*/
public static function resolveCurrentPage($pageName = 'page', $default = 1)
{
if (isset(static::$currentPageResolver)) {
return (int) call_user_func(static::$currentPageResolver, $pageName);
}
return $default;
}
/**
* Set the current page resolver callback.
*
* @param \Closure $resolver
* @return void
*/
public static function currentPageResolver(Closure $resolver)
{
static::$currentPageResolver = $resolver;
}
/**
* Resolve the query string or return the default value.
*
* @param string|array|null $default
* @return string
*/
public static function resolveQueryString($default = null)
{
if (isset(static::$queryStringResolver)) {
return (static::$queryStringResolver)();
}
return $default;
}
/**
* Set with query string resolver callback.
*
* @param \Closure $resolver
* @return void
*/
public static function queryStringResolver(Closure $resolver)
{
static::$queryStringResolver = $resolver;
}
/**
* Get an instance of the view factory from the resolver.
*
* @return \Illuminate\Contracts\View\Factory
*/
public static function viewFactory()
{
return call_user_func(static::$viewFactoryResolver);
}
/**
* Set the view factory resolver callback.
*
* @param \Closure $resolver
* @return void
*/
public static function viewFactoryResolver(Closure $resolver)
{
static::$viewFactoryResolver = $resolver;
}
/**
* Set the default pagination view.
*
* @param string $view
* @return void
*/
public static function defaultView($view)
{
static::$defaultView = $view;
}
/**
* Set the default "simple" pagination view.
*
* @param string $view
* @return void
*/
public static function defaultSimpleView($view)
{
static::$defaultSimpleView = $view;
}
/**
* Indicate that Tailwind styling should be used for generated links.
*
* @return void
*/
public static function useTailwind()
{
static::defaultView('pagination::tailwind');
static::defaultSimpleView('pagination::simple-tailwind');
}
/**
* Indicate that Bootstrap 4 styling should be used for generated links.
*
* @return void
*/
public static function useBootstrap()
{
static::useBootstrapFour();
}
/**
* Indicate that Bootstrap 3 styling should be used for generated links.
*
* @return void
*/
public static function useBootstrapThree()
{
static::defaultView('pagination::default');
static::defaultSimpleView('pagination::simple-default');
}
/**
* Indicate that Bootstrap 4 styling should be used for generated links.
*
* @return void
*/
public static function useBootstrapFour()
{
static::defaultView('pagination::bootstrap-4');
static::defaultSimpleView('pagination::simple-bootstrap-4');
}
/**
* Indicate that Bootstrap 5 styling should be used for generated links.
*
* @return void
*/
public static function useBootstrapFive()
{
static::defaultView('pagination::bootstrap-5');
static::defaultSimpleView('pagination::simple-bootstrap-5');
}
/**
* Get an iterator for the items.
*
* @return \ArrayIterator<TKey, TValue>
*/
public function getIterator(): Traversable
{
return $this->items->getIterator();
}
/**
* Determine if the list of items is empty.
*
* @return bool
*/
public function isEmpty()
{
return $this->items->isEmpty();
}
/**
* Determine if the list of items is not empty.
*
* @return bool
*/
public function isNotEmpty()
{
return $this->items->isNotEmpty();
}
/**
* Get the number of items for the current page.
*
* @return int
*/
public function count(): int
{
return $this->items->count();
}
/**
* Get the paginator's underlying collection.
*
* @return \Illuminate\Support\Collection<TKey, TValue>
*/
public function getCollection()
{
return $this->items;
}
/**
* Set the paginator's underlying collection.
*
* @param \Illuminate\Support\Collection<TKey, TValue> $collection
* @return $this
*/
public function setCollection(Collection $collection)
{
$this->items = $collection;
return $this;
}
/**
* Get the paginator options.
*
* @return array
*/
public function getOptions()
{
return $this->options;
}
/**
* Determine if the given item exists.
*
* @param TKey $key
* @return bool
*/
public function offsetExists($key): bool
{
return $this->items->has($key);
}
/**
* Get the item at the given offset.
*
* @param TKey $key
* @return TValue|null
*/
public function offsetGet($key): mixed
{
return $this->items->get($key);
}
/**
* Set the item at the given offset.
*
* @param TKey|null $key
* @param TValue $value
* @return void
*/
public function offsetSet($key, $value): void
{
$this->items->put($key, $value);
}
/**
* Unset the item at the given key.
*
* @param TKey $key
* @return void
*/
public function offsetUnset($key): void
{
$this->items->forget($key);
}
/**
* Render the contents of the paginator to HTML.
*
* @return string
*/
public function toHtml()
{
return (string) $this->render();
}
/**
* Make dynamic calls into the collection.
*
* @param string $method
* @param array $parameters
* @return mixed
*/
public function __call($method, $parameters)
{
return $this->forwardCallTo($this->getCollection(), $method, $parameters);
}
/**
* Render the contents of the paginator when casting to a string.
*
* @return string
*/
public function __toString()
{
return $this->escapeWhenCastingToString
? e((string) $this->render())
: (string) $this->render();
}
/**
* Indicate that the paginator's string representation should be escaped when __toString is invoked.
*
* @param bool $escape
* @return $this
*/
public function escapeWhenCastingToString($escape = true)
{
$this->escapeWhenCastingToString = $escape;
return $this;
}
}

View File

@@ -1,134 +0,0 @@
<?php
namespace Illuminate\Pagination;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Support\Collection;
use UnexpectedValueException;
/** @implements Arrayable<array-key, mixed> */
class Cursor implements Arrayable
{
/**
* The parameters associated with the cursor.
*
* @var array
*/
protected $parameters;
/**
* Determine whether the cursor points to the next or previous set of items.
*
* @var bool
*/
protected $pointsToNextItems;
/**
* Create a new cursor instance.
*
* @param array $parameters
* @param bool $pointsToNextItems
*/
public function __construct(array $parameters, $pointsToNextItems = true)
{
$this->parameters = $parameters;
$this->pointsToNextItems = $pointsToNextItems;
}
/**
* Get the given parameter from the cursor.
*
* @param string $parameterName
* @return string|null
*
* @throws \UnexpectedValueException
*/
public function parameter(string $parameterName)
{
if (! array_key_exists($parameterName, $this->parameters)) {
throw new UnexpectedValueException("Unable to find parameter [{$parameterName}] in pagination item.");
}
return $this->parameters[$parameterName];
}
/**
* Get the given parameters from the cursor.
*
* @param array $parameterNames
* @return array
*/
public function parameters(array $parameterNames)
{
return (new Collection($parameterNames))
->map(fn ($parameterName) => $this->parameter($parameterName))
->toArray();
}
/**
* Determine whether the cursor points to the next set of items.
*
* @return bool
*/
public function pointsToNextItems()
{
return $this->pointsToNextItems;
}
/**
* Determine whether the cursor points to the previous set of items.
*
* @return bool
*/
public function pointsToPreviousItems()
{
return ! $this->pointsToNextItems;
}
/**
* Get the array representation of the cursor.
*
* @return array
*/
public function toArray()
{
return array_merge($this->parameters, [
'_pointsToNextItems' => $this->pointsToNextItems,
]);
}
/**
* Get the encoded string representation of the cursor to construct a URL.
*
* @return string
*/
public function encode()
{
return str_replace(['+', '/', '='], ['-', '_', ''], base64_encode(json_encode($this->toArray())));
}
/**
* Get a cursor instance from the encoded string representation.
*
* @param string|null $encodedString
* @return static|null
*/
public static function fromEncoded($encodedString)
{
if (! is_string($encodedString)) {
return null;
}
$parameters = json_decode(base64_decode(str_replace(['-', '_'], ['+', '/'], $encodedString)), true);
if (json_last_error() !== JSON_ERROR_NONE) {
return null;
}
$pointsToNextItems = $parameters['_pointsToNextItems'];
unset($parameters['_pointsToNextItems']);
return new static($parameters, $pointsToNextItems);
}
}

View File

@@ -1,195 +0,0 @@
<?php
namespace Illuminate\Pagination;
use ArrayAccess;
use Countable;
use Illuminate\Contracts\Pagination\CursorPaginator as PaginatorContract;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Contracts\Support\Jsonable;
use Illuminate\Support\Collection;
use IteratorAggregate;
use JsonSerializable;
/**
* @template TKey of array-key
*
* @template-covariant TValue
*
* @extends AbstractCursorPaginator<TKey, TValue>
*
* @implements Arrayable<TKey, TValue>
* @implements ArrayAccess<TKey, TValue>
* @implements IteratorAggregate<TKey, TValue>
* @implements PaginatorContract<TKey, TValue>
*/
class CursorPaginator extends AbstractCursorPaginator implements Arrayable, ArrayAccess, Countable, IteratorAggregate, Jsonable, JsonSerializable, PaginatorContract
{
/**
* Indicates whether there are more items in the data source.
*
* @return bool
*/
protected $hasMore;
/**
* Create a new paginator instance.
*
* @param Collection<TKey, TValue>|Arrayable<TKey, TValue>|iterable<TKey, TValue>|null $items
* @param int $perPage
* @param \Illuminate\Pagination\Cursor|null $cursor
* @param array $options (path, query, fragment, pageName)
*/
public function __construct($items, $perPage, $cursor = null, array $options = [])
{
$this->options = $options;
foreach ($options as $key => $value) {
$this->{$key} = $value;
}
$this->perPage = (int) $perPage;
$this->cursor = $cursor;
$this->path = $this->path !== '/' ? rtrim($this->path, '/') : $this->path;
$this->setItems($items);
}
/**
* Set the items for the paginator.
*
* @param Collection<TKey, TValue>|Arrayable<TKey, TValue>|iterable<TKey, TValue>|null $items
* @return void
*/
protected function setItems($items)
{
$this->items = $items instanceof Collection ? $items : new Collection($items);
$this->hasMore = $this->items->count() > $this->perPage;
$this->items = $this->items->slice(0, $this->perPage);
if (! is_null($this->cursor) && $this->cursor->pointsToPreviousItems()) {
$this->items = $this->items->reverse()->values();
}
}
/**
* Render the paginator using the given view.
*
* @param string|null $view
* @param array $data
* @return \Illuminate\Contracts\Support\Htmlable
*/
public function links($view = null, $data = [])
{
return $this->render($view, $data);
}
/**
* Render the paginator using the given view.
*
* @param string|null $view
* @param array $data
* @return \Illuminate\Contracts\Support\Htmlable
*/
public function render($view = null, $data = [])
{
return static::viewFactory()->make($view ?: Paginator::$defaultSimpleView, array_merge($data, [
'paginator' => $this,
]));
}
/**
* Determine if there are more items in the data source.
*
* @return bool
*/
public function hasMorePages()
{
return (is_null($this->cursor) && $this->hasMore) ||
(! is_null($this->cursor) && $this->cursor->pointsToNextItems() && $this->hasMore) ||
(! is_null($this->cursor) && $this->cursor->pointsToPreviousItems());
}
/**
* Determine if there are enough items to split into multiple pages.
*
* @return bool
*/
public function hasPages()
{
return ! $this->onFirstPage() || $this->hasMorePages();
}
/**
* Determine if the paginator is on the first page.
*
* @return bool
*/
public function onFirstPage()
{
return is_null($this->cursor) || ($this->cursor->pointsToPreviousItems() && ! $this->hasMore);
}
/**
* Determine if the paginator is on the last page.
*
* @return bool
*/
public function onLastPage()
{
return ! $this->hasMorePages();
}
/**
* Get the instance as an array.
*
* @return array
*/
public function toArray()
{
return [
'data' => $this->items->toArray(),
'path' => $this->path(),
'per_page' => $this->perPage(),
'next_cursor' => $this->nextCursor()?->encode(),
'next_page_url' => $this->nextPageUrl(),
'prev_cursor' => $this->previousCursor()?->encode(),
'prev_page_url' => $this->previousPageUrl(),
];
}
/**
* Convert the object into something JSON serializable.
*
* @return array
*/
public function jsonSerialize(): array
{
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 object to pretty print formatted JSON.
*
* @params int $options
*
* @return string
*/
public function toPrettyJson(int $options = 0)
{
return $this->toJson(JSON_PRETTY_PRINT | $options);
}
}

View File

@@ -1,21 +0,0 @@
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.

View File

@@ -1,257 +0,0 @@
<?php
namespace Illuminate\Pagination;
use ArrayAccess;
use Countable;
use Illuminate\Contracts\Pagination\LengthAwarePaginator as LengthAwarePaginatorContract;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Contracts\Support\Jsonable;
use Illuminate\Support\Collection;
use IteratorAggregate;
use JsonSerializable;
/**
* @template TKey of array-key
*
* @template-covariant TValue
*
* @extends AbstractPaginator<TKey, TValue>
*
* @implements Arrayable<TKey, TValue>
* @implements ArrayAccess<TKey, TValue>
* @implements IteratorAggregate<TKey, TValue>
* @implements LengthAwarePaginatorContract<TKey, TValue>
*/
class LengthAwarePaginator extends AbstractPaginator implements Arrayable, ArrayAccess, Countable, IteratorAggregate, Jsonable, JsonSerializable, LengthAwarePaginatorContract
{
/**
* The total number of items before slicing.
*
* @var int
*/
protected $total;
/**
* The last available page.
*
* @var int
*/
protected $lastPage;
/**
* Create a new paginator instance.
*
* @param Collection<TKey, TValue>|Arrayable<TKey, TValue>|iterable<TKey, TValue>|null $items
* @param int $total
* @param int $perPage
* @param int|null $currentPage
* @param array $options (path, query, fragment, pageName)
*/
public function __construct($items, $total, $perPage, $currentPage = null, array $options = [])
{
$this->options = $options;
foreach ($options as $key => $value) {
$this->{$key} = $value;
}
$this->total = $total;
$this->perPage = (int) $perPage;
$this->lastPage = max((int) ceil($total / $perPage), 1);
$this->path = $this->path !== '/' ? rtrim($this->path, '/') : $this->path;
$this->currentPage = $this->setCurrentPage($currentPage, $this->pageName);
$this->items = $items instanceof Collection ? $items : new Collection($items);
}
/**
* Get the current page for the request.
*
* @param int $currentPage
* @param string $pageName
* @return int
*/
protected function setCurrentPage($currentPage, $pageName)
{
$currentPage = $currentPage ?: static::resolveCurrentPage($pageName);
return $this->isValidPageNumber($currentPage) ? (int) $currentPage : 1;
}
/**
* Render the paginator using the given view.
*
* @param string|null $view
* @param array $data
* @return \Illuminate\Contracts\Support\Htmlable
*/
public function links($view = null, $data = [])
{
return $this->render($view, $data);
}
/**
* Render the paginator using the given view.
*
* @param string|null $view
* @param array $data
* @return \Illuminate\Contracts\Support\Htmlable
*/
public function render($view = null, $data = [])
{
return static::viewFactory()->make($view ?: static::$defaultView, array_merge($data, [
'paginator' => $this,
'elements' => $this->elements(),
]));
}
/**
* Get the paginator links as a collection (for JSON responses).
*
* @return \Illuminate\Support\Collection
*/
public function linkCollection()
{
return (new Collection($this->elements()))->flatMap(function ($item) {
if (! is_array($item)) {
return [['url' => null, 'label' => '...', 'active' => false]];
}
return (new Collection($item))->map(function ($url, $page) {
return [
'url' => $url,
'label' => (string) $page,
'page' => $page,
'active' => $this->currentPage() === $page,
];
});
})->prepend([
'url' => $this->previousPageUrl(),
'label' => function_exists('__') ? __('pagination.previous') : 'Previous',
'page' => $this->currentPage() > 1 ? $this->currentPage() - 1 : null,
'active' => false,
])->push([
'url' => $this->nextPageUrl(),
'label' => function_exists('__') ? __('pagination.next') : 'Next',
'page' => $this->hasMorePages() ? $this->currentPage() + 1 : null,
'active' => false,
]);
}
/**
* Get the array of elements to pass to the view.
*
* @return array
*/
protected function elements()
{
$window = UrlWindow::make($this);
return array_filter([
$window['first'],
is_array($window['slider']) ? '...' : null,
$window['slider'],
is_array($window['last']) ? '...' : null,
$window['last'],
]);
}
/**
* Get the total number of items being paginated.
*
* @return int
*/
public function total()
{
return $this->total;
}
/**
* Determine if there are more items in the data source.
*
* @return bool
*/
public function hasMorePages()
{
return $this->currentPage() < $this->lastPage();
}
/**
* Get the URL for the next page.
*
* @return string|null
*/
public function nextPageUrl()
{
if ($this->hasMorePages()) {
return $this->url($this->currentPage() + 1);
}
}
/**
* Get the last page.
*
* @return int
*/
public function lastPage()
{
return $this->lastPage;
}
/**
* Get the instance as an array.
*
* @return array
*/
public function toArray()
{
return [
'current_page' => $this->currentPage(),
'data' => $this->items->toArray(),
'first_page_url' => $this->url(1),
'from' => $this->firstItem(),
'last_page' => $this->lastPage(),
'last_page_url' => $this->url($this->lastPage()),
'links' => $this->linkCollection()->toArray(),
'next_page_url' => $this->nextPageUrl(),
'path' => $this->path(),
'per_page' => $this->perPage(),
'prev_page_url' => $this->previousPageUrl(),
'to' => $this->lastItem(),
'total' => $this->total(),
];
}
/**
* Convert the object into something JSON serializable.
*
* @return array
*/
public function jsonSerialize(): array
{
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 object to pretty print formatted JSON.
*
* @params int $options
*
* @return string
*/
public function toPrettyJson(int $options = 0)
{
return $this->toJson(JSON_PRETTY_PRINT | $options);
}
}

View File

@@ -1,34 +0,0 @@
<?php
namespace Illuminate\Pagination;
use Illuminate\Support\ServiceProvider;
class PaginationServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
$this->loadViewsFrom(__DIR__.'/resources/views', 'pagination');
if ($this->app->runningInConsole()) {
$this->publishes([
__DIR__.'/resources/views' => $this->app->resourcePath('views/vendor/pagination'),
], 'laravel-pagination');
}
}
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
PaginationState::resolveUsing($this->app);
}
}

View File

@@ -1,35 +0,0 @@
<?php
namespace Illuminate\Pagination;
class PaginationState
{
/**
* Bind the pagination state resolvers using the given application container as a base.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @return void
*/
public static function resolveUsing($app)
{
Paginator::viewFactoryResolver(fn () => $app['view']);
Paginator::currentPathResolver(fn () => $app['request']->url());
Paginator::currentPageResolver(function ($pageName = 'page') use ($app) {
$page = $app['request']->input($pageName);
if (filter_var($page, FILTER_VALIDATE_INT) !== false && (int) $page >= 1) {
return (int) $page;
}
return 1;
});
Paginator::queryStringResolver(fn () => $app['request']->query());
CursorPaginator::currentCursorResolver(function ($cursorName = 'cursor') use ($app) {
return Cursor::fromEncoded($app['request']->input($cursorName));
});
}
}

View File

@@ -1,200 +0,0 @@
<?php
namespace Illuminate\Pagination;
use ArrayAccess;
use Countable;
use Illuminate\Contracts\Pagination\Paginator as PaginatorContract;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Contracts\Support\Jsonable;
use Illuminate\Support\Collection;
use IteratorAggregate;
use JsonSerializable;
/**
* @template TKey of array-key
*
* @template-covariant TValue
*
* @extends AbstractPaginator<TKey, TValue>
*
* @implements Arrayable<TKey, TValue>
* @implements ArrayAccess<TKey, TValue>
* @implements IteratorAggregate<TKey, TValue>
* @implements PaginatorContract<TKey, TValue>
*/
class Paginator extends AbstractPaginator implements Arrayable, ArrayAccess, Countable, IteratorAggregate, Jsonable, JsonSerializable, PaginatorContract
{
/**
* Determine if there are more items in the data source.
*
* @return bool
*/
protected $hasMore;
/**
* Create a new paginator instance.
*
* @param Collection<TKey, TValue>|Arrayable<TKey, TValue>|iterable<TKey, TValue> $items
* @param int $perPage
* @param int|null $currentPage
* @param array $options (path, query, fragment, pageName)
*/
public function __construct($items, $perPage, $currentPage = null, array $options = [])
{
$this->options = $options;
foreach ($options as $key => $value) {
$this->{$key} = $value;
}
$this->perPage = $perPage;
$this->currentPage = $this->setCurrentPage($currentPage);
$this->path = $this->path !== '/' ? rtrim($this->path, '/') : $this->path;
$this->setItems($items);
}
/**
* Get the current page for the request.
*
* @param int $currentPage
* @return int
*/
protected function setCurrentPage($currentPage)
{
$currentPage = $currentPage ?: static::resolveCurrentPage();
return $this->isValidPageNumber($currentPage) ? (int) $currentPage : 1;
}
/**
* Set the items for the paginator.
*
* @param Collection<TKey, TValue>|Arrayable<TKey, TValue>|iterable<TKey, TValue>|null $items
* @return void
*/
protected function setItems($items)
{
$this->items = $items instanceof Collection ? $items : new Collection($items);
$this->hasMore = $this->items->count() > $this->perPage;
$this->items = $this->items->slice(0, $this->perPage);
}
/**
* Get the URL for the next page.
*
* @return string|null
*/
public function nextPageUrl()
{
if ($this->hasMorePages()) {
return $this->url($this->currentPage() + 1);
}
}
/**
* Render the paginator using the given view.
*
* @param string|null $view
* @param array $data
* @return string
*/
public function links($view = null, $data = [])
{
return $this->render($view, $data);
}
/**
* Render the paginator using the given view.
*
* @param string|null $view
* @param array $data
* @return \Illuminate\Contracts\Support\Htmlable
*/
public function render($view = null, $data = [])
{
return static::viewFactory()->make($view ?: static::$defaultSimpleView, array_merge($data, [
'paginator' => $this,
]));
}
/**
* Manually indicate that the paginator does have more pages.
*
* @param bool $hasMore
* @return $this
*/
public function hasMorePagesWhen($hasMore = true)
{
$this->hasMore = $hasMore;
return $this;
}
/**
* Determine if there are more items in the data source.
*
* @return bool
*/
public function hasMorePages()
{
return $this->hasMore;
}
/**
* Get the instance as an array.
*
* @return array
*/
public function toArray()
{
return [
'current_page' => $this->currentPage(),
'current_page_url' => $this->url($this->currentPage()),
'data' => $this->items->toArray(),
'first_page_url' => $this->url(1),
'from' => $this->firstItem(),
'next_page_url' => $this->nextPageUrl(),
'path' => $this->path(),
'per_page' => $this->perPage(),
'prev_page_url' => $this->previousPageUrl(),
'to' => $this->lastItem(),
];
}
/**
* Convert the object into something JSON serializable.
*
* @return array
*/
public function jsonSerialize(): array
{
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 object to pretty print formatted JSON.
*
* @params int $options
*
* @return string
*/
public function toPrettyJson(int $options = 0)
{
return $this->toJson(JSON_PRETTY_PRINT | $options);
}
}

View File

@@ -1,219 +0,0 @@
<?php
namespace Illuminate\Pagination;
use Illuminate\Contracts\Pagination\LengthAwarePaginator as PaginatorContract;
class UrlWindow
{
/**
* The paginator implementation.
*
* @var \Illuminate\Contracts\Pagination\LengthAwarePaginator
*/
protected $paginator;
/**
* Create a new URL window instance.
*
* @param \Illuminate\Contracts\Pagination\LengthAwarePaginator $paginator
*/
public function __construct(PaginatorContract $paginator)
{
$this->paginator = $paginator;
}
/**
* Create a new URL window instance.
*
* @param \Illuminate\Contracts\Pagination\LengthAwarePaginator $paginator
* @return array
*/
public static function make(PaginatorContract $paginator)
{
return (new static($paginator))->get();
}
/**
* Get the window of URLs to be shown.
*
* @return array
*/
public function get()
{
$onEachSide = $this->paginator->onEachSide;
if ($this->paginator->lastPage() < ($onEachSide * 2) + 8) {
return $this->getSmallSlider();
}
return $this->getUrlSlider($onEachSide);
}
/**
* Get the slider of URLs there are not enough pages to slide.
*
* @return array
*/
protected function getSmallSlider()
{
return [
'first' => $this->paginator->getUrlRange(1, $this->lastPage()),
'slider' => null,
'last' => null,
];
}
/**
* Create a URL slider links.
*
* @param int $onEachSide
* @return array
*/
protected function getUrlSlider($onEachSide)
{
$window = $onEachSide + 4;
if (! $this->hasPages()) {
return ['first' => null, 'slider' => null, 'last' => null];
}
// If the current page is very close to the beginning of the page range, we will
// just render the beginning of the page range, followed by the last 2 of the
// links in this list, since we will not have room to create a full slider.
if ($this->currentPage() <= $window) {
return $this->getSliderTooCloseToBeginning($window, $onEachSide);
}
// If the current page is close to the ending of the page range we will just get
// this first couple pages, followed by a larger window of these ending pages
// since we're too close to the end of the list to create a full on slider.
elseif ($this->currentPage() > ($this->lastPage() - $window)) {
return $this->getSliderTooCloseToEnding($window, $onEachSide);
}
// If we have enough room on both sides of the current page to build a slider we
// will surround it with both the beginning and ending caps, with this window
// of pages in the middle providing a Google style sliding paginator setup.
return $this->getFullSlider($onEachSide);
}
/**
* Get the slider of URLs when too close to the beginning of the window.
*
* @param int $window
* @param int $onEachSide
* @return array
*/
protected function getSliderTooCloseToBeginning($window, $onEachSide)
{
return [
'first' => $this->paginator->getUrlRange(1, $window + $onEachSide),
'slider' => null,
'last' => $this->getFinish(),
];
}
/**
* Get the slider of URLs when too close to the ending of the window.
*
* @param int $window
* @param int $onEachSide
* @return array
*/
protected function getSliderTooCloseToEnding($window, $onEachSide)
{
$last = $this->paginator->getUrlRange(
$this->lastPage() - ($window + ($onEachSide - 1)),
$this->lastPage()
);
return [
'first' => $this->getStart(),
'slider' => null,
'last' => $last,
];
}
/**
* Get the slider of URLs when a full slider can be made.
*
* @param int $onEachSide
* @return array
*/
protected function getFullSlider($onEachSide)
{
return [
'first' => $this->getStart(),
'slider' => $this->getAdjacentUrlRange($onEachSide),
'last' => $this->getFinish(),
];
}
/**
* Get the page range for the current page window.
*
* @param int $onEachSide
* @return array
*/
public function getAdjacentUrlRange($onEachSide)
{
return $this->paginator->getUrlRange(
$this->currentPage() - $onEachSide,
$this->currentPage() + $onEachSide
);
}
/**
* Get the starting URLs of a pagination slider.
*
* @return array
*/
public function getStart()
{
return $this->paginator->getUrlRange(1, 2);
}
/**
* Get the ending URLs of a pagination slider.
*
* @return array
*/
public function getFinish()
{
return $this->paginator->getUrlRange(
$this->lastPage() - 1,
$this->lastPage()
);
}
/**
* Determine if the underlying paginator being presented has pages to show.
*
* @return bool
*/
public function hasPages()
{
return $this->paginator->lastPage() > 1;
}
/**
* Get the current page from the paginator.
*
* @return int
*/
protected function currentPage()
{
return $this->paginator->currentPage();
}
/**
* Get the last page from the paginator.
*
* @return int
*/
protected function lastPage()
{
return $this->paginator->lastPage();
}
}

View File

@@ -1,37 +0,0 @@
{
"name": "illuminate/pagination",
"description": "The Illuminate Pagination 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": "^8.2",
"ext-filter": "*",
"illuminate/collections": "^12.0",
"illuminate/contracts": "^12.0",
"illuminate/support": "^12.0"
},
"autoload": {
"psr-4": {
"Illuminate\\Pagination\\": ""
}
},
"extra": {
"branch-alias": {
"dev-master": "12.x-dev"
}
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev"
}

View File

@@ -1,46 +0,0 @@
@if ($paginator->hasPages())
<nav>
<ul class="pagination">
{{-- Previous Page Link --}}
@if ($paginator->onFirstPage())
<li class="page-item disabled" aria-disabled="true" aria-label="@lang('pagination.previous')">
<span class="page-link" aria-hidden="true">&lsaquo;</span>
</li>
@else
<li class="page-item">
<a class="page-link" href="{{ $paginator->previousPageUrl() }}" rel="prev" aria-label="@lang('pagination.previous')">&lsaquo;</a>
</li>
@endif
{{-- Pagination Elements --}}
@foreach ($elements as $element)
{{-- "Three Dots" Separator --}}
@if (is_string($element))
<li class="page-item disabled" aria-disabled="true"><span class="page-link">{{ $element }}</span></li>
@endif
{{-- Array Of Links --}}
@if (is_array($element))
@foreach ($element as $page => $url)
@if ($page == $paginator->currentPage())
<li class="page-item active" aria-current="page"><span class="page-link">{{ $page }}</span></li>
@else
<li class="page-item"><a class="page-link" href="{{ $url }}">{{ $page }}</a></li>
@endif
@endforeach
@endif
@endforeach
{{-- Next Page Link --}}
@if ($paginator->hasMorePages())
<li class="page-item">
<a class="page-link" href="{{ $paginator->nextPageUrl() }}" rel="next" aria-label="@lang('pagination.next')">&rsaquo;</a>
</li>
@else
<li class="page-item disabled" aria-disabled="true" aria-label="@lang('pagination.next')">
<span class="page-link" aria-hidden="true">&rsaquo;</span>
</li>
@endif
</ul>
</nav>
@endif

View File

@@ -1,88 +0,0 @@
@if ($paginator->hasPages())
<nav class="d-flex justify-items-center justify-content-between">
<div class="d-flex justify-content-between flex-fill d-sm-none">
<ul class="pagination">
{{-- Previous Page Link --}}
@if ($paginator->onFirstPage())
<li class="page-item disabled" aria-disabled="true">
<span class="page-link">@lang('pagination.previous')</span>
</li>
@else
<li class="page-item">
<a class="page-link" href="{{ $paginator->previousPageUrl() }}" rel="prev">@lang('pagination.previous')</a>
</li>
@endif
{{-- Next Page Link --}}
@if ($paginator->hasMorePages())
<li class="page-item">
<a class="page-link" href="{{ $paginator->nextPageUrl() }}" rel="next">@lang('pagination.next')</a>
</li>
@else
<li class="page-item disabled" aria-disabled="true">
<span class="page-link">@lang('pagination.next')</span>
</li>
@endif
</ul>
</div>
<div class="d-none flex-sm-fill d-sm-flex align-items-sm-center justify-content-sm-between">
<div>
<p class="small text-muted">
{!! __('Showing') !!}
<span class="fw-semibold">{{ $paginator->firstItem() }}</span>
{!! __('to') !!}
<span class="fw-semibold">{{ $paginator->lastItem() }}</span>
{!! __('of') !!}
<span class="fw-semibold">{{ $paginator->total() }}</span>
{!! __('results') !!}
</p>
</div>
<div>
<ul class="pagination">
{{-- Previous Page Link --}}
@if ($paginator->onFirstPage())
<li class="page-item disabled" aria-disabled="true" aria-label="@lang('pagination.previous')">
<span class="page-link" aria-hidden="true">&lsaquo;</span>
</li>
@else
<li class="page-item">
<a class="page-link" href="{{ $paginator->previousPageUrl() }}" rel="prev" aria-label="@lang('pagination.previous')">&lsaquo;</a>
</li>
@endif
{{-- Pagination Elements --}}
@foreach ($elements as $element)
{{-- "Three Dots" Separator --}}
@if (is_string($element))
<li class="page-item disabled" aria-disabled="true"><span class="page-link">{{ $element }}</span></li>
@endif
{{-- Array Of Links --}}
@if (is_array($element))
@foreach ($element as $page => $url)
@if ($page == $paginator->currentPage())
<li class="page-item active" aria-current="page"><span class="page-link">{{ $page }}</span></li>
@else
<li class="page-item"><a class="page-link" href="{{ $url }}">{{ $page }}</a></li>
@endif
@endforeach
@endif
@endforeach
{{-- Next Page Link --}}
@if ($paginator->hasMorePages())
<li class="page-item">
<a class="page-link" href="{{ $paginator->nextPageUrl() }}" rel="next" aria-label="@lang('pagination.next')">&rsaquo;</a>
</li>
@else
<li class="page-item disabled" aria-disabled="true" aria-label="@lang('pagination.next')">
<span class="page-link" aria-hidden="true">&rsaquo;</span>
</li>
@endif
</ul>
</div>
</div>
</nav>
@endif

View File

@@ -1,46 +0,0 @@
@if ($paginator->hasPages())
<nav>
<ul class="pagination">
{{-- Previous Page Link --}}
@if ($paginator->onFirstPage())
<li class="disabled" aria-disabled="true" aria-label="@lang('pagination.previous')">
<span aria-hidden="true">&lsaquo;</span>
</li>
@else
<li>
<a href="{{ $paginator->previousPageUrl() }}" rel="prev" aria-label="@lang('pagination.previous')">&lsaquo;</a>
</li>
@endif
{{-- Pagination Elements --}}
@foreach ($elements as $element)
{{-- "Three Dots" Separator --}}
@if (is_string($element))
<li class="disabled" aria-disabled="true"><span>{{ $element }}</span></li>
@endif
{{-- Array Of Links --}}
@if (is_array($element))
@foreach ($element as $page => $url)
@if ($page == $paginator->currentPage())
<li class="active" aria-current="page"><span>{{ $page }}</span></li>
@else
<li><a href="{{ $url }}">{{ $page }}</a></li>
@endif
@endforeach
@endif
@endforeach
{{-- Next Page Link --}}
@if ($paginator->hasMorePages())
<li>
<a href="{{ $paginator->nextPageUrl() }}" rel="next" aria-label="@lang('pagination.next')">&rsaquo;</a>
</li>
@else
<li class="disabled" aria-disabled="true" aria-label="@lang('pagination.next')">
<span aria-hidden="true">&rsaquo;</span>
</li>
@endif
</ul>
</nav>
@endif

View File

@@ -1,36 +0,0 @@
@if ($paginator->hasPages())
<div class="ui pagination menu" role="navigation">
{{-- Previous Page Link --}}
@if ($paginator->onFirstPage())
<a class="icon item disabled" aria-disabled="true" aria-label="@lang('pagination.previous')"> <i class="left chevron icon"></i> </a>
@else
<a class="icon item" href="{{ $paginator->previousPageUrl() }}" rel="prev" aria-label="@lang('pagination.previous')"> <i class="left chevron icon"></i> </a>
@endif
{{-- Pagination Elements --}}
@foreach ($elements as $element)
{{-- "Three Dots" Separator --}}
@if (is_string($element))
<a class="icon item disabled" aria-disabled="true">{{ $element }}</a>
@endif
{{-- Array Of Links --}}
@if (is_array($element))
@foreach ($element as $page => $url)
@if ($page == $paginator->currentPage())
<a class="item active" href="{{ $url }}" aria-current="page">{{ $page }}</a>
@else
<a class="item" href="{{ $url }}">{{ $page }}</a>
@endif
@endforeach
@endif
@endforeach
{{-- Next Page Link --}}
@if ($paginator->hasMorePages())
<a class="icon item" href="{{ $paginator->nextPageUrl() }}" rel="next" aria-label="@lang('pagination.next')"> <i class="right chevron icon"></i> </a>
@else
<a class="icon item disabled" aria-disabled="true" aria-label="@lang('pagination.next')"> <i class="right chevron icon"></i> </a>
@endif
</div>
@endif

View File

@@ -1,27 +0,0 @@
@if ($paginator->hasPages())
<nav>
<ul class="pagination">
{{-- Previous Page Link --}}
@if ($paginator->onFirstPage())
<li class="page-item disabled" aria-disabled="true">
<span class="page-link">@lang('pagination.previous')</span>
</li>
@else
<li class="page-item">
<a class="page-link" href="{{ $paginator->previousPageUrl() }}" rel="prev">@lang('pagination.previous')</a>
</li>
@endif
{{-- Next Page Link --}}
@if ($paginator->hasMorePages())
<li class="page-item">
<a class="page-link" href="{{ $paginator->nextPageUrl() }}" rel="next">@lang('pagination.next')</a>
</li>
@else
<li class="page-item disabled" aria-disabled="true">
<span class="page-link">@lang('pagination.next')</span>
</li>
@endif
</ul>
</nav>
@endif

View File

@@ -1,29 +0,0 @@
@if ($paginator->hasPages())
<nav role="navigation" aria-label="{!! __('Pagination Navigation') !!}">
<ul class="pagination">
{{-- Previous Page Link --}}
@if ($paginator->onFirstPage())
<li class="page-item disabled" aria-disabled="true">
<span class="page-link">{!! __('pagination.previous') !!}</span>
</li>
@else
<li class="page-item">
<a class="page-link" href="{{ $paginator->previousPageUrl() }}" rel="prev">
{!! __('pagination.previous') !!}
</a>
</li>
@endif
{{-- Next Page Link --}}
@if ($paginator->hasMorePages())
<li class="page-item">
<a class="page-link" href="{{ $paginator->nextPageUrl() }}" rel="next">{!! __('pagination.next') !!}</a>
</li>
@else
<li class="page-item disabled" aria-disabled="true">
<span class="page-link">{!! __('pagination.next') !!}</span>
</li>
@endif
</ul>
</nav>
@endif

View File

@@ -1,19 +0,0 @@
@if ($paginator->hasPages())
<nav>
<ul class="pagination">
{{-- Previous Page Link --}}
@if ($paginator->onFirstPage())
<li class="disabled" aria-disabled="true"><span>@lang('pagination.previous')</span></li>
@else
<li><a href="{{ $paginator->previousPageUrl() }}" rel="prev">@lang('pagination.previous')</a></li>
@endif
{{-- Next Page Link --}}
@if ($paginator->hasMorePages())
<li><a href="{{ $paginator->nextPageUrl() }}" rel="next">@lang('pagination.next')</a></li>
@else
<li class="disabled" aria-disabled="true"><span>@lang('pagination.next')</span></li>
@endif
</ul>
</nav>
@endif

View File

@@ -1,25 +0,0 @@
@if ($paginator->hasPages())
<nav role="navigation" aria-label="{{ __('Pagination Navigation') }}" class="flex gap-2 items-center justify-between">
@if ($paginator->onFirstPage())
<span class="inline-flex items-center px-4 py-2 text-sm font-medium text-gray-600 bg-white border border-gray-300 cursor-not-allowed leading-5 rounded-md dark:text-gray-300 dark:bg-gray-700 dark:border-gray-600">
{!! __('pagination.previous') !!}
</span>
@else
<a href="{{ $paginator->previousPageUrl() }}" rel="prev" class="inline-flex items-center px-4 py-2 text-sm font-medium text-gray-800 bg-white border border-gray-300 leading-5 rounded-md hover:text-gray-700 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-800 transition ease-in-out duration-150 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-200 dark:focus:border-blue-700 dark:active:bg-gray-700 dark:active:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-900 dark:hover:text-gray-200">
{!! __('pagination.previous') !!}
</a>
@endif
@if ($paginator->hasMorePages())
<a href="{{ $paginator->nextPageUrl() }}" rel="next" class="inline-flex items-center px-4 py-2 text-sm font-medium text-gray-800 bg-white border border-gray-300 leading-5 rounded-md hover:text-gray-700 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-800 transition ease-in-out duration-150 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-200 dark:focus:border-blue-700 dark:active:bg-gray-700 dark:active:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-900 dark:hover:text-gray-200">
{!! __('pagination.next') !!}
</a>
@else
<span class="inline-flex items-center px-4 py-2 text-sm font-medium text-gray-600 bg-white border border-gray-300 cursor-not-allowed leading-5 rounded-md dark:text-gray-300 dark:bg-gray-700 dark:border-gray-600">
{!! __('pagination.next') !!}
</span>
@endif
</nav>
@endif

View File

@@ -1,111 +0,0 @@
@if ($paginator->hasPages())
<nav role="navigation" aria-label="{{ __('Pagination Navigation') }}">
<div class="flex gap-2 items-center justify-between sm:hidden">
@if ($paginator->onFirstPage())
<span class="inline-flex items-center px-4 py-2 text-sm font-medium text-gray-600 bg-white border border-gray-300 cursor-not-allowed leading-5 rounded-md dark:text-gray-300 dark:bg-gray-700 dark:border-gray-600">
{!! __('pagination.previous') !!}
</span>
@else
<a href="{{ $paginator->previousPageUrl() }}" rel="prev" class="inline-flex items-center px-4 py-2 text-sm font-medium text-gray-800 bg-white border border-gray-300 leading-5 rounded-md hover:text-gray-700 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-800 transition ease-in-out duration-150 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-200 dark:focus:border-blue-700 dark:active:bg-gray-700 dark:active:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-900 dark:hover:text-gray-200">
{!! __('pagination.previous') !!}
</a>
@endif
@if ($paginator->hasMorePages())
<a href="{{ $paginator->nextPageUrl() }}" rel="next" class="inline-flex items-center px-4 py-2 text-sm font-medium text-gray-800 bg-white border border-gray-300 leading-5 rounded-md hover:text-gray-700 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-800 transition ease-in-out duration-150 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-200 dark:focus:border-blue-700 dark:active:bg-gray-700 dark:active:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-900 dark:hover:text-gray-200">
{!! __('pagination.next') !!}
</a>
@else
<span class="inline-flex items-center px-4 py-2 text-sm font-medium text-gray-600 bg-white border border-gray-300 cursor-not-allowed leading-5 rounded-md dark:text-gray-300 dark:bg-gray-700 dark:border-gray-600">
{!! __('pagination.next') !!}
</span>
@endif
</div>
<div class="hidden sm:flex-1 sm:flex sm:gap-2 sm:items-center sm:justify-between">
<div>
<p class="text-sm text-gray-700 leading-5 dark:text-gray-600">
{!! __('Showing') !!}
@if ($paginator->firstItem())
<span class="font-medium">{{ $paginator->firstItem() }}</span>
{!! __('to') !!}
<span class="font-medium">{{ $paginator->lastItem() }}</span>
@else
{{ $paginator->count() }}
@endif
{!! __('of') !!}
<span class="font-medium">{{ $paginator->total() }}</span>
{!! __('results') !!}
</p>
</div>
<div>
<span class="inline-flex rtl:flex-row-reverse shadow-sm rounded-md">
{{-- Previous Page Link --}}
@if ($paginator->onFirstPage())
<span aria-disabled="true" aria-label="{{ __('pagination.previous') }}">
<span class="inline-flex items-center px-2 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-not-allowed rounded-l-md leading-5 dark:bg-gray-700 dark:border-gray-600 dark:text-gray-400" aria-hidden="true">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" clip-rule="evenodd" />
</svg>
</span>
</span>
@else
<a href="{{ $paginator->previousPageUrl() }}" rel="prev" class="inline-flex items-center px-2 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-l-md leading-5 hover:text-gray-400 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-500 transition ease-in-out duration-150 dark:bg-gray-800 dark:border-gray-600 dark:active:bg-gray-700 dark:focus:border-blue-800 dark:text-gray-300 dark:hover:bg-gray-900 dark:hover:text-gray-300" aria-label="{{ __('pagination.previous') }}">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" clip-rule="evenodd" />
</svg>
</a>
@endif
{{-- Pagination Elements --}}
@foreach ($elements as $element)
{{-- "Three Dots" Separator --}}
@if (is_string($element))
<span aria-disabled="true">
<span class="inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-700 bg-white border border-gray-300 cursor-default leading-5 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-300">{{ $element }}</span>
</span>
@endif
{{-- Array Of Links --}}
@if (is_array($element))
@foreach ($element as $page => $url)
@if ($page == $paginator->currentPage())
<span aria-current="page">
<span class="inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-700 bg-gray-200 border border-gray-300 cursor-default leading-5 dark:bg-gray-700 dark:border-gray-600 dark:text-gray-300">{{ $page }}</span>
</span>
@else
<a href="{{ $url }}" class="inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-700 bg-white border border-gray-300 leading-5 hover:text-gray-700 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-700 transition ease-in-out duration-150 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-300 dark:hover:text-gray-300 dark:active:bg-gray-700 dark:focus:border-blue-800 hover:bg-gray-100 dark:hover:bg-gray-900" aria-label="{{ __('Go to page :page', ['page' => $page]) }}">
{{ $page }}
</a>
@endif
@endforeach
@endif
@endforeach
{{-- Next Page Link --}}
@if ($paginator->hasMorePages())
<a href="{{ $paginator->nextPageUrl() }}" rel="next" class="inline-flex items-center px-2 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-r-md leading-5 hover:text-gray-400 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-500 transition ease-in-out duration-150 dark:bg-gray-800 dark:border-gray-600 dark:active:bg-gray-700 dark:focus:border-blue-800 dark:text-gray-300 dark:hover:bg-gray-900 dark:hover:text-gray-300" aria-label="{{ __('pagination.next') }}">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd" />
</svg>
</a>
@else
<span aria-disabled="true" aria-label="{{ __('pagination.next') }}">
<span class="inline-flex items-center px-2 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-not-allowed rounded-r-md leading-5 dark:bg-gray-700 dark:border-gray-600 dark:text-gray-400" aria-hidden="true">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd" />
</svg>
</span>
</span>
@endif
</span>
</div>
</div>
</nav>
@endif

View File

@@ -1,21 +0,0 @@
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.

View File

@@ -1,213 +0,0 @@
<?php
namespace Illuminate\Support;
use ReflectionAttribute;
use ReflectionClass;
use ReflectionEnum;
use ReflectionMethod;
use ReflectionNamedType;
use ReflectionUnionType;
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], $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 specified class attribute, optionally following an inheritance chain.
*
* @template TAttribute of object
*
* @param object|class-string $objectOrClass
* @param class-string<TAttribute> $attribute
* @param bool $ascend
* @return TAttribute|null
*/
public static function getClassAttribute($objectOrClass, $attribute, $ascend = false)
{
return static::getClassAttributes($objectOrClass, $attribute, $ascend)->flatten()->first();
}
/**
* Get the specified class attribute(s), optionally following an inheritance chain.
*
* @template TTarget of object
* @template TAttribute of object
*
* @param TTarget|class-string<TTarget> $objectOrClass
* @param class-string<TAttribute> $attribute
* @param bool $includeParents
* @return ($includeParents is true ? Collection<class-string<contravariant TTarget>, Collection<int, TAttribute>> : Collection<int, TAttribute>)
*/
public static function getClassAttributes($objectOrClass, $attribute, $includeParents = false)
{
$reflectionClass = new ReflectionClass($objectOrClass);
$attributes = [];
do {
$attributes[$reflectionClass->name] = new Collection(array_map(
fn (ReflectionAttribute $reflectionAttribute) => $reflectionAttribute->newInstance(),
$reflectionClass->getAttributes($attribute)
));
} while ($includeParents && false !== $reflectionClass = $reflectionClass->getParentClass());
return $includeParents ? new Collection($attributes) : array_first($attributes);
}
/**
* 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;
}
return static::getTypeName($parameter, $type);
}
/**
* Get the class names of the given parameter's type, including union types.
*
* @param \ReflectionParameter $parameter
* @return array
*/
public static function getParameterClassNames($parameter)
{
$type = $parameter->getType();
if (! $type instanceof ReflectionUnionType) {
return array_filter([static::getParameterClassName($parameter)]);
}
$unionTypes = [];
foreach ($type->getTypes() as $listedType) {
if (! $listedType instanceof ReflectionNamedType || $listedType->isBuiltin()) {
continue;
}
$unionTypes[] = static::getTypeName($parameter, $listedType);
}
return array_filter($unionTypes);
}
/**
* Get the given type's class name.
*
* @param \ReflectionParameter $parameter
* @param \ReflectionNamedType $type
* @return string
*/
protected static function getTypeName($parameter, $type)
{
$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) || interface_exists($paramClassName))
&& (new ReflectionClass($paramClassName))->isSubclassOf($className);
}
/**
* Determine if the parameter's type is a Backed Enum with a string backing type.
*
* @param \ReflectionParameter $parameter
* @return bool
*/
public static function isParameterBackedEnumWithStringBackingType($parameter)
{
if (! $parameter->getType() instanceof ReflectionNamedType) {
return false;
}
$backedEnumClass = $parameter->getType()?->getName();
if (is_null($backedEnumClass)) {
return false;
}
if (enum_exists($backedEnumClass)) {
$reflectionBackedEnum = new ReflectionEnum($backedEnumClass);
return $reflectionBackedEnum->isBacked()
&& $reflectionBackedEnum->getBackingType()->getName() == 'string';
}
return false;
}
}

View File

@@ -1,126 +0,0 @@
<?php
namespace Illuminate\Support\Traits;
use Closure;
use Illuminate\Support\Collection;
use Illuminate\Support\Reflector;
use ReflectionFunction;
use ReflectionIntersectionType;
use ReflectionUnionType;
use RuntimeException;
trait ReflectsClosures
{
/**
* Get the class name of the first parameter of the given Closure.
*
* @param \Closure $closure
* @return string
*
* @throws \ReflectionException
* @throws \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];
}
/**
* Get the class names of the first parameter of the given Closure, including union types.
*
* @param \Closure $closure
* @return array
*
* @throws \ReflectionException
* @throws \RuntimeException
*/
protected function firstClosureParameterTypes(Closure $closure)
{
$reflection = new ReflectionFunction($closure);
$types = (new Collection($reflection->getParameters()))
->mapWithKeys(function ($parameter) {
if ($parameter->isVariadic()) {
return [$parameter->getName() => null];
}
return [$parameter->getName() => Reflector::getParameterClassNames($parameter)];
})
->filter()
->values()
->all();
if (empty($types)) {
throw new RuntimeException('The given Closure has no parameters.');
}
if (isset($types[0]) && empty($types[0])) {
throw new RuntimeException('The first parameter of the given Closure is missing a type hint.');
}
return $types[0];
}
/**
* 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 (new Collection($reflection->getParameters()))
->mapWithKeys(function ($parameter) {
if ($parameter->isVariadic()) {
return [$parameter->getName() => null];
}
return [$parameter->getName() => Reflector::getParameterClassName($parameter)];
})
->all();
}
/**
* Get the class names / types of the return type of the given Closure.
*
* @param \Closure $closure
* @return list<class-string>
*
* @throws \ReflectionException
*/
protected function closureReturnTypes(Closure $closure)
{
$reflection = new ReflectionFunction($closure);
if ($reflection->getReturnType() === null ||
$reflection->getReturnType() instanceof ReflectionIntersectionType) {
return [];
}
$types = $reflection->getReturnType() instanceof ReflectionUnionType
? $reflection->getReturnType()->getTypes()
: [$reflection->getReturnType()];
return (new Collection($types))
->reject(fn ($type) => $type->isBuiltin())
->reject(fn ($type) => in_array($type->getName(), ['static', 'self']))
->map(fn ($type) => $type->getName())
->values()
->all();
}
}

View File

@@ -1,38 +0,0 @@
{
"name": "illuminate/reflection",
"description": "The Illuminate Reflection 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": "^8.2",
"illuminate/contracts": "^12.0",
"illuminate/collections": "^12.0"
},
"autoload": {
"psr-4": {
"Illuminate\\Support\\": ""
},
"files": [
"helpers.php"
]
},
"extra": {
"branch-alias": {
"dev-master": "12.x-dev"
}
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev"
}

View File

@@ -1,97 +0,0 @@
<?php
use Illuminate\Support\Traits\ReflectsClosures;
if (! function_exists('lazy')) {
/**
* Create a lazy instance.
*
* @template TValue of object
*
* @param class-string<TValue>|(\Closure(TValue): mixed) $class
* @param (\Closure(TValue): mixed)|int $callback
* @param int $options
* @param array<string, mixed> $eager
* @return TValue
*/
function lazy($class, $callback = 0, $options = 0, $eager = [])
{
static $closureReflector;
$closureReflector ??= new class
{
use ReflectsClosures;
public function typeFromParameter($callback)
{
return $this->firstClosureParameterType($callback);
}
};
[$class, $callback, $options] = is_string($class)
? [$class, $callback, $options]
: [$closureReflector->typeFromParameter($class), $class, $callback ?: $options];
$reflectionClass = new ReflectionClass($class);
$instance = $reflectionClass->newLazyGhost(function ($instance) use ($callback) {
$result = $callback($instance);
if (is_array($result)) {
$instance->__construct(...$result);
}
}, $options);
foreach ($eager as $property => $value) {
$reflectionClass->getProperty($property)->setRawValueWithoutLazyInitialization($instance, $value);
}
return $instance;
}
}
if (! function_exists('proxy')) {
/**
* Create a lazy proxy instance.
*
* @template TValue of object
*
* @param class-string<TValue>|(\Closure(TValue): TValue) $class
* @param (\Closure(TValue): TValue)|int $callback
* @param int $options
* @param array<string, mixed> $eager
* @return TValue
*/
function proxy($class, $callback = 0, $options = 0, $eager = [])
{
static $closureReflector;
$closureReflector = new class
{
use ReflectsClosures;
public function get($callback)
{
return $this->closureReturnTypes($callback)[0] ?? $this->firstClosureParameterType($callback);
}
};
[$class, $callback, $options] = is_string($class)
? [$class, $callback, $options]
: [$closureReflector->get($class), $class, $callback ?: $options];
$reflectionClass = new ReflectionClass($class);
$proxy = $reflectionClass->newLazyProxy(function () use ($callback, $eager, &$proxy) {
$instance = $callback($proxy, $eager);
return $instance;
}, $options);
foreach ($eager as $property => $value) {
$reflectionClass->getProperty($property)->setRawValueWithoutLazyInitialization($proxy, $value);
}
return $proxy;
}
}

View File

@@ -1,52 +0,0 @@
<?php
namespace Illuminate\Support;
class AggregateServiceProvider extends ServiceProvider
{
/**
* The provider class names.
*
* @var array<int, class-string<\Illuminate\Support\ServiceProvider>>
*/
protected $providers = [];
/**
* An array of the service provider instances.
*
* @var array<int, \Illuminate\Support\ServiceProvider>
*/
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<int, string>
*/
public function provides()
{
$provides = [];
foreach ($this->providers as $provider) {
$instance = $this->app->resolveProvider($provider);
$provides = array_merge($provides, $instance->provides());
}
return $provides;
}
}

View File

@@ -1,72 +0,0 @@
<?php
namespace Illuminate\Support;
use Closure;
use Illuminate\Support\Traits\Macroable;
class Benchmark
{
use Macroable;
/**
* Measure a callable or array of callables over the given number of iterations.
*
* @param \Closure|array $benchmarkables
* @param int $iterations
* @return array|float
*/
public static function measure(Closure|array $benchmarkables, int $iterations = 1): array|float
{
return Collection::wrap($benchmarkables)->map(function ($callback) use ($iterations) {
return Collection::range(1, $iterations)->map(function () use ($callback) {
gc_collect_cycles();
$start = hrtime(true);
$callback();
return (hrtime(true) - $start) / 1_000_000;
})->average();
})->when(
$benchmarkables instanceof Closure,
fn ($c) => $c->first(),
fn ($c) => $c->all(),
);
}
/**
* Measure a callable once and return the result and duration in milliseconds.
*
* @template TReturn of mixed
*
* @param (callable(): TReturn) $callback
* @return array{0: TReturn, 1: float}
*/
public static function value(callable $callback): array
{
gc_collect_cycles();
$start = hrtime(true);
$result = $callback();
return [$result, (hrtime(true) - $start) / 1_000_000];
}
/**
* Measure a callable or array of callables over the given number of iterations, then dump and die.
*
* @param \Closure|array $benchmarkables
* @param int $iterations
* @return never
*/
public static function dd(Closure|array $benchmarkables, int $iterations = 1): never
{
$result = (new Collection(static::measure(Arr::wrap($benchmarkables), $iterations)))
->map(fn ($average) => number_format($average, 3).'ms')
->when($benchmarkables instanceof Closure, fn ($c) => $c->first(), fn ($c) => $c->all());
dd($result);
}
}

View File

@@ -1,99 +0,0 @@
<?php
namespace Illuminate\Support;
use InvalidArgumentException;
use Ramsey\Uuid\Uuid;
use Ramsey\Uuid\UuidInterface;
use Symfony\Component\Uid\Ulid;
class BinaryCodec
{
/** @var array<string, array{encode: callable(UuidInterface|Ulid|string|null): ?string, decode: callable(?string): ?string}> */
protected static array $customCodecs = [];
/**
* Register a custom codec.
*/
public static function register(string $name, callable $encode, callable $decode): void
{
self::$customCodecs[$name] = [
'encode' => $encode,
'decode' => $decode,
];
}
/**
* Encode a value to binary.
*/
public static function encode(UuidInterface|Ulid|string|null $value, string $format): ?string
{
if (blank($value)) {
return null;
}
if (isset(self::$customCodecs[$format])) {
return (self::$customCodecs[$format]['encode'])($value);
}
return match ($format) {
'uuid' => match (true) {
$value instanceof UuidInterface => $value->getBytes(),
self::isBinary($value) => $value,
default => Uuid::fromString($value)->getBytes(),
},
'ulid' => match (true) {
$value instanceof Ulid => $value->toBinary(),
self::isBinary($value) => $value,
default => Ulid::fromString($value)->toBinary(),
},
default => throw new InvalidArgumentException("Format [$format] is invalid."),
};
}
/**
* Decode a binary value to string.
*/
public static function decode(?string $value, string $format): ?string
{
if (blank($value)) {
return null;
}
if (isset(self::$customCodecs[$format])) {
return (self::$customCodecs[$format]['decode'])($value);
}
return match ($format) {
'uuid' => (self::isBinary($value) ? Uuid::fromBytes($value) : Uuid::fromString($value))->toString(),
'ulid' => (self::isBinary($value) ? Ulid::fromBinary($value) : Ulid::fromString($value))->toString(),
default => throw new InvalidArgumentException("Format [$format] is invalid."),
};
}
/**
* Get all available format names.
*
* @return list<string>
*/
public static function formats(): array
{
return array_unique([...['uuid', 'ulid'], ...array_keys(self::$customCodecs)]);
}
/**
* Determine if the given value is binary data.
*/
public static function isBinary(mixed $value): bool
{
if (! is_string($value) || $value === '') {
return false;
}
if (str_contains($value, "\0")) {
return true;
}
return ! mb_check_encoding($value, 'UTF-8');
}
}

View File

@@ -1,74 +0,0 @@
<?php
namespace Illuminate\Support;
use Carbon\Carbon as BaseCarbon;
use Carbon\CarbonImmutable as BaseCarbonImmutable;
use Illuminate\Support\Traits\Conditionable;
use Illuminate\Support\Traits\Dumpable;
use Ramsey\Uuid\Uuid;
use Symfony\Component\Uid\Ulid;
class Carbon extends BaseCarbon
{
use Conditionable, Dumpable;
/**
* {@inheritdoc}
*/
public static function setTestNow(mixed $testNow = null): void
{
BaseCarbon::setTestNow($testNow);
BaseCarbonImmutable::setTestNow($testNow);
}
/**
* Create a Carbon instance from a given ordered UUID or ULID.
*/
public static function createFromId(Uuid|Ulid|string $id): static
{
if (is_string($id)) {
$id = Ulid::isValid($id) ? Ulid::fromString($id) : Uuid::fromString($id);
}
return static::createFromInterface($id->getDateTime());
}
/**
* Get the current date / time plus a given amount of time.
*/
public function plus(
int $years = 0,
int $months = 0,
int $weeks = 0,
int $days = 0,
int $hours = 0,
int $minutes = 0,
int $seconds = 0,
int $microseconds = 0
): static {
return $this->add("
$years years $months months $weeks weeks $days days
$hours hours $minutes minutes $seconds seconds $microseconds microseconds
");
}
/**
* Get the current date / time minus a given amount of time.
*/
public function minus(
int $years = 0,
int $months = 0,
int $weeks = 0,
int $days = 0,
int $hours = 0,
int $minutes = 0,
int $seconds = 0,
int $microseconds = 0
): static {
return $this->sub("
$years years $months months $weeks weeks $days days
$hours hours $minutes minutes $seconds seconds $microseconds microseconds
");
}
}

View File

@@ -1,254 +0,0 @@
<?php
namespace Illuminate\Support;
use Closure;
use Illuminate\Filesystem\Filesystem;
use RuntimeException;
use Symfony\Component\Console\Output\OutputInterface;
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
*/
public function __construct(Filesystem $files, $workingPath = null)
{
$this->files = $files;
$this->workingPath = $workingPath;
}
/**
* Determine if the given Composer package is installed.
*
* @param string $package
* @return bool
*
* @throws \RuntimeException
*/
public function hasPackage($package)
{
$composer = json_decode(file_get_contents($this->findComposerFile()), true);
return array_key_exists($package, $composer['require'] ?? [])
|| array_key_exists($package, $composer['require-dev'] ?? []);
}
/**
* Install the given Composer packages into the application.
*
* @param array<int, string> $packages
* @param bool $dev
* @param \Closure|\Symfony\Component\Console\Output\OutputInterface|null $output
* @param string|null $composerBinary
* @return bool
*/
public function requirePackages(array $packages, bool $dev = false, Closure|OutputInterface|null $output = null, $composerBinary = null)
{
$command = (new Collection([
...$this->findComposer($composerBinary),
'require',
...$packages,
]))
->when($dev, function ($command) {
$command->push('--dev');
})->all();
return 0 === $this->getProcess($command, ['COMPOSER_MEMORY_LIMIT' => '-1'])
->run(
$output instanceof OutputInterface
? function ($type, $line) use ($output) {
$output->write(' '.$line);
} : $output
);
}
/**
* Remove the given Composer packages from the application.
*
* @param array<int, string> $packages
* @param bool $dev
* @param \Closure|\Symfony\Component\Console\Output\OutputInterface|null $output
* @param string|null $composerBinary
* @return bool
*/
public function removePackages(array $packages, bool $dev = false, Closure|OutputInterface|null $output = null, $composerBinary = null)
{
$command = (new Collection([
...$this->findComposer($composerBinary),
'remove',
...$packages,
]))
->when($dev, function ($command) {
$command->push('--dev');
})->all();
return 0 === $this->getProcess($command, ['COMPOSER_MEMORY_LIMIT' => '-1'])
->run(
$output instanceof OutputInterface
? function ($type, $line) use ($output) {
$output->write(' '.$line);
} : $output
);
}
/**
* Modify the "composer.json" file contents using the given callback.
*
* @param callable(array):array $callback
* @return void
*
* @throws \RuntimeException
*/
public function modify(callable $callback)
{
$composerFile = $this->findComposerFile();
$composer = json_decode(file_get_contents($composerFile), true, 512, JSON_THROW_ON_ERROR);
file_put_contents(
$composerFile,
json_encode(
call_user_func($callback, $composer),
JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE
)
);
}
/**
* Regenerate the Composer autoloader files.
*
* @param string|array $extra
* @param string|null $composerBinary
* @return int
*/
public function dumpAutoloads($extra = '', $composerBinary = null)
{
$extra = $extra ? (array) $extra : [];
$command = array_merge($this->findComposer($composerBinary), ['dump-autoload'], $extra);
return $this->getProcess($command)->run();
}
/**
* Regenerate the optimized Composer autoloader files.
*
* @param string|null $composerBinary
* @return int
*/
public function dumpOptimized($composerBinary = null)
{
return $this->dumpAutoloads('--optimize', $composerBinary);
}
/**
* Get the Composer binary / command for the environment.
*
* @param string|null $composerBinary
* @return array
*/
public function findComposer($composerBinary = null)
{
if (! is_null($composerBinary) && $this->files->exists($composerBinary)) {
return [$this->phpBinary(), $composerBinary];
} elseif ($this->files->exists($this->workingPath.'/composer.phar')) {
return [$this->phpBinary(), 'composer.phar'];
}
return ['composer'];
}
/**
* Get the path to the "composer.json" file.
*
* @return string
*
* @throws \RuntimeException
*/
protected function findComposerFile()
{
$composerFile = "{$this->workingPath}/composer.json";
if (! file_exists($composerFile)) {
throw new RuntimeException("Unable to locate `composer.json` file at [{$this->workingPath}].");
}
return $composerFile;
}
/**
* Get the PHP binary.
*
* @return string
*/
protected function phpBinary()
{
return php_binary();
}
/**
* Get a new Symfony process instance.
*
* @param array $command
* @param array $env
* @return \Symfony\Component\Process\Process
*/
protected function getProcess(array $command, array $env = [])
{
return (new Process($command, $this->workingPath, $env))->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;
}
/**
* Get the version of Composer.
*
* @return string|null
*/
public function getVersion()
{
$command = array_merge($this->findComposer(), ['-V', '--no-ansi']);
$process = $this->getProcess($command);
$process->run();
$output = $process->getOutput();
if (preg_match('/(\d+(\.\d+){2})/', $output, $version)) {
return $version[1];
}
return explode(' ', $output)[2] ?? null;
}
}

View File

@@ -1,191 +0,0 @@
<?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,
], fn ($value) => ! 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;
}
}

View File

@@ -1,250 +0,0 @@
<?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 bool canBeCreatedFromFormat(?string $date, string $format)
* @method \Illuminate\Support\Carbon|null create($year = 0, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0, $timezone = null)
* @method \Illuminate\Support\Carbon createFromDate($year = null, $month = null, $day = null, $timezone = null)
* @method \Illuminate\Support\Carbon|null createFromFormat($format, $time, $timezone = null)
* @method \Illuminate\Support\Carbon|null createFromIsoFormat(string $format, string $time, $timezone = null, ?string $locale = 'en', ?\Symfony\Contracts\Translation\TranslatorInterface $translator = null)
* @method \Illuminate\Support\Carbon|null createFromLocaleFormat(string $format, string $locale, string $time, $timezone = null)
* @method \Illuminate\Support\Carbon|null createFromLocaleIsoFormat(string $format, string $locale, string $time, $timezone = null)
* @method \Illuminate\Support\Carbon createFromTime($hour = 0, $minute = 0, $second = 0, $timezone = null)
* @method \Illuminate\Support\Carbon createFromTimeString(string $time, \DateTimeZone|string|int|null $timezone = null)
* @method \Illuminate\Support\Carbon createFromTimestamp(string|int|float $timestamp, \DateTimeZone|string|int|null $timezone = null)
* @method \Illuminate\Support\Carbon createFromTimestampMs(string|int|float $timestamp, \DateTimeZone|string|int|null $timezone = null)
* @method \Illuminate\Support\Carbon createFromTimestampMsUTC($timestamp)
* @method \Illuminate\Support\Carbon createFromTimestampUTC(string|int|float $timestamp)
* @method \Illuminate\Support\Carbon createMidnightDate($year = null, $month = null, $day = null, $timezone = null)
* @method \Illuminate\Support\Carbon|null createSafe($year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, $timezone = null)
* @method \Illuminate\Support\Carbon createStrict(?int $year = 0, ?int $month = 1, ?int $day = 1, ?int $hour = 0, ?int $minute = 0, ?int $second = 0, $timezone = null)
* @method void disableHumanDiffOption($humanDiffOption)
* @method void enableHumanDiffOption($humanDiffOption)
* @method mixed executeWithLocale(string $locale, callable $func)
* @method \Illuminate\Support\Carbon fromSerialized($value)
* @method array getAvailableLocales()
* @method array getAvailableLocalesInfo()
* @method array getDays()
* @method ?string getFallbackLocale()
* @method array getFormatsToIsoReplacements()
* @method int getHumanDiffOptions()
* @method array getIsoUnits()
* @method array|false getLastErrors()
* @method string getLocale()
* @method int getMidDayAt()
* @method string getTimeFormatByPrecision(string $unitPrecision)
* @method string|\Closure|null getTranslationMessageWith($translator, string $key, ?string $locale = null, ?string $default = null)
* @method \Illuminate\Support\Carbon|null getTestNow()
* @method \Symfony\Contracts\Translation\TranslatorInterface getTranslator()
* @method int getWeekEndsAt(?string $locale = null)
* @method int getWeekStartsAt(?string $locale = null)
* @method array getWeekendDays()
* @method bool hasFormat(string $date, string $format)
* @method bool hasFormatWithModifiers(string $date, string $format)
* @method bool hasMacro($name)
* @method bool hasRelativeKeywords(?string $time)
* @method bool hasTestNow()
* @method \Illuminate\Support\Carbon instance(\DateTimeInterface $date)
* @method bool isImmutable()
* @method bool isModifiableUnit($unit)
* @method bool isMutable()
* @method bool isStrictModeEnabled()
* @method bool localeHasDiffOneDayWords(string $locale)
* @method bool localeHasDiffSyntax(string $locale)
* @method bool localeHasDiffTwoDayWords(string $locale)
* @method bool localeHasPeriodSyntax($locale)
* @method bool localeHasShortUnits(string $locale)
* @method void macro(string $name, ?callable $macro)
* @method \Illuminate\Support\Carbon|null make($var, \DateTimeZone|string|null $timezone = null)
* @method void mixin(object|string $mixin)
* @method \Illuminate\Support\Carbon now(\DateTimeZone|string|int|null $timezone = null)
* @method \Illuminate\Support\Carbon parse(\DateTimeInterface|\Carbon\WeekDay|\Carbon\Month|string|int|float|null $time, \DateTimeZone|string|int|null $timezone = null)
* @method \Illuminate\Support\Carbon parseFromLocale(string $time, ?string $locale = null, \DateTimeZone|string|int|null $timezone = null)
* @method string pluralUnit(string $unit)
* @method \Illuminate\Support\Carbon|null rawCreateFromFormat(string $format, string $time, $timezone = null)
* @method \Illuminate\Support\Carbon rawParse(\DateTimeInterface|\Carbon\WeekDay|\Carbon\Month|string|int|float|null $time, \DateTimeZone|string|int|null $timezone = null)
* @method void resetMonthsOverflow()
* @method void resetToStringFormat()
* @method void resetYearsOverflow()
* @method void serializeUsing($callback)
* @method void setFallbackLocale(string $locale)
* @method void setHumanDiffOptions($humanDiffOptions)
* @method void setLocale(string $locale)
* @method void setMidDayAt($hour)
* @method void setTestNow(mixed $testNow = null)
* @method void setTestNowAndTimezone(mixed $testNow = null, $timezone = null)
* @method void setToStringFormat(string|\Closure|null $format)
* @method void setTranslator(\Symfony\Contracts\Translation\TranslatorInterface $translator)
* @method void setWeekEndsAt($day)
* @method void setWeekStartsAt($day)
* @method void setWeekendDays($days)
* @method bool shouldOverflowMonths()
* @method bool shouldOverflowYears()
* @method string singularUnit(string $unit)
* @method void sleep(int|float $seconds)
* @method \Illuminate\Support\Carbon today(\DateTimeZone|string|int|null $timezone = null)
* @method \Illuminate\Support\Carbon tomorrow(\DateTimeZone|string|int|null $timezone = null)
* @method string translateTimeString(string $timeString, ?string $from = null, ?string $to = null, int $mode = \Carbon\CarbonInterface::TRANSLATE_ALL)
* @method string translateWith(\Symfony\Contracts\Translation\TranslatorInterface $translator, string $key, array $parameters = [], $number = null)
* @method void useMonthsOverflow($monthsOverflow = true)
* @method void useStrictMode($strictModeEnabled = true)
* @method void useYearsOverflow($yearsOverflow = true)
* @method mixed withTestNow(mixed $testNow, callable $callback)
* @method static withTimeZone(\DateTimeZone|string|int|null $timezone)
* @method \Illuminate\Support\Carbon yesterday(\DateTimeZone|string|int|null $timezone = 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 the date can be created using the 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());
}
}

View File

@@ -1,101 +0,0 @@
<?php
namespace Illuminate\Support;
class DefaultProviders
{
/**
* The current providers.
*
* @var array
*/
protected $providers;
/**
* Create a new default provider collection.
*/
public function __construct(?array $providers = null)
{
$this->providers = $providers ?: [
\Illuminate\Auth\AuthServiceProvider::class,
\Illuminate\Broadcasting\BroadcastServiceProvider::class,
\Illuminate\Bus\BusServiceProvider::class,
\Illuminate\Cache\CacheServiceProvider::class,
\Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
\Illuminate\Concurrency\ConcurrencyServiceProvider::class,
\Illuminate\Cookie\CookieServiceProvider::class,
\Illuminate\Database\DatabaseServiceProvider::class,
\Illuminate\Encryption\EncryptionServiceProvider::class,
\Illuminate\Filesystem\FilesystemServiceProvider::class,
\Illuminate\Foundation\Providers\FoundationServiceProvider::class,
\Illuminate\Hashing\HashServiceProvider::class,
\Illuminate\Mail\MailServiceProvider::class,
\Illuminate\Notifications\NotificationServiceProvider::class,
\Illuminate\Pagination\PaginationServiceProvider::class,
\Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
\Illuminate\Pipeline\PipelineServiceProvider::class,
\Illuminate\Queue\QueueServiceProvider::class,
\Illuminate\Redis\RedisServiceProvider::class,
\Illuminate\Session\SessionServiceProvider::class,
\Illuminate\Translation\TranslationServiceProvider::class,
\Illuminate\Validation\ValidationServiceProvider::class,
\Illuminate\View\ViewServiceProvider::class,
];
}
/**
* Merge the given providers into the provider collection.
*
* @param array $providers
* @return static
*/
public function merge(array $providers)
{
$this->providers = array_merge($this->providers, $providers);
return new static($this->providers);
}
/**
* Replace the given providers with other providers.
*
* @param array $replacements
* @return static
*/
public function replace(array $replacements)
{
$current = new Collection($this->providers);
foreach ($replacements as $from => $to) {
$key = $current->search($from);
$current = is_int($key) ? $current->replace([$key => $to]) : $current;
}
return new static($current->values()->toArray());
}
/**
* Disable the given providers.
*
* @param array $providers
* @return static
*/
public function except(array $providers)
{
return new static((new Collection($this->providers))
->reject(fn ($p) => in_array($p, $providers))
->values()
->toArray());
}
/**
* Convert the provider collection to an array.
*
* @return array
*/
public function toArray()
{
return $this->providers;
}
}

View File

@@ -1,54 +0,0 @@
<?php
namespace Illuminate\Support\Defer;
use Illuminate\Support\Str;
class DeferredCallback
{
/**
* Create a new deferred callback instance.
*
* @param callable $callback
*/
public function __construct(public $callback, public ?string $name = null, public bool $always = false)
{
$this->name = $name ?? (string) Str::uuid();
}
/**
* Specify the name of the deferred callback so it can be cancelled later.
*
* @param string $name
* @return $this
*/
public function name(string $name): static
{
$this->name = $name;
return $this;
}
/**
* Indicate that the deferred callback should run even on unsuccessful requests and jobs.
*
* @param bool $always
* @return $this
*/
public function always(bool $always = true): static
{
$this->always = $always;
return $this;
}
/**
* Invoke the deferred callback.
*
* @return void
*/
public function __invoke(): void
{
call_user_func($this->callback);
}
}

View File

@@ -1,157 +0,0 @@
<?php
namespace Illuminate\Support\Defer;
use ArrayAccess;
use Closure;
use Countable;
use Illuminate\Support\Collection;
class DeferredCallbackCollection implements ArrayAccess, Countable
{
/**
* All of the deferred callbacks.
*
* @var array
*/
protected array $callbacks = [];
/**
* Get the first callback in the collection.
*
* @return callable
*/
public function first()
{
return array_values($this->callbacks)[0];
}
/**
* Invoke the deferred callbacks.
*
* @return void
*/
public function invoke(): void
{
$this->invokeWhen(fn () => true);
}
/**
* Invoke the deferred callbacks if the given truth test evaluates to true.
*
* @param \Closure|null $when
* @return void
*/
public function invokeWhen(?Closure $when = null): void
{
$when ??= fn () => true;
$this->forgetDuplicates();
foreach ($this->callbacks as $index => $callback) {
if ($when($callback)) {
rescue($callback);
}
unset($this->callbacks[$index]);
}
}
/**
* Remove any deferred callbacks with the given name.
*
* @param string $name
* @return void
*/
public function forget(string $name): void
{
$this->callbacks = (new Collection($this->callbacks))
->reject(fn ($callback) => $callback->name === $name)
->values()
->all();
}
/**
* Remove any duplicate callbacks.
*
* @return $this
*/
protected function forgetDuplicates(): static
{
$this->callbacks = (new Collection($this->callbacks))
->reverse()
->unique(fn ($c) => $c->name)
->reverse()
->values()
->all();
return $this;
}
/**
* Determine if the collection has a callback with the given key.
*
* @param mixed $offset
* @return bool
*/
public function offsetExists(mixed $offset): bool
{
$this->forgetDuplicates();
return isset($this->callbacks[$offset]);
}
/**
* Get the callback with the given key.
*
* @param mixed $offset
* @return mixed
*/
public function offsetGet(mixed $offset): mixed
{
$this->forgetDuplicates();
return $this->callbacks[$offset];
}
/**
* Set the callback with the given key.
*
* @param mixed $offset
* @param mixed $value
* @return void
*/
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->callbacks[] = $value;
} else {
$this->callbacks[$offset] = $value;
}
}
/**
* Remove the callback with the given key from the collection.
*
* @param mixed $offset
* @return void
*/
public function offsetUnset(mixed $offset): void
{
$this->forgetDuplicates();
unset($this->callbacks[$offset]);
}
/**
* Determine how many callbacks are in the collection.
*
* @return int
*/
public function count(): int
{
$this->forgetDuplicates();
return count($this->callbacks);
}
}

View File

@@ -1,100 +0,0 @@
<?php
namespace Illuminate\Support;
use BackedEnum;
use Illuminate\Contracts\Support\DeferringDisplayableValue;
use Illuminate\Contracts\Support\Htmlable;
class EncodedHtmlString extends HtmlString
{
/**
* The HTML string.
*
* @var \Illuminate\Contracts\Support\DeferringDisplayableValue|\Illuminate\Contracts\Support\Htmlable|\BackedEnum|string|int|float|null
*/
protected $html;
/**
* The callback that should be used to encode the HTML strings.
*
* @var callable|null
*/
protected static $encodeUsingFactory;
/**
* Create a new encoded HTML string instance.
*
* @param \Illuminate\Contracts\Support\DeferringDisplayableValue|\Illuminate\Contracts\Support\Htmlable|\BackedEnum|string|int|float|null $html
* @param bool $doubleEncode
*/
public function __construct($html = '', protected bool $doubleEncode = true)
{
parent::__construct($html);
}
/**
* Convert the special characters in the given value.
*
* @internal
*
* @param string|null $value
* @param int $withQuote
* @param bool $doubleEncode
* @return string
*/
public static function convert($value, bool $withQuote = true, bool $doubleEncode = true)
{
$flag = $withQuote ? ENT_QUOTES : ENT_NOQUOTES;
return htmlspecialchars($value ?? '', $flag | ENT_SUBSTITUTE, 'UTF-8', $doubleEncode);
}
/**
* Get the HTML string.
*
* @return string
*/
#[\Override]
public function toHtml()
{
$value = $this->html;
if ($value instanceof DeferringDisplayableValue) {
$value = $value->resolveDisplayableValue();
}
if ($value instanceof Htmlable) {
return $value->toHtml();
}
if ($value instanceof BackedEnum) {
$value = $value->value;
}
return (static::$encodeUsingFactory ?? function ($value, $doubleEncode) {
return static::convert($value, doubleEncode: $doubleEncode);
})($value, $this->doubleEncode);
}
/**
* Set the callable that will be used to encode the HTML strings.
*
* @param callable|null $factory
* @return void
*/
public static function encodeUsing(?callable $factory = null)
{
static::$encodeUsingFactory = $factory;
}
/**
* Flush the class's global state.
*
* @return void
*/
public static function flushState()
{
static::$encodeUsingFactory = null;
}
}

View File

@@ -1,309 +0,0 @@
<?php
namespace Illuminate\Support;
use Closure;
use Dotenv\Repository\Adapter\PutenvAdapter;
use Dotenv\Repository\RepositoryBuilder;
use Illuminate\Filesystem\Filesystem;
use PhpOption\Option;
use RuntimeException;
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;
/**
* The list of custom adapters for loading environment variables.
*
* @var array<Closure>
*/
protected static $customAdapters = [];
/**
* 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;
}
/**
* Register a custom adapter creator Closure.
*/
public static function extend(Closure $callback, ?string $name = null): void
{
if (! is_null($name)) {
static::$customAdapters[$name] = $callback;
} else {
static::$customAdapters[] = $callback;
}
static::$repository = null;
}
/**
* Get the environment repository instance.
*
* @return \Dotenv\Repository\RepositoryInterface
*/
public static function getRepository()
{
if (static::$repository === null) {
$builder = RepositoryBuilder::createWithDefaultAdapters();
if (static::$putenv) {
$builder = $builder->addAdapter(PutenvAdapter::class);
}
foreach (static::$customAdapters as $adapter) {
$builder = $builder->addAdapter($adapter());
}
static::$repository = $builder->immutable()->make();
}
return static::$repository;
}
/**
* Get the value of an environment variable.
*
* @param string $key
* @param mixed $default
* @return mixed
*/
public static function get($key, $default = null)
{
return self::getOption($key)->getOrCall(fn () => value($default));
}
/**
* Get the value of a required environment variable.
*
* @param string $key
* @return mixed
*
* @throws \RuntimeException
*/
public static function getOrFail($key)
{
return self::getOption($key)->getOrThrow(new RuntimeException("Environment variable [$key] has no value."));
}
/**
* Write an array of key-value pairs to the environment file.
*
* @param array $variables
* @param string $pathToFile
* @param bool $overwrite
* @return void
*
* @throws \RuntimeException
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
*/
public static function writeVariables(array $variables, string $pathToFile, bool $overwrite = false): void
{
$filesystem = new Filesystem;
if ($filesystem->missing($pathToFile)) {
throw new RuntimeException("The file [{$pathToFile}] does not exist.");
}
$lines = explode(PHP_EOL, $filesystem->get($pathToFile));
foreach ($variables as $key => $value) {
$lines = self::addVariableToEnvContents($key, $value, $lines, $overwrite);
}
$filesystem->put($pathToFile, implode(PHP_EOL, $lines));
}
/**
* Write a single key-value pair to the environment file.
*
* @param string $key
* @param mixed $value
* @param string $pathToFile
* @param bool $overwrite
* @return void
*
* @throws \RuntimeException
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
*/
public static function writeVariable(string $key, mixed $value, string $pathToFile, bool $overwrite = false): void
{
$filesystem = new Filesystem;
if ($filesystem->missing($pathToFile)) {
throw new RuntimeException("The file [{$pathToFile}] does not exist.");
}
$envContent = $filesystem->get($pathToFile);
$lines = explode(PHP_EOL, $envContent);
$lines = self::addVariableToEnvContents($key, $value, $lines, $overwrite);
$filesystem->put($pathToFile, implode(PHP_EOL, $lines));
}
/**
* Add a variable to the environment file contents.
*
* @param string $key
* @param mixed $value
* @param array $envLines
* @param bool $overwrite
* @return array
*/
protected static function addVariableToEnvContents(string $key, mixed $value, array $envLines, bool $overwrite): array
{
$prefix = explode('_', $key)[0].'_';
$lastPrefixIndex = -1;
$shouldQuote = preg_match('/^[a-zA-Z0-9]+$/', $value) === 0;
$lineToAddVariations = [
$key.'='.(is_string($value) ? self::prepareQuotedValue($value) : $value),
$key.'='.$value,
];
$lineToAdd = $shouldQuote ? $lineToAddVariations[0] : $lineToAddVariations[1];
if ($value === '') {
$lineToAdd = $key.'=';
}
foreach ($envLines as $index => $line) {
if (str_starts_with($line, $prefix)) {
$lastPrefixIndex = $index;
}
if (in_array($line, $lineToAddVariations)) {
// This exact line already exists, so we don't need to add it again.
return $envLines;
}
if ($line === $key.'=') {
// If the value is empty, we can replace it with the new value.
$envLines[$index] = $lineToAdd;
return $envLines;
}
if (str_starts_with($line, $key.'=')) {
if (! $overwrite) {
return $envLines;
}
$envLines[$index] = $lineToAdd;
return $envLines;
}
}
if ($lastPrefixIndex === -1) {
if (count($envLines) && $envLines[count($envLines) - 1] !== '') {
$envLines[] = '';
}
return array_merge($envLines, [$lineToAdd]);
}
return array_merge(
array_slice($envLines, 0, $lastPrefixIndex + 1),
[$lineToAdd],
array_slice($envLines, $lastPrefixIndex + 1)
);
}
/**
* Get the possible option for this environment variable.
*
* @param string $key
* @return \PhpOption\Option|\PhpOption\Some
*/
protected static function getOption($key)
{
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;
});
}
/**
* Wrap a string in quotes, choosing double or single quotes.
*
* @param string $input
* @return string
*/
protected static function prepareQuotedValue(string $input)
{
return str_contains($input, '"')
? "'".self::addSlashesExceptFor($input, ['"'])."'"
: '"'.self::addSlashesExceptFor($input, ["'"]).'"';
}
/**
* Escape a string using addslashes, excluding the specified characters from being escaped.
*
* @param string $value
* @param array $except
* @return string
*/
protected static function addSlashesExceptFor(string $value, array $except = [])
{
$escaped = addslashes($value);
foreach ($except as $character) {
$escaped = str_replace('\\'.$character, $character, $escaped);
}
return $escaped;
}
}

View File

@@ -1,10 +0,0 @@
<?php
namespace Illuminate\Support\Exceptions;
use RuntimeException;
class MathException extends RuntimeException
{
//
}

View File

@@ -1,162 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
/**
* @method static \Illuminate\Foundation\Configuration\ApplicationBuilder configure(string|null $basePath = null)
* @method static string inferBasePath()
* @method static string version()
* @method static void bootstrapWith(string[] $bootstrappers)
* @method static void afterLoadingEnvironment(\Closure $callback)
* @method static void beforeBootstrapping(string $bootstrapper, \Closure $callback)
* @method static void afterBootstrapping(string $bootstrapper, \Closure $callback)
* @method static bool hasBeenBootstrapped()
* @method static \Illuminate\Foundation\Application setBasePath(string $basePath)
* @method static string path(string $path = '')
* @method static \Illuminate\Foundation\Application useAppPath(string $path)
* @method static string basePath(string $path = '')
* @method static string bootstrapPath(string $path = '')
* @method static string getBootstrapProvidersPath()
* @method static \Illuminate\Foundation\Application useBootstrapPath(string $path)
* @method static string configPath(string $path = '')
* @method static \Illuminate\Foundation\Application useConfigPath(string $path)
* @method static string databasePath(string $path = '')
* @method static \Illuminate\Foundation\Application useDatabasePath(string $path)
* @method static string langPath(string $path = '')
* @method static \Illuminate\Foundation\Application useLangPath(string $path)
* @method static string publicPath(string $path = '')
* @method static \Illuminate\Foundation\Application usePublicPath(string $path)
* @method static string storagePath(string $path = '')
* @method static \Illuminate\Foundation\Application useStoragePath(string $path)
* @method static string resourcePath(string $path = '')
* @method static string viewPath(string $path = '')
* @method static string joinPaths(string $basePath, string $path = '')
* @method static string environmentPath()
* @method static \Illuminate\Foundation\Application useEnvironmentPath(string $path)
* @method static \Illuminate\Foundation\Application loadEnvironmentFrom(string $file)
* @method static string environmentFile()
* @method static string environmentFilePath()
* @method static string|bool environment(string|array ...$environments)
* @method static bool isLocal()
* @method static bool isProduction()
* @method static string detectEnvironment(\Closure $callback)
* @method static bool runningInConsole()
* @method static bool runningConsoleCommand(string|array ...$commands)
* @method static bool runningUnitTests()
* @method static bool hasDebugModeEnabled()
* @method static void registered(callable $callback)
* @method static void registerConfiguredProviders()
* @method static \Illuminate\Support\ServiceProvider register(\Illuminate\Support\ServiceProvider|string $provider, bool $force = false)
* @method static \Illuminate\Support\ServiceProvider|null getProvider(\Illuminate\Support\ServiceProvider|string $provider)
* @method static array getProviders(\Illuminate\Support\ServiceProvider|string $provider)
* @method static \Illuminate\Support\ServiceProvider resolveProvider(string $provider)
* @method static void loadDeferredProviders()
* @method static void loadDeferredProvider(string $service)
* @method static void registerDeferredProvider(string $provider, string|null $service = null)
* @method static object|mixed make(string $abstract, array $parameters = [])
* @method static bool bound(string $abstract)
* @method static bool isBooted()
* @method static void boot()
* @method static void booting(callable $callback)
* @method static void booted(callable $callback)
* @method static \Symfony\Component\HttpFoundation\Response handle(\Symfony\Component\HttpFoundation\Request $request, int $type = 1, bool $catch = true)
* @method static void handleRequest(\Illuminate\Http\Request $request)
* @method static int handleCommand(\Symfony\Component\Console\Input\InputInterface $input)
* @method static bool shouldMergeFrameworkConfiguration()
* @method static \Illuminate\Foundation\Application dontMergeFrameworkConfiguration()
* @method static bool shouldSkipMiddleware()
* @method static string getCachedServicesPath()
* @method static string getCachedPackagesPath()
* @method static bool configurationIsCached()
* @method static string getCachedConfigPath()
* @method static bool routesAreCached()
* @method static string getCachedRoutesPath()
* @method static bool eventsAreCached()
* @method static string getCachedEventsPath()
* @method static \Illuminate\Foundation\Application addAbsoluteCachePathPrefix(string $prefix)
* @method static \Illuminate\Contracts\Foundation\MaintenanceMode maintenanceMode()
* @method static bool isDownForMaintenance()
* @method static never abort(int $code, string $message = '', array $headers = [])
* @method static \Illuminate\Foundation\Application terminating(callable|string $callback)
* @method static void terminate()
* @method static array getLoadedProviders()
* @method static bool providerIsLoaded(string $provider)
* @method static array getDeferredServices()
* @method static void setDeferredServices(array $services)
* @method static bool isDeferredService(string $service)
* @method static void addDeferredServices(array $services)
* @method static void removeDeferredServices(array $services)
* @method static void provideFacades(string $namespace)
* @method static string getLocale()
* @method static string currentLocale()
* @method static string getFallbackLocale()
* @method static void setLocale(string $locale)
* @method static void setFallbackLocale(string $fallbackLocale)
* @method static bool isLocale(string $locale)
* @method static void registerCoreContainerAliases()
* @method static void flush()
* @method static string getNamespace()
* @method static \Illuminate\Contracts\Container\ContextualBindingBuilder when(array|string $concrete)
* @method static void whenHasAttribute(string $attribute, \Closure $handler)
* @method static bool has(string $id)
* @method static bool isShared(string $abstract)
* @method static bool isAlias(string $name)
* @method static void bind(\Closure|string $abstract, \Closure|string|null $concrete = null, bool $shared = false)
* @method static bool hasMethodBinding(string $method)
* @method static void bindMethod(array|string $method, \Closure $callback)
* @method static mixed callMethodBinding(string $method, mixed $instance)
* @method static void addContextualBinding(string $concrete, \Closure|string $abstract, \Closure|string $implementation)
* @method static void bindIf(\Closure|string $abstract, \Closure|string|null $concrete = null, bool $shared = false)
* @method static void singleton(\Closure|string $abstract, \Closure|string|null $concrete = null)
* @method static void singletonIf(\Closure|string $abstract, \Closure|string|null $concrete = null)
* @method static void scoped(\Closure|string $abstract, \Closure|string|null $concrete = null)
* @method static void scopedIf(\Closure|string $abstract, \Closure|string|null $concrete = null)
* @method static void extend(string $abstract, \Closure $closure)
* @method static mixed instance(string $abstract, mixed $instance)
* @method static void tag(array|string $abstracts, mixed $tags)
* @method static iterable tagged(string $tag)
* @method static void alias(string $abstract, string $alias)
* @method static mixed rebinding(string $abstract, \Closure $callback)
* @method static mixed refresh(string $abstract, mixed $target, string $method)
* @method static \Closure wrap(\Closure $callback, array $parameters = [])
* @method static mixed call(callable|string $callback, array $parameters = [], string|null $defaultMethod = null)
* @method static \Closure|\Closure factory(string $abstract)
* @method static object|mixed makeWith(string|callable $abstract, array $parameters = [])
* @method static object|mixed get(string $id)
* @method static object build(\Closure|string $concrete)
* @method static mixed resolveFromAttribute(\ReflectionAttribute $attribute)
* @method static void beforeResolving(\Closure|string $abstract, \Closure|null $callback = null)
* @method static void resolving(\Closure|string $abstract, \Closure|null $callback = null)
* @method static void afterResolving(\Closure|string $abstract, \Closure|null $callback = null)
* @method static void afterResolvingAttribute(string $attribute, \Closure $callback)
* @method static void fireAfterResolvingAttributeCallbacks(\ReflectionAttribute[] $attributes, mixed $object)
* @method static string|null currentlyResolving()
* @method static array getBindings()
* @method static string getAlias(string $abstract)
* @method static void forgetExtenders(string $abstract)
* @method static void forgetInstance(string $abstract)
* @method static void forgetInstances()
* @method static void forgetScopedInstances()
* @method static void resolveEnvironmentUsing(callable|string|null $callback)
* @method static bool currentEnvironmentIs(array|string $environments)
* @method static \Illuminate\Foundation\Application getInstance()
* @method static \Illuminate\Contracts\Container\Container|\Illuminate\Foundation\Application setInstance(\Illuminate\Contracts\Container\Container|null $container = null)
* @method static void macro(string $name, object|callable $macro)
* @method static void mixin(object $mixin, bool $replace = true)
* @method static bool hasMacro(string $name)
* @method static void flushMacros()
*
* @see \Illuminate\Foundation\Application
*/
class App extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'app';
}
}

View File

@@ -1,39 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
use Illuminate\Contracts\Console\Kernel as ConsoleKernelContract;
/**
* @method static int handle(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface|null $output = null)
* @method static void terminate(\Symfony\Component\Console\Input\InputInterface $input, int $status)
* @method static void whenCommandLifecycleIsLongerThan(\DateTimeInterface|\Carbon\CarbonInterval|float|int $threshold, callable $handler)
* @method static \Illuminate\Support\Carbon|null commandStartedAt()
* @method static \Illuminate\Console\Scheduling\Schedule resolveConsoleSchedule()
* @method static \Illuminate\Foundation\Console\ClosureCommand command(string $signature, \Closure $callback)
* @method static void registerCommand(\Symfony\Component\Console\Command\Command $command)
* @method static int call(\Symfony\Component\Console\Command\Command|string $command, array $parameters = [], \Symfony\Component\Console\Output\OutputInterface|null $outputBuffer = null)
* @method static \Illuminate\Foundation\Bus\PendingDispatch queue(string $command, array $parameters = [])
* @method static array all()
* @method static string output()
* @method static void bootstrap()
* @method static void bootstrapWithoutBootingProviders()
* @method static void setArtisan(\Illuminate\Console\Application|null $artisan)
* @method static \Illuminate\Foundation\Console\Kernel addCommands(array $commands)
* @method static \Illuminate\Foundation\Console\Kernel addCommandPaths(array $paths)
* @method static \Illuminate\Foundation\Console\Kernel addCommandRoutePaths(array $paths)
*
* @see \Illuminate\Foundation\Console\Kernel
*/
class Artisan extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return ConsoleKernelContract::class;
}
}

View File

@@ -1,99 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
use Laravel\Ui\UiServiceProvider;
use RuntimeException;
/**
* @method static \Illuminate\Contracts\Auth\Guard|\Illuminate\Contracts\Auth\StatefulGuard guard(string|null $name = null)
* @method static \Illuminate\Auth\SessionGuard createSessionDriver(string $name, array $config)
* @method static \Illuminate\Auth\TokenGuard createTokenDriver(string $name, array $config)
* @method static string getDefaultDriver()
* @method static void shouldUse(string $name)
* @method static void setDefaultDriver(string $name)
* @method static \Illuminate\Auth\AuthManager viaRequest(string $driver, callable $callback)
* @method static \Closure userResolver()
* @method static \Illuminate\Auth\AuthManager resolveUsersUsing(\Closure $userResolver)
* @method static \Illuminate\Auth\AuthManager extend(string $driver, \Closure $callback)
* @method static \Illuminate\Auth\AuthManager provider(string $name, \Closure $callback)
* @method static bool hasResolvedGuards()
* @method static \Illuminate\Auth\AuthManager forgetGuards()
* @method static \Illuminate\Auth\AuthManager setApplication(\Illuminate\Contracts\Foundation\Application $app)
* @method static \Illuminate\Contracts\Auth\UserProvider|null createUserProvider(string|null $provider = null)
* @method static string getDefaultUserProvider()
* @method static bool check()
* @method static bool guest()
* @method static \Illuminate\Contracts\Auth\Authenticatable|null user()
* @method static int|string|null id()
* @method static bool validate(array $credentials = [])
* @method static bool hasUser()
* @method static \Illuminate\Contracts\Auth\Guard setUser(\Illuminate\Contracts\Auth\Authenticatable $user)
* @method static bool attempt(array $credentials = [], bool $remember = false)
* @method static bool once(array $credentials = [])
* @method static void login(\Illuminate\Contracts\Auth\Authenticatable $user, bool $remember = false)
* @method static \Illuminate\Contracts\Auth\Authenticatable|false loginUsingId(mixed $id, bool $remember = false)
* @method static \Illuminate\Contracts\Auth\Authenticatable|false onceUsingId(mixed $id)
* @method static bool viaRemember()
* @method static void logout()
* @method static \Symfony\Component\HttpFoundation\Response|null basic(string $field = 'email', array $extraConditions = [])
* @method static \Symfony\Component\HttpFoundation\Response|null onceBasic(string $field = 'email', array $extraConditions = [])
* @method static bool attemptWhen(array $credentials = [], array|callable|null $callbacks = null, bool $remember = false)
* @method static string hashPasswordForCookie(string $passwordHash)
* @method static void logoutCurrentDevice()
* @method static \Illuminate\Contracts\Auth\Authenticatable|null logoutOtherDevices(string $password)
* @method static void attempting(mixed $callback)
* @method static \Illuminate\Contracts\Auth\Authenticatable getLastAttempted()
* @method static string getName()
* @method static string getRecallerName()
* @method static \Illuminate\Auth\SessionGuard setRememberDuration(int $minutes)
* @method static \Illuminate\Contracts\Cookie\QueueingFactory getCookieJar()
* @method static void setCookieJar(\Illuminate\Contracts\Cookie\QueueingFactory $cookie)
* @method static \Illuminate\Contracts\Events\Dispatcher getDispatcher()
* @method static void setDispatcher(\Illuminate\Contracts\Events\Dispatcher $events)
* @method static \Illuminate\Contracts\Session\Session getSession()
* @method static \Illuminate\Contracts\Auth\Authenticatable|null getUser()
* @method static \Symfony\Component\HttpFoundation\Request getRequest()
* @method static \Illuminate\Auth\SessionGuard setRequest(\Symfony\Component\HttpFoundation\Request $request)
* @method static \Illuminate\Support\Timebox getTimebox()
* @method static \Illuminate\Contracts\Auth\Authenticatable authenticate()
* @method static \Illuminate\Auth\SessionGuard forgetUser()
* @method static \Illuminate\Contracts\Auth\UserProvider getProvider()
* @method static void setProvider(\Illuminate\Contracts\Auth\UserProvider $provider)
* @method static void macro(string $name, object|callable $macro)
* @method static void mixin(object $mixin, bool $replace = true)
* @method static bool hasMacro(string $name)
* @method static void flushMacros()
*
* @see \Illuminate\Auth\AuthManager
* @see \Illuminate\Auth\SessionGuard
*/
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
*
* @throws \RuntimeException
*/
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);
}
}

View File

@@ -1,63 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
/**
* @method static void compile(string|null $path = null)
* @method static string getPath()
* @method static void setPath(string $path)
* @method static string compileString(string $value)
* @method static string render(string $string, array $data = [], bool $deleteCachedView = false)
* @method static string renderComponent(\Illuminate\View\Component $component)
* @method static string stripParentheses(string $expression)
* @method static void extend(callable $compiler)
* @method static array getExtensions()
* @method static void if(string $name, callable $callback)
* @method static bool check(string $name, mixed ...$parameters)
* @method static void component(string $class, string|null $alias = null, string $prefix = '')
* @method static void components(array $components, string $prefix = '')
* @method static array getClassComponentAliases()
* @method static void anonymousComponentPath(string $path, string|null $prefix = null)
* @method static void anonymousComponentNamespace(string $directory, string|null $prefix = null)
* @method static void componentNamespace(string $namespace, string $prefix)
* @method static array getAnonymousComponentPaths()
* @method static array getAnonymousComponentNamespaces()
* @method static array getClassComponentNamespaces()
* @method static void aliasComponent(string $path, string|null $alias = null)
* @method static void include(string $path, string|null $alias = null)
* @method static void aliasInclude(string $path, string|null $alias = null)
* @method static void bindDirective(string $name, callable $handler)
* @method static void directive(string $name, \Closure|callable $handler, bool $bind = false)
* @method static array getCustomDirectives()
* @method static \Illuminate\View\Compilers\BladeCompiler prepareStringsForCompilationUsing(callable $callback)
* @method static void precompiler(callable $precompiler)
* @method static string usingEchoFormat(string $format, callable $callback)
* @method static void setEchoFormat(string $format)
* @method static void withDoubleEncoding()
* @method static void withoutDoubleEncoding()
* @method static void withoutComponentTags()
* @method static string getCompiledPath(string $path)
* @method static bool isExpired(string $path)
* @method static string newComponentHash(string $component)
* @method static string compileClassComponentOpening(string $component, string $alias, string $data, string $hash)
* @method static string compileEndComponentClass()
* @method static mixed sanitizeComponentAttribute(mixed $value)
* @method static string compileEndOnce()
* @method static void stringable(string|callable $class, callable|null $handler = null)
* @method static string compileEchos(string $value)
* @method static string applyEchoHandler(string $value)
*
* @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';
}
}

View File

@@ -1,50 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
use Illuminate\Contracts\Broadcasting\Factory as BroadcastingFactoryContract;
/**
* @method static void routes(array|null $attributes = null)
* @method static void userRoutes(array|null $attributes = null)
* @method static void channelRoutes(array|null $attributes = null)
* @method static string|null socket(\Illuminate\Http\Request|null $request = null)
* @method static \Illuminate\Broadcasting\AnonymousEvent on(\Illuminate\Broadcasting\Channel|array|string $channels)
* @method static \Illuminate\Broadcasting\AnonymousEvent private(string $channel)
* @method static \Illuminate\Broadcasting\AnonymousEvent presence(string $channel)
* @method static \Illuminate\Broadcasting\PendingBroadcast event(mixed $event = null)
* @method static void queue(mixed $event)
* @method static mixed connection(string|null $driver = null)
* @method static mixed driver(string|null $name = null)
* @method static \Pusher\Pusher pusher(array $config)
* @method static \Ably\AblyRest ably(array $config)
* @method static string getDefaultDriver()
* @method static void setDefaultDriver(string $name)
* @method static void purge(string|null $name = null)
* @method static \Illuminate\Broadcasting\BroadcastManager extend(string $driver, \Closure $callback)
* @method static \Illuminate\Contracts\Foundation\Application getApplication()
* @method static \Illuminate\Broadcasting\BroadcastManager setApplication(\Illuminate\Contracts\Foundation\Application $app)
* @method static \Illuminate\Broadcasting\BroadcastManager forgetDrivers()
* @method static mixed auth(\Illuminate\Http\Request $request)
* @method static mixed validAuthenticationResponse(\Illuminate\Http\Request $request, mixed $result)
* @method static void broadcast(array $channels, string $event, array $payload = [])
* @method static array|null resolveAuthenticatedUser(\Illuminate\Http\Request $request)
* @method static void resolveAuthenticatedUserUsing(\Closure $callback)
* @method static \Illuminate\Broadcasting\Broadcasters\Broadcaster channel(\Illuminate\Contracts\Broadcasting\HasBroadcastChannel|string $channel, callable|string $callback, array $options = [])
* @method static \Illuminate\Support\Collection getChannels()
*
* @see \Illuminate\Broadcasting\BroadcastManager
* @see \Illuminate\Broadcasting\Broadcasters\Broadcaster
*/
class Broadcast extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return BroadcastingFactoryContract::class;
}
}

View File

@@ -1,103 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
use Illuminate\Bus\BatchRepository;
use Illuminate\Contracts\Bus\Dispatcher as BusDispatcherContract;
use Illuminate\Foundation\Bus\PendingChain;
use Illuminate\Support\Testing\Fakes\BusFake;
/**
* @method static mixed dispatch(mixed $command)
* @method static mixed dispatchSync(mixed $command, mixed $handler = null)
* @method static mixed dispatchNow(mixed $command, mixed $handler = null)
* @method static \Illuminate\Bus\Batch|null findBatch(string $batchId)
* @method static \Illuminate\Bus\PendingBatch batch(\Illuminate\Support\Collection|mixed $jobs)
* @method static \Illuminate\Foundation\Bus\PendingChain chain(\Illuminate\Support\Collection|array|null $jobs = null)
* @method static bool hasCommandHandler(mixed $command)
* @method static mixed getCommandHandler(mixed $command)
* @method static mixed dispatchToQueue(mixed $command)
* @method static void dispatchAfterResponse(mixed $command, mixed $handler = null)
* @method static \Illuminate\Bus\Dispatcher pipeThrough(array $pipes)
* @method static \Illuminate\Bus\Dispatcher map(array $map)
* @method static \Illuminate\Bus\Dispatcher withDispatchingAfterResponses()
* @method static \Illuminate\Bus\Dispatcher withoutDispatchingAfterResponses()
* @method static \Illuminate\Support\Testing\Fakes\BusFake except(array|string $jobsToDispatch)
* @method static void assertDispatched(string|\Closure $command, callable|int|null $callback = null)
* @method static void assertDispatchedOnce(string|\Closure $command)
* @method static void assertDispatchedTimes(string|\Closure $command, int $times = 1)
* @method static void assertNotDispatched(string|\Closure $command, callable|null $callback = null)
* @method static void assertNothingDispatched()
* @method static void assertDispatchedSync(string|\Closure $command, callable|int|null $callback = null)
* @method static void assertDispatchedSyncTimes(string|\Closure $command, int $times = 1)
* @method static void assertNotDispatchedSync(string|\Closure $command, callable|null $callback = null)
* @method static void assertDispatchedAfterResponse(string|\Closure $command, callable|int|null $callback = null)
* @method static void assertDispatchedAfterResponseTimes(string|\Closure $command, int $times = 1)
* @method static void assertNotDispatchedAfterResponse(string|\Closure $command, callable|null $callback = null)
* @method static void assertChained(array $expectedChain)
* @method static void assertNothingChained()
* @method static void assertDispatchedWithoutChain(string|\Closure $command, callable|null $callback = null)
* @method static \Illuminate\Support\Testing\Fakes\ChainedBatchTruthTest chainedBatch(\Closure $callback)
* @method static void assertBatched(array|callable $callback)
* @method static void assertBatchCount(int $count)
* @method static void assertNothingBatched()
* @method static void assertNothingPlaced()
* @method static \Illuminate\Support\Collection dispatched(string $command, callable|null $callback = null)
* @method static \Illuminate\Support\Collection dispatchedSync(string $command, callable|null $callback = null)
* @method static \Illuminate\Support\Collection dispatchedAfterResponse(string $command, callable|null $callback = null)
* @method static \Illuminate\Support\Collection batched(callable $callback)
* @method static bool hasDispatched(string $command)
* @method static bool hasDispatchedSync(string $command)
* @method static bool hasDispatchedAfterResponse(string $command)
* @method static \Illuminate\Bus\Batch dispatchFakeBatch(string $name = '')
* @method static \Illuminate\Bus\Batch recordPendingBatch(\Illuminate\Bus\PendingBatch $pendingBatch)
* @method static \Illuminate\Support\Testing\Fakes\BusFake serializeAndRestore(bool $serializeAndRestore = true)
* @method static array dispatchedBatches()
*
* @see \Illuminate\Bus\Dispatcher
* @see \Illuminate\Support\Testing\Fakes\BusFake
*/
class Bus extends Facade
{
/**
* Replace the bound instance with a fake.
*
* @param array|string $jobsToFake
* @param \Illuminate\Bus\BatchRepository|null $batchRepository
* @return \Illuminate\Support\Testing\Fakes\BusFake
*/
public static function fake($jobsToFake = [], ?BatchRepository $batchRepository = null)
{
$actualDispatcher = static::isFake()
? static::getFacadeRoot()->dispatcher
: static::getFacadeRoot();
return tap(new BusFake($actualDispatcher, $jobsToFake, $batchRepository), function ($fake) {
static::swap($fake);
});
}
/**
* Dispatch the given chain of jobs.
*
* @param 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;
}
}

View File

@@ -1,106 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
use Mockery;
/**
* @method static \Illuminate\Contracts\Cache\Repository store(string|null $name = null)
* @method static \Illuminate\Contracts\Cache\Repository driver(string|null $driver = null)
* @method static \Illuminate\Contracts\Cache\Repository memo(string|null $driver = null)
* @method static \Illuminate\Contracts\Cache\Repository resolve(string $name)
* @method static \Illuminate\Cache\Repository build(array $config)
* @method static \Illuminate\Cache\Repository repository(\Illuminate\Contracts\Cache\Store $store, array $config = [])
* @method static void refreshEventDispatcher()
* @method static string getDefaultDriver()
* @method static void setDefaultDriver(string $name)
* @method static \Illuminate\Cache\CacheManager forgetDriver(array|string|null $name = null)
* @method static void purge(string|null $name = null)
* @method static \Illuminate\Cache\CacheManager extend(string $driver, \Closure $callback)
* @method static \Illuminate\Cache\CacheManager setApplication(\Illuminate\Contracts\Foundation\Application $app)
* @method static bool has(\UnitEnum|array|string $key)
* @method static bool missing(\UnitEnum|string $key)
* @method static mixed get(\UnitEnum|array|string $key, mixed $default = null)
* @method static array many(array $keys)
* @method static iterable getMultiple(iterable $keys, mixed $default = null)
* @method static mixed pull(\UnitEnum|array|string $key, mixed $default = null)
* @method static string string(\UnitEnum|string $key, \Closure|string|null $default = null)
* @method static int integer(\UnitEnum|string $key, \Closure|int|null $default = null)
* @method static float float(\UnitEnum|string $key, \Closure|float|null $default = null)
* @method static bool boolean(\UnitEnum|string $key, \Closure|bool|null $default = null)
* @method static array array(\UnitEnum|string $key, \Closure|array|null $default = null)
* @method static bool put(\UnitEnum|array|string $key, mixed $value, \DateTimeInterface|\DateInterval|int|null $ttl = null)
* @method static bool set(\UnitEnum|array|string $key, mixed $value, \DateTimeInterface|\DateInterval|int|null $ttl = null)
* @method static bool putMany(array $values, \DateTimeInterface|\DateInterval|int|null $ttl = null)
* @method static bool setMultiple(iterable $values, null|int|\DateInterval $ttl = null)
* @method static bool add(\UnitEnum|array|string $key, mixed $value, \DateTimeInterface|\DateInterval|int|null $ttl = null)
* @method static int|bool increment(\UnitEnum|string $key, mixed $value = 1)
* @method static int|bool decrement(\UnitEnum|string $key, mixed $value = 1)
* @method static bool forever(\UnitEnum|string $key, mixed $value)
* @method static mixed remember(\UnitEnum|string $key, \Closure|\DateTimeInterface|\DateInterval|int|null $ttl, \Closure $callback)
* @method static mixed sear(\UnitEnum|string $key, \Closure $callback)
* @method static mixed rememberForever(\UnitEnum|string $key, \Closure $callback)
* @method static mixed flexible(\UnitEnum|string $key, array $ttl, callable $callback, array|null $lock = null, bool $alwaysDefer = false)
* @method static mixed withoutOverlapping(\UnitEnum|string $key, callable $callback, int $lockFor = 0, int $waitFor = 10, string|null $owner = null)
* @method static \Illuminate\Cache\Limiters\ConcurrencyLimiterBuilder funnel(\UnitEnum|string $name)
* @method static bool forget(\UnitEnum|array|string $key)
* @method static bool delete(\UnitEnum|array|string $key)
* @method static bool deleteMultiple(iterable $keys)
* @method static bool clear()
* @method static \Illuminate\Cache\TaggedCache tags(mixed $names)
* @method static string|null getName()
* @method static bool supportsTags()
* @method static int|null getDefaultCacheTime()
* @method static \Illuminate\Cache\Repository setDefaultCacheTime(int|null $seconds)
* @method static \Illuminate\Contracts\Cache\Store getStore()
* @method static \Illuminate\Cache\Repository setStore(\Illuminate\Contracts\Cache\Store $store)
* @method static \Illuminate\Contracts\Events\Dispatcher|null getEventDispatcher()
* @method static void setEventDispatcher(\Illuminate\Contracts\Events\Dispatcher $events)
* @method static void macro(string $name, object|callable $macro)
* @method static void mixin(object $mixin, bool $replace = true)
* @method static bool hasMacro(string $name)
* @method static void flushMacros()
* @method static mixed macroCall(string $method, array $parameters)
* @method static bool flush()
* @method static string getPrefix()
* @method static \Illuminate\Contracts\Cache\Lock lock(string $name, int $seconds = 0, string|null $owner = null)
* @method static \Illuminate\Contracts\Cache\Lock restoreLock(string $name, string $owner)
*
* @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';
}
/**
* Convert the facade into a Mockery spy.
*
* @return \Mockery\MockInterface
*/
public static function spy()
{
if (! static::isMock()) {
$class = static::getMockableClass();
$instance = static::getFacadeRoot();
if ($class && $instance) {
return tap(Mockery::spy($instance)->makePartial(), function ($spy) {
static::swap($spy);
});
}
return tap($class ? Mockery::spy($class) : Mockery::spy(), function ($spy) {
static::swap($spy);
});
}
}
}

View File

@@ -1,36 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
use Illuminate\Concurrency\ConcurrencyManager;
/**
* @method static mixed driver(string|null $name = null)
* @method static \Illuminate\Concurrency\ProcessDriver createProcessDriver()
* @method static \Illuminate\Concurrency\ForkDriver createForkDriver()
* @method static \Illuminate\Concurrency\SyncDriver createSyncDriver()
* @method static string getDefaultInstance()
* @method static void setDefaultInstance(string $name)
* @method static array getInstanceConfig(string $name)
* @method static mixed instance(string|null $name = null)
* @method static \Illuminate\Concurrency\ConcurrencyManager forgetInstance(array|string|null $name = null)
* @method static void purge(string|null $name = null)
* @method static \Illuminate\Concurrency\ConcurrencyManager extend(string $name, \Closure $callback)
* @method static \Illuminate\Concurrency\ConcurrencyManager setApplication(\Illuminate\Contracts\Foundation\Application $app)
* @method static array run(\Closure|array $tasks)
* @method static \Illuminate\Support\Defer\DeferredCallback defer(\Closure|array $tasks)
*
* @see \Illuminate\Concurrency\ConcurrencyManager
*/
class Concurrency extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return ConcurrencyManager::class;
}
}

View File

@@ -1,37 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
/**
* @method static bool has(string $key)
* @method static mixed get(array|string $key, mixed $default = null)
* @method static array getMany(array $keys)
* @method static string string(string $key, \Closure|string|null $default = null)
* @method static int integer(string $key, \Closure|int|null $default = null)
* @method static float float(string $key, \Closure|float|null $default = null)
* @method static bool boolean(string $key, \Closure|bool|null $default = null)
* @method static array array(string $key, \Closure|array|null $default = null)
* @method static \Illuminate\Support\Collection collection(string $key, \Closure|array|null $default = null)
* @method static void set(array|string $key, mixed $value = null)
* @method static void prepend(string $key, mixed $value)
* @method static void push(string $key, mixed $value)
* @method static array all()
* @method static void macro(string $name, object|callable $macro)
* @method static void mixin(object $mixin, bool $replace = true)
* @method static bool hasMacro(string $name)
* @method static void flushMacros()
*
* @see \Illuminate\Config\Repository
*/
class Config extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'config';
}
}

View File

@@ -1,63 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
/**
* @method static bool has(string $key)
* @method static bool missing(string $key)
* @method static bool hasHidden(string $key)
* @method static bool missingHidden(string $key)
* @method static array all()
* @method static array allHidden()
* @method static mixed get(string $key, mixed $default = null)
* @method static mixed getHidden(string $key, mixed $default = null)
* @method static mixed pull(string $key, mixed $default = null)
* @method static mixed pullHidden(string $key, mixed $default = null)
* @method static array only(array $keys)
* @method static array onlyHidden(array $keys)
* @method static array except(array $keys)
* @method static array exceptHidden(array $keys)
* @method static \Illuminate\Log\Context\Repository add(string|array $key, mixed $value = null)
* @method static \Illuminate\Log\Context\Repository addHidden(string|array $key, mixed $value = null)
* @method static mixed remember(string $key, mixed $value)
* @method static mixed rememberHidden(string $key, mixed $value)
* @method static \Illuminate\Log\Context\Repository forget(string|array $key)
* @method static \Illuminate\Log\Context\Repository forgetHidden(string|array $key)
* @method static \Illuminate\Log\Context\Repository addIf(string $key, mixed $value)
* @method static \Illuminate\Log\Context\Repository addHiddenIf(string $key, mixed $value)
* @method static \Illuminate\Log\Context\Repository push(string $key, mixed ...$values)
* @method static mixed pop(string $key)
* @method static \Illuminate\Log\Context\Repository pushHidden(string $key, mixed ...$values)
* @method static mixed popHidden(string $key)
* @method static \Illuminate\Log\Context\Repository increment(string $key, int $amount = 1)
* @method static \Illuminate\Log\Context\Repository decrement(string $key, int $amount = 1)
* @method static bool stackContains(string $key, mixed $value, bool $strict = false)
* @method static bool hiddenStackContains(string $key, mixed $value, bool $strict = false)
* @method static mixed scope(callable $callback, array $data = [], array $hidden = [])
* @method static bool isEmpty()
* @method static \Illuminate\Log\Context\Repository dehydrating(callable $callback)
* @method static \Illuminate\Log\Context\Repository hydrated(callable $callback)
* @method static \Illuminate\Log\Context\Repository handleUnserializeExceptionsUsing(callable|null $callback)
* @method static \Illuminate\Log\Context\Repository flush()
* @method static \Illuminate\Log\Context\Repository|mixed when(\Closure|mixed|null $value = null, callable|null $callback = null, callable|null $default = null)
* @method static \Illuminate\Log\Context\Repository|mixed unless(\Closure|mixed|null $value = null, callable|null $callback = null, callable|null $default = null)
* @method static void macro(string $name, object|callable $macro)
* @method static void mixin(object $mixin, bool $replace = true)
* @method static bool hasMacro(string $name)
* @method static void flushMacros()
* @method static \Illuminate\Database\Eloquent\Model restoreModel(\Illuminate\Contracts\Database\ModelIdentifier $value)
*
* @see \Illuminate\Log\Context\Repository
*/
class Context extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return \Illuminate\Log\Context\Repository::class;
}
}

View File

@@ -1,58 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
/**
* @method static \Symfony\Component\HttpFoundation\Cookie make(string $name, string $value, int $minutes = 0, string|null $path = null, string|null $domain = null, bool|null $secure = null, bool $httpOnly = true, bool $raw = false, string|null $sameSite = null)
* @method static \Symfony\Component\HttpFoundation\Cookie forever(string $name, string $value, string|null $path = null, string|null $domain = null, bool|null $secure = null, bool $httpOnly = true, bool $raw = false, string|null $sameSite = null)
* @method static \Symfony\Component\HttpFoundation\Cookie forget(string $name, string|null $path = null, string|null $domain = null)
* @method static bool hasQueued(string $key, string|null $path = null)
* @method static \Symfony\Component\HttpFoundation\Cookie|null queued(string $key, mixed $default = null, string|null $path = null)
* @method static void queue(mixed ...$parameters)
* @method static void expire(string $name, string|null $path = null, string|null $domain = null)
* @method static void unqueue(string $name, string|null $path = null)
* @method static \Illuminate\Cookie\CookieJar setDefaultPathAndDomain(string $path, string|null $domain, bool|null $secure = false, string|null $sameSite = null)
* @method static \Symfony\Component\HttpFoundation\Cookie[] getQueuedCookies()
* @method static \Illuminate\Cookie\CookieJar flushQueuedCookies()
* @method static void macro(string $name, object|callable $macro)
* @method static void mixin(object $mixin, bool $replace = true)
* @method static bool hasMacro(string $name)
* @method static void flushMacros()
*
* @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';
}
}

View File

@@ -1,31 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
/**
* @method static bool supported(string $key, string $cipher)
* @method static string generateKey(string $cipher)
* @method static string encrypt(mixed $value, bool $serialize = true)
* @method static string encryptString(string $value)
* @method static mixed decrypt(string $payload, bool $unserialize = true)
* @method static string decryptString(string $payload)
* @method static bool appearsEncrypted(mixed $value)
* @method static string getKey()
* @method static array getAllKeys()
* @method static array getPreviousKeys()
* @method static \Illuminate\Encryption\Encrypter previousKeys(array $keys)
*
* @see \Illuminate\Encryption\Encrypter
*/
class Crypt extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'encrypter';
}
}

View File

@@ -1,150 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
use Illuminate\Database\Console\Migrations\FreshCommand;
use Illuminate\Database\Console\Migrations\RefreshCommand;
use Illuminate\Database\Console\Migrations\ResetCommand;
use Illuminate\Database\Console\Migrations\RollbackCommand;
use Illuminate\Database\Console\WipeCommand;
/**
* @method static \Illuminate\Database\Connection connection(\UnitEnum|string|null $name = null)
* @method static \Illuminate\Database\ConnectionInterface build(array $config)
* @method static string calculateDynamicConnectionName(array $config)
* @method static \Illuminate\Database\ConnectionInterface connectUsing(\UnitEnum|string $name, array $config, bool $force = false)
* @method static void purge(\UnitEnum|string|null $name = null)
* @method static void disconnect(\UnitEnum|string|null $name = null)
* @method static \Illuminate\Database\Connection reconnect(\UnitEnum|string|null $name = null)
* @method static mixed usingConnection(\UnitEnum|string $name, callable $callback)
* @method static string getDefaultConnection()
* @method static void setDefaultConnection(string $name)
* @method static string[] supportedDrivers()
* @method static string[] availableDrivers()
* @method static void extend(string $name, callable $resolver)
* @method static void forgetExtension(string $name)
* @method static array getConnections()
* @method static void setReconnector(callable $reconnector)
* @method static \Illuminate\Database\DatabaseManager setApplication(\Illuminate\Contracts\Foundation\Application $app)
* @method static void macro(string $name, object|callable $macro)
* @method static void mixin(object $mixin, bool $replace = true)
* @method static bool hasMacro(string $name)
* @method static void flushMacros()
* @method static mixed macroCall(string $method, array $parameters)
* @method static void useDefaultQueryGrammar()
* @method static void useDefaultSchemaGrammar()
* @method static void useDefaultPostProcessor()
* @method static \Illuminate\Database\Schema\Builder getSchemaBuilder()
* @method static \Illuminate\Database\Query\Builder table(\Closure|\Illuminate\Database\Query\Builder|\Illuminate\Contracts\Database\Query\Expression|\UnitEnum|string $table, string|null $as = null)
* @method static \Illuminate\Database\Query\Builder query()
* @method static mixed selectOne(string $query, array $bindings = [], bool $useReadPdo = true)
* @method static mixed scalar(string $query, array $bindings = [], bool $useReadPdo = true)
* @method static array selectFromWriteConnection(string $query, array $bindings = [])
* @method static array select(string $query, array $bindings = [], bool $useReadPdo = true)
* @method static array selectResultSets(string $query, array $bindings = [], bool $useReadPdo = true)
* @method static \Generator cursor(string $query, array $bindings = [], bool $useReadPdo = true)
* @method static bool insert(string $query, array $bindings = [])
* @method static int update(string $query, array $bindings = [])
* @method static int delete(string $query, array $bindings = [])
* @method static bool statement(string $query, array $bindings = [])
* @method static int affectingStatement(string $query, array $bindings = [])
* @method static bool unprepared(string $query)
* @method static int|null threadCount()
* @method static array[] pretend(\Closure $callback)
* @method static mixed withoutPretending(\Closure $callback)
* @method static void bindValues(\PDOStatement $statement, array $bindings)
* @method static array prepareBindings(array $bindings)
* @method static void logQuery(string $query, array $bindings, float|null $time = null)
* @method static void whenQueryingForLongerThan(\DateTimeInterface|\Carbon\CarbonInterval|float|int $threshold, callable $handler)
* @method static void allowQueryDurationHandlersToRunAgain()
* @method static float totalQueryDuration()
* @method static void resetTotalQueryDuration()
* @method static void reconnectIfMissingConnection()
* @method static \Illuminate\Database\Connection beforeStartingTransaction(\Closure $callback)
* @method static \Illuminate\Database\Connection beforeExecuting(\Closure $callback)
* @method static void listen(\Closure $callback)
* @method static \Illuminate\Contracts\Database\Query\Expression raw(mixed $value)
* @method static string escape(string|float|int|bool|null $value, bool $binary = false)
* @method static bool hasModifiedRecords()
* @method static void recordsHaveBeenModified(bool $value = true)
* @method static \Illuminate\Database\Connection setRecordModificationState(bool $value)
* @method static void forgetRecordModificationState()
* @method static \Illuminate\Database\Connection useWriteConnectionWhenReading(bool $value = true)
* @method static \PDO getPdo()
* @method static \PDO|\Closure|null getRawPdo()
* @method static \PDO getReadPdo()
* @method static \PDO|\Closure|null getRawReadPdo()
* @method static \Illuminate\Database\Connection setPdo(\PDO|\Closure|null $pdo)
* @method static \Illuminate\Database\Connection setReadPdo(\PDO|\Closure|null $pdo)
* @method static \Illuminate\Database\Connection setReadPdoConfig(array $config)
* @method static string|null getName()
* @method static string|null getNameWithReadWriteType()
* @method static mixed getConfig(string|null $option = null)
* @method static string getDriverName()
* @method static string getDriverTitle()
* @method static \Illuminate\Database\Query\Grammars\Grammar getQueryGrammar()
* @method static \Illuminate\Database\Connection setQueryGrammar(\Illuminate\Database\Query\Grammars\Grammar $grammar)
* @method static \Illuminate\Database\Schema\Grammars\Grammar getSchemaGrammar()
* @method static \Illuminate\Database\Connection setSchemaGrammar(\Illuminate\Database\Schema\Grammars\Grammar $grammar)
* @method static \Illuminate\Database\Query\Processors\Processor getPostProcessor()
* @method static \Illuminate\Database\Connection setPostProcessor(\Illuminate\Database\Query\Processors\Processor $processor)
* @method static \Illuminate\Contracts\Events\Dispatcher|null getEventDispatcher()
* @method static \Illuminate\Database\Connection setEventDispatcher(\Illuminate\Contracts\Events\Dispatcher $events)
* @method static void unsetEventDispatcher()
* @method static \Illuminate\Database\Connection setTransactionManager(\Illuminate\Database\DatabaseTransactionsManager $manager)
* @method static void unsetTransactionManager()
* @method static bool pretending()
* @method static array[] getQueryLog()
* @method static array getRawQueryLog()
* @method static void flushQueryLog()
* @method static void enableQueryLog()
* @method static void disableQueryLog()
* @method static bool logging()
* @method static string getDatabaseName()
* @method static \Illuminate\Database\Connection setDatabaseName(string $database)
* @method static \Illuminate\Database\Connection setReadWriteType(string|null $readWriteType)
* @method static string getTablePrefix()
* @method static \Illuminate\Database\Connection setTablePrefix(string $prefix)
* @method static mixed withoutTablePrefix(\Closure $callback)
* @method static string getServerVersion()
* @method static void resolverFor(string $driver, \Closure $callback)
* @method static \Closure|null getResolver(string $driver)
* @method static mixed transaction(\Closure $callback, int $attempts = 1)
* @method static void beginTransaction()
* @method static void commit()
* @method static void rollBack(int|null $toLevel = null)
* @method static int transactionLevel()
* @method static void afterCommit(callable $callback)
* @method static void afterRollBack(callable $callback)
*
* @see \Illuminate\Database\DatabaseManager
*/
class DB extends Facade
{
/**
* Indicate if destructive Artisan commands should be prohibited.
*
* Prohibits: db:wipe, migrate:fresh, migrate:refresh, migrate:reset, and migrate:rollback
*
* @param bool $prohibit
* @return void
*/
public static function prohibitDestructiveCommands(bool $prohibit = true)
{
FreshCommand::prohibit($prohibit);
RefreshCommand::prohibit($prohibit);
ResetCommand::prohibit($prohibit);
RollbackCommand::prohibit($prohibit);
WipeCommand::prohibit($prohibit);
}
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'db';
}
}

View File

@@ -1,141 +0,0 @@
<?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 mixed use(mixed $handler)
* @method static void useDefault()
* @method static void useCallable(callable $callable)
* @method static void useClass(string $dateClass)
* @method static void useFactory(object $factory)
* @method static bool canBeCreatedFromFormat(?string $date, string $format)
* @method static \Illuminate\Support\Carbon|null create($year = 0, $month = 1, $day = 1, $hour = 0, $minute = 0, $second = 0, $timezone = null)
* @method static \Illuminate\Support\Carbon createFromDate($year = null, $month = null, $day = null, $timezone = null)
* @method static \Illuminate\Support\Carbon|null createFromFormat($format, $time, $timezone = null)
* @method static \Illuminate\Support\Carbon|null createFromIsoFormat(string $format, string $time, $timezone = null, ?string $locale = 'en', ?\Symfony\Contracts\Translation\TranslatorInterface $translator = null)
* @method static \Illuminate\Support\Carbon|null createFromLocaleFormat(string $format, string $locale, string $time, $timezone = null)
* @method static \Illuminate\Support\Carbon|null createFromLocaleIsoFormat(string $format, string $locale, string $time, $timezone = null)
* @method static \Illuminate\Support\Carbon createFromTime($hour = 0, $minute = 0, $second = 0, $timezone = null)
* @method static \Illuminate\Support\Carbon createFromTimeString(string $time, \DateTimeZone|string|int|null $timezone = null)
* @method static \Illuminate\Support\Carbon createFromTimestamp(string|int|float $timestamp, \DateTimeZone|string|int|null $timezone = null)
* @method static \Illuminate\Support\Carbon createFromTimestampMs(string|int|float $timestamp, \DateTimeZone|string|int|null $timezone = null)
* @method static \Illuminate\Support\Carbon createFromTimestampMsUTC($timestamp)
* @method static \Illuminate\Support\Carbon createFromTimestampUTC(string|int|float $timestamp)
* @method static \Illuminate\Support\Carbon createMidnightDate($year = null, $month = null, $day = null, $timezone = null)
* @method static \Illuminate\Support\Carbon|null createSafe($year = null, $month = null, $day = null, $hour = null, $minute = null, $second = null, $timezone = null)
* @method static \Illuminate\Support\Carbon createStrict(?int $year = 0, ?int $month = 1, ?int $day = 1, ?int $hour = 0, ?int $minute = 0, ?int $second = 0, $timezone = null)
* @method static void disableHumanDiffOption($humanDiffOption)
* @method static void enableHumanDiffOption($humanDiffOption)
* @method static mixed executeWithLocale(string $locale, callable $func)
* @method static \Illuminate\Support\Carbon fromSerialized($value)
* @method static array getAvailableLocales()
* @method static array getAvailableLocalesInfo()
* @method static array getDays()
* @method static ?string getFallbackLocale()
* @method static array getFormatsToIsoReplacements()
* @method static int getHumanDiffOptions()
* @method static array getIsoUnits()
* @method static array|false getLastErrors()
* @method static string getLocale()
* @method static int getMidDayAt()
* @method static string getTimeFormatByPrecision(string $unitPrecision)
* @method static string|\Closure|null getTranslationMessageWith($translator, string $key, ?string $locale = null, ?string $default = null)
* @method static \Illuminate\Support\Carbon|null getTestNow()
* @method static \Symfony\Contracts\Translation\TranslatorInterface getTranslator()
* @method static int getWeekEndsAt(?string $locale = null)
* @method static int getWeekStartsAt(?string $locale = null)
* @method static array getWeekendDays()
* @method static bool hasFormat(string $date, string $format)
* @method static bool hasFormatWithModifiers(string $date, string $format)
* @method static bool hasMacro($name)
* @method static bool hasRelativeKeywords(?string $time)
* @method static bool hasTestNow()
* @method static \Illuminate\Support\Carbon instance(\DateTimeInterface $date)
* @method static bool isImmutable()
* @method static bool isModifiableUnit($unit)
* @method static bool isMutable()
* @method static bool isStrictModeEnabled()
* @method static bool localeHasDiffOneDayWords(string $locale)
* @method static bool localeHasDiffSyntax(string $locale)
* @method static bool localeHasDiffTwoDayWords(string $locale)
* @method static bool localeHasPeriodSyntax($locale)
* @method static bool localeHasShortUnits(string $locale)
* @method static void macro(string $name, ?callable $macro)
* @method static \Illuminate\Support\Carbon|null make($var, \DateTimeZone|string|null $timezone = null)
* @method static void mixin(object|string $mixin)
* @method static \Illuminate\Support\Carbon now(\DateTimeZone|string|int|null $timezone = null)
* @method static \Illuminate\Support\Carbon parse(\DateTimeInterface|\Carbon\WeekDay|\Carbon\Month|string|int|float|null $time, \DateTimeZone|string|int|null $timezone = null)
* @method static \Illuminate\Support\Carbon parseFromLocale(string $time, ?string $locale = null, \DateTimeZone|string|int|null $timezone = null)
* @method static string pluralUnit(string $unit)
* @method static \Illuminate\Support\Carbon|null rawCreateFromFormat(string $format, string $time, $timezone = null)
* @method static \Illuminate\Support\Carbon rawParse(\DateTimeInterface|\Carbon\WeekDay|\Carbon\Month|string|int|float|null $time, \DateTimeZone|string|int|null $timezone = null)
* @method static void resetMonthsOverflow()
* @method static void resetToStringFormat()
* @method static void resetYearsOverflow()
* @method static void serializeUsing($callback)
* @method static void setFallbackLocale(string $locale)
* @method static void setHumanDiffOptions($humanDiffOptions)
* @method static void setLocale(string $locale)
* @method static void setMidDayAt($hour)
* @method static void setTestNow(mixed $testNow = null)
* @method static void setTestNowAndTimezone(mixed $testNow = null, $timezone = null)
* @method static void setToStringFormat(string|\Closure|null $format)
* @method static void setTranslator(\Symfony\Contracts\Translation\TranslatorInterface $translator)
* @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 void sleep(int|float $seconds)
* @method static \Illuminate\Support\Carbon today(\DateTimeZone|string|int|null $timezone = null)
* @method static \Illuminate\Support\Carbon tomorrow(\DateTimeZone|string|int|null $timezone = null)
* @method static string translateTimeString(string $timeString, ?string $from = null, ?string $to = null, int $mode = \Carbon\CarbonInterface::TRANSLATE_ALL)
* @method static string translateWith(\Symfony\Contracts\Translation\TranslatorInterface $translator, string $key, array $parameters = [], $number = null)
* @method static void useMonthsOverflow($monthsOverflow = true)
* @method static void useStrictMode($strictModeEnabled = true)
* @method static void useYearsOverflow($yearsOverflow = true)
* @method static mixed withTestNow(mixed $testNow, callable $callback)
* @method static static withTimeZone(\DateTimeZone|string|int|null $timezone)
* @method static \Illuminate\Support\Carbon yesterday(\DateTimeZone|string|int|null $timezone = null)
*
* @see \Illuminate\Support\DateFactory
*/
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);
}
}

View File

@@ -1,136 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Testing\Fakes\EventFake;
/**
* @method static void listen(\Illuminate\Events\QueuedClosure|callable|array|string $events, \Illuminate\Events\QueuedClosure|callable|array|string|null $listener = null)
* @method static bool hasListeners(string $eventName)
* @method static bool hasWildcardListeners(string $eventName)
* @method static void push(string $event, object|array $payload = [])
* @method static void flush(string $event)
* @method static void subscribe(object|string $subscriber)
* @method static array|null until(string|object $event, mixed $payload = [])
* @method static array|null dispatch(string|object $event, mixed $payload = [], bool $halt = false)
* @method static array getListeners(string $eventName)
* @method static \Closure makeListener(\Closure|string|array $listener, bool $wildcard = false)
* @method static \Closure createClassListener(string $listener, bool $wildcard = false)
* @method static void forget(string $event)
* @method static void forgetPushed()
* @method static \Illuminate\Events\Dispatcher setQueueResolver(callable $resolver)
* @method static \Illuminate\Events\Dispatcher setTransactionManagerResolver(callable $resolver)
* @method static mixed defer(callable $callback, string[]|null $events = null)
* @method static array getRawListeners()
* @method static void macro(string $name, object|callable $macro)
* @method static void mixin(object $mixin, bool $replace = true)
* @method static bool hasMacro(string $name)
* @method static void flushMacros()
* @method static \Illuminate\Support\Testing\Fakes\EventFake except(array|string $eventsToDispatch)
* @method static void assertListening(string $expectedEvent, string|array $expectedListener)
* @method static void assertDispatched(string|\Closure $event, callable|int|null $callback = null)
* @method static void assertDispatchedOnce(string $event)
* @method static void assertDispatchedTimes(string $event, int $times = 1)
* @method static void assertNotDispatched(string|\Closure $event, callable|null $callback = null)
* @method static void assertNothingDispatched()
* @method static \Illuminate\Support\Collection dispatched(string $event, callable|null $callback = null)
* @method static bool hasDispatched(string $event)
* @method static array dispatchedEvents()
*
* @see \Illuminate\Events\Dispatcher
* @see \Illuminate\Support\Testing\Fakes\EventFake
*/
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 = [])
{
$actualDispatcher = static::isFake()
? static::getFacadeRoot()->dispatcher
: static::getFacadeRoot();
return tap(new EventFake($actualDispatcher, $eventsToFake), function ($fake) {
static::swap($fake);
Model::setEventDispatcher($fake);
Cache::refreshEventDispatcher();
});
}
/**
* Replace the bound instance with a fake that fakes all events except the given events.
*
* @param string[]|string $eventsToAllow
* @return \Illuminate\Support\Testing\Fakes\EventFake
*/
public static function fakeExcept($eventsToAllow)
{
return static::fake([
function ($eventName) use ($eventsToAllow) {
return ! in_array($eventName, (array) $eventsToAllow);
},
]);
}
/**
* Replace the bound instance with a fake during the given callable's execution.
*
* @param callable $callable
* @param array $eventsToFake
* @return mixed
*/
public static function fakeFor(callable $callable, array $eventsToFake = [])
{
$originalDispatcher = static::getFacadeRoot();
static::fake($eventsToFake);
try {
return $callable();
} finally {
static::swap($originalDispatcher);
Model::setEventDispatcher($originalDispatcher);
Cache::refreshEventDispatcher();
}
}
/**
* Replace the bound instance with a fake during the given callable's execution.
*
* @param callable $callable
* @param array $eventsToAllow
* @return mixed
*/
public static function fakeExceptFor(callable $callable, array $eventsToAllow = [])
{
$originalDispatcher = static::getFacadeRoot();
static::fakeExcept($eventsToAllow);
try {
return $callable();
} finally {
static::swap($originalDispatcher);
Model::setEventDispatcher($originalDispatcher);
Cache::refreshEventDispatcher();
}
}
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'events';
}
}

View File

@@ -1,70 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
use Illuminate\Contracts\Debug\ExceptionHandler;
use Illuminate\Support\Arr;
use Illuminate\Support\Testing\Fakes\ExceptionHandlerFake;
/**
* @method static void register()
* @method static \Illuminate\Foundation\Exceptions\ReportableHandler reportable(callable $reportUsing)
* @method static \Illuminate\Foundation\Exceptions\Handler renderable(callable $renderUsing)
* @method static \Illuminate\Foundation\Exceptions\Handler map(\Closure|string $from, \Closure|string|null $to = null)
* @method static \Illuminate\Foundation\Exceptions\Handler dontReport(array|string $exceptions)
* @method static \Illuminate\Foundation\Exceptions\Handler dontReportWhen(callable $dontReportWhen)
* @method static \Illuminate\Foundation\Exceptions\Handler ignore(array|string $exceptions)
* @method static \Illuminate\Foundation\Exceptions\Handler dontFlash(array|string $attributes)
* @method static \Illuminate\Foundation\Exceptions\Handler level(string $type, string $level)
* @method static void report(\Throwable $e)
* @method static bool shouldReport(\Throwable $e)
* @method static \Illuminate\Foundation\Exceptions\Handler throttleUsing(callable $throttleUsing)
* @method static \Illuminate\Foundation\Exceptions\Handler stopIgnoring(array|string $exceptions)
* @method static \Illuminate\Foundation\Exceptions\Handler buildContextUsing(\Closure $contextCallback)
* @method static \Symfony\Component\HttpFoundation\Response render(\Illuminate\Http\Request $request, \Throwable $e)
* @method static \Illuminate\Foundation\Exceptions\Handler respondUsing(callable $callback)
* @method static \Illuminate\Foundation\Exceptions\Handler shouldRenderJsonWhen(callable $callback)
* @method static \Illuminate\Foundation\Exceptions\Handler dontReportDuplicates()
* @method static \Illuminate\Contracts\Debug\ExceptionHandler handler()
* @method static void assertReported(\Closure|string $exception)
* @method static void assertReportedCount(int $count)
* @method static void assertNotReported(\Closure|string $exception)
* @method static void assertNothingReported()
* @method static void renderForConsole(\Symfony\Component\Console\Output\OutputInterface $output, \Throwable $e)
* @method static \Illuminate\Support\Testing\Fakes\ExceptionHandlerFake throwOnReport()
* @method static \Illuminate\Support\Testing\Fakes\ExceptionHandlerFake throwFirstReported()
* @method static array reported()
* @method static \Illuminate\Support\Testing\Fakes\ExceptionHandlerFake setHandler(\Illuminate\Contracts\Debug\ExceptionHandler $handler)
*
* @see \Illuminate\Foundation\Exceptions\Handler
* @see \Illuminate\Support\Testing\Fakes\ExceptionHandlerFake
*/
class Exceptions extends Facade
{
/**
* Replace the bound instance with a fake.
*
* @param array<int, class-string<\Throwable>>|class-string<\Throwable> $exceptions
* @return \Illuminate\Support\Testing\Fakes\ExceptionHandlerFake
*/
public static function fake(array|string $exceptions = [])
{
$exceptionHandler = static::isFake()
? static::getFacadeRoot()->handler()
: static::getFacadeRoot();
return tap(new ExceptionHandlerFake($exceptionHandler, Arr::wrap($exceptions)), function ($fake) {
static::swap($fake);
});
}
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return ExceptionHandler::class;
}
}

View File

@@ -1,365 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
use Closure;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Arr;
use Illuminate\Support\Benchmark;
use Illuminate\Support\Collection;
use Illuminate\Support\Js;
use Illuminate\Support\Number;
use Illuminate\Support\Str;
use Illuminate\Support\Testing\Fakes\Fake;
use Illuminate\Support\Uri;
use Mockery;
use Mockery\LegacyMockInterface;
use RuntimeException;
abstract class Facade
{
/**
* The application instance being facaded.
*
* @var \Illuminate\Contracts\Foundation\Application|null
*/
protected static $app;
/**
* The resolved object instances.
*
* @var array
*/
protected static $resolvedInstance;
/**
* Indicates if the resolved instance should be cached.
*
* @var bool
*/
protected static $cached = true;
/**
* 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);
}
static::$app->afterResolving($accessor, function ($service, $app) use ($callback) {
$callback($service, $app);
});
}
/**
* 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());
}
/**
* Initiate a mock expectation on the facade.
*
* @return \Mockery\Expectation
*/
public static function expects()
{
$name = static::getFacadeAccessor();
$mock = static::isMock()
? static::$resolvedInstance[$name]
: static::createFreshMockInstance();
return $mock->expects(...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 LegacyMockInterface;
}
/**
* 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);
}
}
/**
* Determines whether a "fake" has been set as the facade instance.
*
* @return bool
*/
public static function isFake()
{
$name = static::getFacadeAccessor();
return isset(static::$resolvedInstance[$name]) &&
static::$resolvedInstance[$name] instanceof Fake;
}
/**
* Get the root object behind the facade.
*
* @return mixed
*/
public static function getFacadeRoot()
{
return static::resolveFacadeInstance(static::getFacadeAccessor());
}
/**
* Get the registered name of the component.
*
* @return string
*
* @throws \RuntimeException
*/
protected static function getFacadeAccessor()
{
throw new RuntimeException('Facade does not implement getFacadeAccessor method.');
}
/**
* Resolve the facade root instance from the container.
*
* @param string $name
* @return mixed
*/
protected static function resolveFacadeInstance($name)
{
if (isset(static::$resolvedInstance[$name])) {
return static::$resolvedInstance[$name];
}
if (static::$app) {
if (static::$cached) {
return static::$resolvedInstance[$name] = static::$app[$name];
}
return static::$app[$name];
}
}
/**
* Clear a resolved facade instance.
*
* @param ?string $name
* @return void
*/
public static function clearResolvedInstance($name = null)
{
unset(static::$resolvedInstance[$name ?? static::getFacadeAccessor()]);
}
/**
* Clear all of the resolved instances.
*
* @return void
*/
public static function clearResolvedInstances()
{
static::$resolvedInstance = [];
}
/**
* Get the application default aliases.
*
* @return \Illuminate\Support\Collection
*/
public static function defaultAliases()
{
return new Collection([
'App' => App::class,
'Arr' => Arr::class,
'Artisan' => Artisan::class,
'Auth' => Auth::class,
'Benchmark' => Benchmark::class,
'Blade' => Blade::class,
'Broadcast' => Broadcast::class,
'Bus' => Bus::class,
'Cache' => Cache::class,
'Concurrency' => Concurrency::class,
'Config' => Config::class,
'Context' => Context::class,
'Cookie' => Cookie::class,
'Crypt' => Crypt::class,
'Date' => Date::class,
'DB' => DB::class,
'Eloquent' => Model::class,
'Event' => Event::class,
'File' => File::class,
'Gate' => Gate::class,
'Hash' => Hash::class,
'Http' => Http::class,
'Js' => Js::class,
'Lang' => Lang::class,
'Log' => Log::class,
'Mail' => Mail::class,
'Notification' => Notification::class,
'Number' => Number::class,
'Password' => Password::class,
'Process' => Process::class,
'Queue' => Queue::class,
'RateLimiter' => RateLimiter::class,
'Redirect' => Redirect::class,
'Request' => Request::class,
'Response' => Response::class,
'Route' => Route::class,
'Schedule' => Schedule::class,
'Schema' => Schema::class,
'Session' => Session::class,
'Storage' => Storage::class,
'Str' => Str::class,
'Uri' => Uri::class,
'URL' => URL::class,
'Validator' => Validator::class,
'View' => View::class,
'Vite' => Vite::class,
]);
}
/**
* Get the application instance behind the facade.
*
* @return \Illuminate\Contracts\Foundation\Application|null
*/
public static function getFacadeApplication()
{
return static::$app;
}
/**
* Set the application instance.
*
* @param \Illuminate\Contracts\Foundation\Application|null $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);
}
}

View File

@@ -1,73 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
/**
* @method static bool exists(string $path)
* @method static bool missing(string $path)
* @method static string get(string $path, bool $lock = false)
* @method static array json(string $path, int $flags = 0, bool $lock = false)
* @method static string sharedGet(string $path)
* @method static mixed getRequire(string $path, array $data = [])
* @method static mixed requireOnce(string $path, array $data = [])
* @method static \Illuminate\Support\LazyCollection lines(string $path)
* @method static string|false hash(string $path, string $algorithm = 'md5')
* @method static int|bool put(string $path, string $contents, bool $lock = false)
* @method static void replace(string $path, string $content, int|null $mode = null)
* @method static void replaceInFile(array|string $search, array|string $replace, string $path)
* @method static int prepend(string $path, string $data)
* @method static int append(string $path, string $data, bool $lock = false)
* @method static mixed chmod(string $path, int|null $mode = null)
* @method static bool delete(string|array $paths)
* @method static bool move(string $path, string $target)
* @method static bool copy(string $path, string $target)
* @method static bool|null link(string $target, string $link)
* @method static void relativeLink(string $target, string $link)
* @method static string name(string $path)
* @method static string basename(string $path)
* @method static string dirname(string $path)
* @method static string extension(string $path)
* @method static string|null guessExtension(string $path)
* @method static string|false type(string $path)
* @method static string|false mimeType(string $path)
* @method static int size(string $path)
* @method static int lastModified(string $path)
* @method static bool isDirectory(string $directory)
* @method static bool isEmptyDirectory(string $directory, bool $ignoreDotFiles = false)
* @method static bool isReadable(string $path)
* @method static bool isWritable(string $path)
* @method static bool hasSameHash(string $firstFile, string $secondFile)
* @method static bool isFile(string $file)
* @method static array glob(string $pattern, int $flags = 0)
* @method static \Symfony\Component\Finder\SplFileInfo[] files(string $directory, bool $hidden = false, array|string|int $depth = 0)
* @method static \Symfony\Component\Finder\SplFileInfo[] allFiles(string $directory, bool $hidden = false)
* @method static array directories(string $directory, array|string|int $depth = 0)
* @method static array allDirectories(string $directory)
* @method static void ensureDirectoryExists(string $path, int $mode = 0755, bool $recursive = true)
* @method static bool makeDirectory(string $path, int $mode = 0755, bool $recursive = false, bool $force = false)
* @method static bool moveDirectory(string $from, string $to, bool $overwrite = false)
* @method static bool copyDirectory(string $directory, string $destination, int|null $options = null)
* @method static bool deleteDirectory(string $directory, bool $preserve = false)
* @method static bool deleteDirectories(string $directory)
* @method static bool cleanDirectory(string $directory)
* @method static \Illuminate\Filesystem\Filesystem|mixed when(\Closure|mixed|null $value = null, callable|null $callback = null, callable|null $default = null)
* @method static \Illuminate\Filesystem\Filesystem|mixed unless(\Closure|mixed|null $value = null, callable|null $callback = null, callable|null $default = null)
* @method static void macro(string $name, object|callable $macro)
* @method static void mixin(object $mixin, bool $replace = true)
* @method static bool hasMacro(string $name)
* @method static void flushMacros()
*
* @see \Illuminate\Filesystem\Filesystem
*/
class File extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'files';
}
}

View File

@@ -1,48 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
use Illuminate\Contracts\Auth\Access\Gate as GateContract;
/**
* @method static bool has(\UnitEnum|array|string $ability)
* @method static \Illuminate\Auth\Access\Response allowIf(\Illuminate\Auth\Access\Response|\Closure|bool $condition, string|null $message = null, string|null $code = null)
* @method static \Illuminate\Auth\Access\Response denyIf(\Illuminate\Auth\Access\Response|\Closure|bool $condition, string|null $message = null, string|null $code = null)
* @method static \Illuminate\Auth\Access\Gate define(\UnitEnum|string $ability, callable|array|string $callback)
* @method static \Illuminate\Auth\Access\Gate resource(string $name, string $class, array|null $abilities = null)
* @method static \Illuminate\Auth\Access\Gate policy(string $class, string $policy)
* @method static \Illuminate\Auth\Access\Gate before(callable $callback)
* @method static \Illuminate\Auth\Access\Gate after(callable $callback)
* @method static bool allows(iterable|\UnitEnum|string $ability, mixed $arguments = [])
* @method static bool denies(iterable|\UnitEnum|string $ability, mixed $arguments = [])
* @method static bool check(iterable|\UnitEnum|string $abilities, mixed $arguments = [])
* @method static bool any(iterable|\UnitEnum|string $abilities, mixed $arguments = [])
* @method static bool none(iterable|\UnitEnum|string $abilities, mixed $arguments = [])
* @method static \Illuminate\Auth\Access\Response authorize(\UnitEnum|string $ability, mixed $arguments = [])
* @method static \Illuminate\Auth\Access\Response inspect(\UnitEnum|string $ability, mixed $arguments = [])
* @method static mixed raw(string $ability, mixed $arguments = [])
* @method static mixed getPolicyFor(object|string $class)
* @method static \Illuminate\Auth\Access\Gate guessPolicyNamesUsing(callable $callback)
* @method static mixed resolvePolicy(object|string $class)
* @method static \Illuminate\Auth\Access\Gate forUser(\Illuminate\Contracts\Auth\Authenticatable|mixed $user)
* @method static array abilities()
* @method static array policies()
* @method static \Illuminate\Auth\Access\Gate defaultDenialResponse(\Illuminate\Auth\Access\Response $response)
* @method static \Illuminate\Auth\Access\Gate setContainer(\Illuminate\Contracts\Container\Container $container)
* @method static \Illuminate\Auth\Access\Response denyWithStatus(int $status, string|null $message = null, int|null $code = null)
* @method static \Illuminate\Auth\Access\Response denyAsNotFound(string|null $message = null, int|null $code = null)
*
* @see \Illuminate\Auth\Access\Gate
*/
class Gate extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return GateContract::class;
}
}

View File

@@ -1,36 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
/**
* @method static \Illuminate\Hashing\BcryptHasher createBcryptDriver()
* @method static \Illuminate\Hashing\ArgonHasher createArgonDriver()
* @method static \Illuminate\Hashing\Argon2IdHasher createArgon2idDriver()
* @method static array info(string $hashedValue)
* @method static string make(string $value, array $options = [])
* @method static bool check(string $value, string $hashedValue, array $options = [])
* @method static bool needsRehash(string $hashedValue, array $options = [])
* @method static bool isHashed(string $value)
* @method static string getDefaultDriver()
* @method static mixed driver(string|null $driver = null)
* @method static \Illuminate\Hashing\HashManager extend(string $driver, \Closure $callback)
* @method static array getDrivers()
* @method static \Illuminate\Contracts\Container\Container getContainer()
* @method static \Illuminate\Hashing\HashManager setContainer(\Illuminate\Contracts\Container\Container $container)
* @method static \Illuminate\Hashing\HashManager forgetDrivers()
*
* @see \Illuminate\Hashing\HashManager
* @see \Illuminate\Hashing\AbstractHasher
*/
class Hash extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'hash';
}
}

View File

@@ -1,174 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
use Illuminate\Http\Client\Factory;
/**
* @method static \Illuminate\Http\Client\Factory globalMiddleware(callable $middleware)
* @method static \Illuminate\Http\Client\Factory globalRequestMiddleware(callable $middleware)
* @method static \Illuminate\Http\Client\Factory globalResponseMiddleware(callable $middleware)
* @method static \Illuminate\Http\Client\Factory globalOptions(\Closure|array $options)
* @method static \GuzzleHttp\Promise\PromiseInterface response(array|string|null $body = null, int $status = 200, array $headers = [])
* @method static \GuzzleHttp\Psr7\Response psr7Response(array|string|null $body = null, int $status = 200, array $headers = [])
* @method static \Illuminate\Http\Client\RequestException failedRequest(array|string|null $body = null, int $status = 200, array $headers = [])
* @method static \Closure failedConnection(string|null $message = null)
* @method static \Illuminate\Http\Client\ResponseSequence sequence(array $responses = [])
* @method static bool preventingStrayRequests()
* @method static \Illuminate\Http\Client\Factory allowStrayRequests(array|null $only = null)
* @method static \Illuminate\Http\Client\Factory record()
* @method static void recordRequestResponsePair(\Illuminate\Http\Client\Request $request, \Illuminate\Http\Client\Response|null $response)
* @method static void assertSent(callable|\Closure $callback)
* @method static void assertSentInOrder(array $callbacks)
* @method static void assertNotSent(callable|\Closure $callback)
* @method static void assertNothingSent()
* @method static void assertSentCount(int $count)
* @method static void assertSequencesAreEmpty()
* @method static \Illuminate\Support\Collection recorded(\Closure|callable $callback = null)
* @method static \Illuminate\Http\Client\PendingRequest createPendingRequest()
* @method static \Illuminate\Contracts\Events\Dispatcher|null getDispatcher()
* @method static array getGlobalMiddleware()
* @method static void macro(string $name, object|callable $macro)
* @method static void mixin(object $mixin, bool $replace = true)
* @method static bool hasMacro(string $name)
* @method static void flushMacros()
* @method static mixed macroCall(string $method, array $parameters)
* @method static \Illuminate\Http\Client\PendingRequest baseUrl(string $url)
* @method static \Illuminate\Http\Client\PendingRequest withBody(\Psr\Http\Message\StreamInterface|string $content, string $contentType = 'application/json')
* @method static \Illuminate\Http\Client\PendingRequest asJson()
* @method static \Illuminate\Http\Client\PendingRequest asForm()
* @method static \Illuminate\Http\Client\PendingRequest attach(string|array $name, string|resource $contents = '', string|null $filename = null, array $headers = [])
* @method static \Illuminate\Http\Client\PendingRequest asMultipart()
* @method static \Illuminate\Http\Client\PendingRequest bodyFormat(string $format)
* @method static \Illuminate\Http\Client\PendingRequest withQueryParameters(array $parameters)
* @method static \Illuminate\Http\Client\PendingRequest contentType(string $contentType)
* @method static \Illuminate\Http\Client\PendingRequest acceptJson()
* @method static \Illuminate\Http\Client\PendingRequest accept(string $contentType)
* @method static \Illuminate\Http\Client\PendingRequest withHeaders(array $headers)
* @method static \Illuminate\Http\Client\PendingRequest withHeader(string $name, mixed $value)
* @method static \Illuminate\Http\Client\PendingRequest replaceHeaders(array $headers)
* @method static \Illuminate\Http\Client\PendingRequest withBasicAuth(string $username, string $password)
* @method static \Illuminate\Http\Client\PendingRequest withDigestAuth(string $username, string $password)
* @method static \Illuminate\Http\Client\PendingRequest withNtlmAuth(string $username, string $password)
* @method static \Illuminate\Http\Client\PendingRequest withToken(string $token, string $type = 'Bearer')
* @method static \Illuminate\Http\Client\PendingRequest withUserAgent(string|bool $userAgent)
* @method static \Illuminate\Http\Client\PendingRequest withUrlParameters(array $parameters = [])
* @method static \Illuminate\Http\Client\PendingRequest withCookies(array $cookies, string $domain)
* @method static \Illuminate\Http\Client\PendingRequest maxRedirects(int $max)
* @method static \Illuminate\Http\Client\PendingRequest withoutRedirecting()
* @method static \Illuminate\Http\Client\PendingRequest withoutVerifying()
* @method static \Illuminate\Http\Client\PendingRequest sink(string|resource $to)
* @method static \Illuminate\Http\Client\PendingRequest timeout(int|float $seconds)
* @method static \Illuminate\Http\Client\PendingRequest connectTimeout(int|float $seconds)
* @method static \Illuminate\Http\Client\PendingRequest retry(array|int $times, \Closure|int $sleepMilliseconds = 0, callable|null $when = null, bool $throw = true)
* @method static \Illuminate\Http\Client\PendingRequest withOptions(array $options)
* @method static \Illuminate\Http\Client\PendingRequest withMiddleware(callable $middleware)
* @method static \Illuminate\Http\Client\PendingRequest withRequestMiddleware(callable $middleware)
* @method static \Illuminate\Http\Client\PendingRequest withResponseMiddleware(callable $middleware)
* @method static \Illuminate\Http\Client\PendingRequest withAttributes(array $attributes)
* @method static \Illuminate\Http\Client\PendingRequest beforeSending(callable $callback)
* @method static \Illuminate\Http\Client\PendingRequest afterResponse(callable|null $callback)
* @method static \Illuminate\Http\Client\PendingRequest throw(callable|null $callback = null)
* @method static \Illuminate\Http\Client\PendingRequest throwIf(callable|bool $condition)
* @method static \Illuminate\Http\Client\PendingRequest throwUnless(callable|bool $condition)
* @method static \Illuminate\Http\Client\PendingRequest dump()
* @method static \Illuminate\Http\Client\PendingRequest dd()
* @method static \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface get(string $url, array|string|null $query = null)
* @method static \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface head(string $url, array|string|null $query = null)
* @method static \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface post(string $url, array|\JsonSerializable|\Illuminate\Contracts\Support\Arrayable $data = [])
* @method static \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface patch(string $url, array|\JsonSerializable|\Illuminate\Contracts\Support\Arrayable $data = [])
* @method static \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface put(string $url, array|\JsonSerializable|\Illuminate\Contracts\Support\Arrayable $data = [])
* @method static \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface delete(string $url, array|\JsonSerializable|\Illuminate\Contracts\Support\Arrayable $data = [])
* @method static array pool(callable $callback, int|null $concurrency = null)
* @method static \Illuminate\Http\Client\Batch batch(callable $callback)
* @method static \Illuminate\Http\Client\Response|\Illuminate\Http\Client\Promises\LazyPromise send(string $method, string $url, array $options = [])
* @method static \GuzzleHttp\Client buildClient()
* @method static \GuzzleHttp\Client createClient(\GuzzleHttp\HandlerStack $handlerStack)
* @method static \GuzzleHttp\HandlerStack buildHandlerStack()
* @method static \GuzzleHttp\HandlerStack pushHandlers(\GuzzleHttp\HandlerStack $handlerStack)
* @method static \Closure buildBeforeSendingHandler()
* @method static \Closure buildRecorderHandler()
* @method static \Closure buildStubHandler()
* @method static \Psr\Http\Message\RequestInterface runBeforeSendingCallbacks(\Psr\Http\Message\RequestInterface $request, array $options)
* @method static array mergeOptions(array ...$options)
* @method static \Illuminate\Http\Client\PendingRequest stub(callable $callback)
* @method static bool isAllowedRequestUrl(string $url)
* @method static \Illuminate\Http\Client\PendingRequest async(bool $async = true)
* @method static \GuzzleHttp\Promise\PromiseInterface|null getPromise()
* @method static \Illuminate\Http\Client\PendingRequest truncateExceptionsAt(int $length)
* @method static \Illuminate\Http\Client\PendingRequest dontTruncateExceptions()
* @method static \Illuminate\Http\Client\PendingRequest setClient(\GuzzleHttp\Client $client)
* @method static \Illuminate\Http\Client\PendingRequest setHandler(callable $handler)
* @method static array getOptions()
* @method static \Illuminate\Http\Client\PendingRequest|mixed when(\Closure|mixed|null $value = null, callable|null $callback = null, callable|null $default = null)
* @method static \Illuminate\Http\Client\PendingRequest|mixed unless(\Closure|mixed|null $value = null, callable|null $callback = null, callable|null $default = null)
*
* @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;
}
/**
* Register a stub callable that will intercept requests and be able to return stub responses.
*
* @param \Closure|array|null $callback
* @return \Illuminate\Http\Client\Factory
*/
public static function fake($callback = null)
{
return tap(static::getFacadeRoot(), function ($fake) use ($callback) {
static::swap($fake->fake($callback));
});
}
/**
* Register a response sequence for the given URL pattern.
*
* @param string $urlPattern
* @return \Illuminate\Http\Client\ResponseSequence
*/
public static function fakeSequence(string $urlPattern = '*')
{
$fake = tap(static::getFacadeRoot(), function ($fake) {
static::swap($fake);
});
return $fake->fakeSequence($urlPattern);
}
/**
* Indicate that an exception should be thrown if any request is not faked.
*
* @param bool $prevent
* @return \Illuminate\Http\Client\Factory
*/
public static function preventStrayRequests($prevent = true)
{
return tap(static::getFacadeRoot(), function ($fake) use ($prevent) {
static::swap($fake->preventStrayRequests($prevent));
});
}
/**
* Stub the given URL using the given callback.
*
* @param string $url
* @param \Illuminate\Http\Client\Response|\GuzzleHttp\Promise\PromiseInterface|callable $callback
* @return \Illuminate\Http\Client\Factory
*/
public static function stubUrl($url, $callback)
{
return tap(static::getFacadeRoot(), function ($fake) use ($url, $callback) {
static::swap($fake->stubUrl($url, $callback));
});
}
}

View File

@@ -1,48 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
/**
* @method static bool hasForLocale(string $key, string|null $locale = null)
* @method static bool has(string $key, string|null $locale = null, bool $fallback = true)
* @method static string|array get(string $key, array $replace = [], string|null $locale = null, bool $fallback = true)
* @method static string choice(string $key, \Countable|int|float|array $number, array $replace = [], string|null $locale = null)
* @method static void addLines(array $lines, string $locale, string $namespace = '*')
* @method static void load(string $namespace, string $group, string $locale)
* @method static \Illuminate\Translation\Translator handleMissingKeysUsing(callable|null $callback)
* @method static void addNamespace(string $namespace, string $hint)
* @method static void addPath(string $path)
* @method static void addJsonPath(string $path)
* @method static array parseKey(string $key)
* @method static void determineLocalesUsing(callable $callback)
* @method static \Illuminate\Translation\MessageSelector getSelector()
* @method static void setSelector(\Illuminate\Translation\MessageSelector $selector)
* @method static \Illuminate\Contracts\Translation\Loader getLoader()
* @method static string locale()
* @method static string getLocale()
* @method static void setLocale(string $locale)
* @method static string getFallback()
* @method static void setFallback(string $fallback)
* @method static void setLoaded(array $loaded)
* @method static void stringable(callable|string $class, callable|null $handler = null)
* @method static void setParsedKey(string $key, array $parsed)
* @method static void flushParsedKeys()
* @method static void macro(string $name, object|callable $macro)
* @method static void mixin(object $mixin, bool $replace = true)
* @method static bool hasMacro(string $name)
* @method static void flushMacros()
*
* @see \Illuminate\Translation\Translator
*/
class Lang extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'translator';
}
}

View File

@@ -1,51 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
/**
* @method static \Psr\Log\LoggerInterface build(array $config)
* @method static \Psr\Log\LoggerInterface stack(array $channels, string|null $channel = null)
* @method static \Psr\Log\LoggerInterface channel(string|null $channel = null)
* @method static \Psr\Log\LoggerInterface driver(string|null $driver = null)
* @method static \Illuminate\Log\LogManager shareContext(array $context)
* @method static array sharedContext()
* @method static \Illuminate\Log\LogManager withoutContext(string[]|null $keys = null)
* @method static \Illuminate\Log\LogManager flushSharedContext()
* @method static string|null getDefaultDriver()
* @method static void setDefaultDriver(string $name)
* @method static \Illuminate\Log\LogManager extend(string $driver, \Closure $callback)
* @method static void forgetChannel(string|null $driver = null)
* @method static array getChannels()
* @method static void emergency(string|\Stringable $message, array $context = [])
* @method static void alert(string|\Stringable $message, array $context = [])
* @method static void critical(string|\Stringable $message, array $context = [])
* @method static void error(string|\Stringable $message, array $context = [])
* @method static void warning(string|\Stringable $message, array $context = [])
* @method static void notice(string|\Stringable $message, array $context = [])
* @method static void info(string|\Stringable $message, array $context = [])
* @method static void debug(string|\Stringable $message, array $context = [])
* @method static void log(mixed $level, string|\Stringable $message, array $context = [])
* @method static \Illuminate\Log\LogManager setApplication(\Illuminate\Contracts\Foundation\Application $app)
* @method static void write(string $level, \Illuminate\Contracts\Support\Arrayable|\Illuminate\Contracts\Support\Jsonable|\Illuminate\Support\Stringable|array|string $message, array $context = [])
* @method static \Illuminate\Log\Logger withContext(array $context = [])
* @method static void listen(\Closure $callback)
* @method static \Psr\Log\LoggerInterface getLogger()
* @method static \Illuminate\Contracts\Events\Dispatcher|null getEventDispatcher()
* @method static void setEventDispatcher(\Illuminate\Contracts\Events\Dispatcher $dispatcher)
* @method static \Illuminate\Log\Logger|mixed when(\Closure|mixed|null $value = null, callable|null $callback = null, callable|null $default = null)
* @method static \Illuminate\Log\Logger|mixed unless(\Closure|mixed|null $value = null, callable|null $callback = null, callable|null $default = null)
*
* @see \Illuminate\Log\LogManager
*/
class Log extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'log';
}
}

View File

@@ -1,92 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
use Illuminate\Support\Testing\Fakes\MailFake;
/**
* @method static \Illuminate\Contracts\Mail\Mailer mailer(string|null $name = null)
* @method static \Illuminate\Mail\Mailer driver(string|null $driver = null)
* @method static \Illuminate\Mail\Mailer build(array $config)
* @method static \Symfony\Component\Mailer\Transport\TransportInterface createSymfonyTransport(array $config)
* @method static string getDefaultDriver()
* @method static void setDefaultDriver(string $name)
* @method static void purge(string|null $name = null)
* @method static \Illuminate\Mail\MailManager extend(string $driver, \Closure $callback)
* @method static \Illuminate\Contracts\Foundation\Application getApplication()
* @method static \Illuminate\Mail\MailManager setApplication(\Illuminate\Contracts\Foundation\Application $app)
* @method static \Illuminate\Mail\MailManager forgetMailers()
* @method static void alwaysFrom(string $address, string|null $name = null)
* @method static void alwaysReplyTo(string $address, string|null $name = null)
* @method static void alwaysReturnPath(string $address)
* @method static void alwaysTo(string $address, string|null $name = null)
* @method static \Illuminate\Mail\PendingMail to(mixed $users, string|null $name = null)
* @method static \Illuminate\Mail\PendingMail cc(mixed $users, string|null $name = null)
* @method static \Illuminate\Mail\PendingMail bcc(mixed $users, string|null $name = null)
* @method static \Illuminate\Mail\SentMessage|null html(string $html, mixed $callback)
* @method static \Illuminate\Mail\SentMessage|null raw(string $text, mixed $callback)
* @method static \Illuminate\Mail\SentMessage|null plain(string $view, array $data, mixed $callback)
* @method static string render(string|array $view, array $data = [])
* @method static \Illuminate\Mail\SentMessage|null send(\Illuminate\Contracts\Mail\Mailable|string|array $view, array $data = [], \Closure|string|null $callback = null)
* @method static \Illuminate\Mail\SentMessage|null sendNow(\Illuminate\Contracts\Mail\Mailable|string|array $mailable, array $data = [], \Closure|string|null $callback = null)
* @method static mixed queue(\Illuminate\Contracts\Mail\Mailable $view, \BackedEnum|string|null $queue = null)
* @method static mixed onQueue(\BackedEnum|string|null $queue, \Illuminate\Contracts\Mail\Mailable $view)
* @method static mixed queueOn(string $queue, \Illuminate\Contracts\Mail\Mailable $view)
* @method static mixed later(\DateTimeInterface|\DateInterval|int $delay, \Illuminate\Contracts\Mail\Mailable $view, string|null $queue = null)
* @method static mixed laterOn(string $queue, \DateTimeInterface|\DateInterval|int $delay, \Illuminate\Contracts\Mail\Mailable $view)
* @method static \Symfony\Component\Mailer\Transport\TransportInterface getSymfonyTransport()
* @method static \Illuminate\Contracts\View\Factory getViewFactory()
* @method static void setSymfonyTransport(\Symfony\Component\Mailer\Transport\TransportInterface $transport)
* @method static \Illuminate\Mail\Mailer setQueue(\Illuminate\Contracts\Queue\Factory $queue)
* @method static void macro(string $name, object|callable $macro)
* @method static void mixin(object $mixin, bool $replace = true)
* @method static bool hasMacro(string $name)
* @method static void flushMacros()
* @method static void assertSent(string|\Closure $mailable, callable|array|string|int|null $callback = null)
* @method static void assertSentTimes(string $mailable, int $times = 1)
* @method static void assertNotOutgoing(string|\Closure $mailable, callable|null $callback = null)
* @method static void assertNotSent(string|\Closure $mailable, callable|array|string|null $callback = null)
* @method static void assertNothingOutgoing()
* @method static void assertNothingSent()
* @method static void assertQueued(string|\Closure $mailable, callable|array|string|int|null $callback = null)
* @method static void assertNotQueued(string|\Closure $mailable, callable|array|string|null $callback = null)
* @method static void assertNothingQueued()
* @method static void assertSentCount(int $count)
* @method static void assertQueuedCount(int $count)
* @method static void assertOutgoingCount(int $count)
* @method static \Illuminate\Support\Collection sent(string|\Closure $mailable, callable|null $callback = null)
* @method static bool hasSent(string $mailable)
* @method static \Illuminate\Support\Collection queued(string|\Closure $mailable, callable|null $callback = null)
* @method static bool hasQueued(string $mailable)
*
* @see \Illuminate\Mail\MailManager
* @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()
{
$actualMailManager = static::isFake()
? static::getFacadeRoot()->manager
: static::getFacadeRoot();
return tap(new MailFake($actualMailManager), function ($fake) {
static::swap($fake);
});
}
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'mail.manager';
}
}

View File

@@ -1,29 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
use Illuminate\Foundation\MaintenanceModeManager;
/**
* @method static string getDefaultDriver()
* @method static mixed driver(string|null $driver = null)
* @method static \Illuminate\Foundation\MaintenanceModeManager extend(string $driver, \Closure $callback)
* @method static array getDrivers()
* @method static \Illuminate\Contracts\Container\Container getContainer()
* @method static \Illuminate\Foundation\MaintenanceModeManager setContainer(\Illuminate\Contracts\Container\Container $container)
* @method static \Illuminate\Foundation\MaintenanceModeManager forgetDrivers()
*
* @see \Illuminate\Foundation\MaintenanceModeManager
*/
class MaintenanceMode extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return MaintenanceModeManager::class;
}
}

View File

@@ -1,96 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
use Illuminate\Notifications\AnonymousNotifiable;
use Illuminate\Notifications\ChannelManager;
use Illuminate\Support\Testing\Fakes\NotificationFake;
/**
* @method static void send(\Illuminate\Support\Collection|mixed $notifiables, mixed $notification)
* @method static void sendNow(\Illuminate\Support\Collection|mixed $notifiables, mixed $notification, array|null $channels = null)
* @method static mixed channel(string|null $name = null)
* @method static string getDefaultDriver()
* @method static string deliversVia()
* @method static void deliverVia(string $channel)
* @method static \Illuminate\Notifications\ChannelManager locale(string $locale)
* @method static mixed driver(string|null $driver = null)
* @method static \Illuminate\Notifications\ChannelManager extend(string $driver, \Closure $callback)
* @method static array getDrivers()
* @method static \Illuminate\Contracts\Container\Container getContainer()
* @method static \Illuminate\Notifications\ChannelManager setContainer(\Illuminate\Contracts\Container\Container $container)
* @method static \Illuminate\Notifications\ChannelManager forgetDrivers()
* @method static void macro(string $name, object|callable $macro)
* @method static void mixin(object $mixin, bool $replace = true)
* @method static bool hasMacro(string $name)
* @method static void flushMacros()
* @method static void assertSentOnDemand(string|\Closure $notification, callable|null $callback = null)
* @method static void assertSentTo(mixed $notifiable, string|\Closure $notification, callable|null $callback = null)
* @method static void assertSentOnDemandTimes(string $notification, int $times = 1)
* @method static void assertSentToTimes(mixed $notifiable, string $notification, int $times = 1)
* @method static void assertNotSentTo(mixed $notifiable, string|\Closure $notification, callable|null $callback = null)
* @method static void assertNothingSent()
* @method static void assertNothingSentTo(mixed $notifiable)
* @method static void assertSentTimes(string $notification, int $expectedCount)
* @method static void assertCount(int $expectedCount)
* @method static \Illuminate\Support\Collection sent(mixed $notifiable, string $notification, callable|null $callback = null)
* @method static bool hasSent(mixed $notifiable, string $notification)
* @method static \Illuminate\Support\Testing\Fakes\NotificationFake serializeAndRestore(bool $serializeAndRestore = true)
* @method static array sentNotifications()
*
* @see \Illuminate\Notifications\ChannelManager
* @see \Illuminate\Support\Testing\Fakes\NotificationFake
*/
class Notification extends Facade
{
/**
* Replace the bound instance with a fake.
*
* @return \Illuminate\Support\Testing\Fakes\NotificationFake
*/
public static function fake()
{
return tap(new NotificationFake, function ($fake) {
static::swap($fake);
});
}
/**
* Begin sending a notification to an anonymous notifiable on the given channels.
*
* @param array $channels
* @return \Illuminate\Notifications\AnonymousNotifiable
*/
public static function routes(array $channels)
{
$notifiable = new AnonymousNotifiable;
foreach ($channels as $channel => $route) {
$notifiable->route($channel, $route);
}
return $notifiable;
}
/**
* 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;
}
}

View File

@@ -1,36 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
/**
* @method static void resolveOptionsUsing(\Closure|null $resolver)
* @method static void resolveTokenUsing(\Closure|null $resolver)
* @method static void setUpProcess(callable $callback)
* @method static void setUpTestCase(callable $callback)
* @method static void setUpTestDatabaseBeforeMigrating(callable $callback)
* @method static void setUpTestDatabase(callable $callback)
* @method static void tearDownProcess(callable $callback)
* @method static void tearDownTestCase(callable $callback)
* @method static void callSetUpProcessCallbacks()
* @method static void callSetUpTestCaseCallbacks(\Illuminate\Foundation\Testing\TestCase $testCase)
* @method static void callSetUpTestDatabaseBeforeMigratingCallbacks(string $database)
* @method static void callSetUpTestDatabaseCallbacks(string $database)
* @method static void callTearDownProcessCallbacks()
* @method static void callTearDownTestCaseCallbacks(\Illuminate\Foundation\Testing\TestCase $testCase)
* @method static mixed option(string $option)
* @method static string|false token()
*
* @see \Illuminate\Testing\ParallelTesting
*/
class ParallelTesting extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return \Illuminate\Testing\ParallelTesting::class;
}
}

View File

@@ -1,75 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
use Illuminate\Contracts\Auth\PasswordBroker;
/**
* @method static \Illuminate\Contracts\Auth\PasswordBroker broker(string|null $name = null)
* @method static string getDefaultDriver()
* @method static void setDefaultDriver(string $name)
* @method static string sendResetLink(array $credentials, \Closure|null $callback = null)
* @method static mixed reset(array $credentials, \Closure $callback)
* @method static \Illuminate\Contracts\Auth\CanResetPassword|null 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()
* @method static \Illuminate\Support\Timebox getTimebox()
*
* @see \Illuminate\Auth\Passwords\PasswordBrokerManager
* @see \Illuminate\Auth\Passwords\PasswordBroker
*/
class Password extends Facade
{
/**
* Constant representing a successfully sent password reset email.
*
* @var string
*/
const ResetLinkSent = PasswordBroker::RESET_LINK_SENT;
/**
* Constant representing a successfully reset password.
*
* @var string
*/
const PasswordReset = PasswordBroker::PASSWORD_RESET;
/**
* Constant indicating the user could not be found when attempting a password reset.
*
* @var string
*/
const InvalidUser = PasswordBroker::INVALID_USER;
/**
* Constant representing an invalid password reset token.
*
* @var string
*/
const InvalidToken = PasswordBroker::INVALID_TOKEN;
/**
* Constant representing a throttled password reset attempt.
*
* @var string
*/
const ResetThrottled = PasswordBroker::RESET_THROTTLED;
const RESET_LINK_SENT = PasswordBroker::RESET_LINK_SENT;
const PASSWORD_RESET = PasswordBroker::PASSWORD_RESET;
const INVALID_USER = PasswordBroker::INVALID_USER;
const INVALID_TOKEN = PasswordBroker::INVALID_TOKEN;
const RESET_THROTTLED = PasswordBroker::RESET_THROTTLED;
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'auth.password';
}
}

View File

@@ -1,42 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
/**
* @method static \Illuminate\Pipeline\Pipeline send(mixed $passable)
* @method static \Illuminate\Pipeline\Pipeline through(mixed $pipes)
* @method static \Illuminate\Pipeline\Pipeline pipe(mixed $pipes)
* @method static \Illuminate\Pipeline\Pipeline via(string $method)
* @method static mixed then(\Closure $destination)
* @method static mixed thenReturn()
* @method static \Illuminate\Pipeline\Pipeline finally(\Closure $callback)
* @method static \Illuminate\Pipeline\Pipeline withinTransaction(string|null|\UnitEnum|false $withinTransaction = null)
* @method static \Illuminate\Pipeline\Pipeline setContainer(\Illuminate\Contracts\Container\Container $container)
* @method static \Illuminate\Pipeline\Pipeline|mixed when(\Closure|mixed|null $value = null, callable|null $callback = null, callable|null $default = null)
* @method static \Illuminate\Pipeline\Pipeline|mixed unless(\Closure|mixed|null $value = null, callable|null $callback = null, callable|null $default = null)
* @method static void macro(string $name, object|callable $macro)
* @method static void mixin(object $mixin, bool $replace = true)
* @method static bool hasMacro(string $name)
* @method static void flushMacros()
*
* @see \Illuminate\Pipeline\Pipeline
*/
class Pipeline extends Facade
{
/**
* Indicates if the resolved instance should be cached.
*
* @var bool
*/
protected static $cached = false;
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'pipeline';
}
}

View File

@@ -1,75 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
use Closure;
use Illuminate\Process\Factory;
/**
* @method static \Illuminate\Process\PendingProcess command(array|string $command)
* @method static \Illuminate\Process\PendingProcess path(string $path)
* @method static \Illuminate\Process\PendingProcess timeout(int $timeout)
* @method static \Illuminate\Process\PendingProcess idleTimeout(int $timeout)
* @method static \Illuminate\Process\PendingProcess forever()
* @method static \Illuminate\Process\PendingProcess env(array $environment)
* @method static \Illuminate\Process\PendingProcess input(\Traversable|resource|string|int|float|bool|null $input)
* @method static \Illuminate\Process\PendingProcess quietly()
* @method static \Illuminate\Process\PendingProcess tty(bool $tty = true)
* @method static \Illuminate\Process\PendingProcess options(array $options)
* @method static \Illuminate\Contracts\Process\ProcessResult run(array|string|null $command = null, callable|null $output = null)
* @method static \Illuminate\Process\InvokedProcess start(array|string|null $command = null, callable|null $output = null)
* @method static bool supportsTty()
* @method static \Illuminate\Process\PendingProcess withFakeHandlers(array $fakeHandlers)
* @method static \Illuminate\Process\PendingProcess|mixed when(\Closure|mixed|null $value = null, callable|null $callback = null, callable|null $default = null)
* @method static \Illuminate\Process\PendingProcess|mixed unless(\Closure|mixed|null $value = null, callable|null $callback = null, callable|null $default = null)
* @method static \Illuminate\Process\FakeProcessResult result(array|string $output = '', array|string $errorOutput = '', int $exitCode = 0)
* @method static \Illuminate\Process\FakeProcessDescription describe()
* @method static \Illuminate\Process\FakeProcessSequence sequence(array $processes = [])
* @method static bool isRecording()
* @method static \Illuminate\Process\Factory recordIfRecording(\Illuminate\Process\PendingProcess $process, \Illuminate\Contracts\Process\ProcessResult $result)
* @method static \Illuminate\Process\Factory record(\Illuminate\Process\PendingProcess $process, \Illuminate\Contracts\Process\ProcessResult $result)
* @method static \Illuminate\Process\Factory preventStrayProcesses(bool $prevent = true)
* @method static bool preventingStrayProcesses()
* @method static \Illuminate\Process\Factory assertRan(\Closure|string $callback)
* @method static \Illuminate\Process\Factory assertRanTimes(\Closure|string $callback, int $times = 1)
* @method static \Illuminate\Process\Factory assertNotRan(\Closure|string $callback)
* @method static \Illuminate\Process\Factory assertDidntRun(\Closure|string $callback)
* @method static \Illuminate\Process\Factory assertNothingRan()
* @method static \Illuminate\Process\Pool pool(callable $callback)
* @method static \Illuminate\Contracts\Process\ProcessResult pipe(callable|array $callback, callable|null $output = null)
* @method static \Illuminate\Process\ProcessPoolResults concurrently(callable $callback, callable|null $output = null)
* @method static \Illuminate\Process\PendingProcess newPendingProcess()
* @method static void macro(string $name, object|callable $macro)
* @method static void mixin(object $mixin, bool $replace = true)
* @method static bool hasMacro(string $name)
* @method static void flushMacros()
* @method static mixed macroCall(string $method, array $parameters)
*
* @see \Illuminate\Process\PendingProcess
* @see \Illuminate\Process\Factory
*/
class Process extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return Factory::class;
}
/**
* Indicate that the process factory should fake processes.
*
* @param \Closure|array|null $callback
* @return \Illuminate\Process\Factory
*/
public static function fake(Closure|array|null $callback = null)
{
return tap(static::getFacadeRoot(), function ($fake) use ($callback) {
static::swap($fake->fake($callback));
});
}
}

View File

@@ -1,168 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
use Illuminate\Queue\Worker;
use Illuminate\Support\Testing\Fakes\QueueFake;
/**
* @method static void before(mixed $callback)
* @method static void after(mixed $callback)
* @method static void exceptionOccurred(mixed $callback)
* @method static void looping(mixed $callback)
* @method static void failing(mixed $callback)
* @method static void starting(mixed $callback)
* @method static void stopping(mixed $callback)
* @method static bool connected(string|null $name = null)
* @method static \Illuminate\Contracts\Queue\Queue connection(string|null $name = null)
* @method static void pause(string $connection, string $queue)
* @method static void pauseFor(string $connection, string $queue, \DateTimeInterface|\DateInterval|int $ttl)
* @method static void resume(string $connection, string $queue)
* @method static bool isPaused(string $connection, string $queue)
* @method static void withoutInterruptionPolling()
* @method static void extend(string $driver, \Closure $resolver)
* @method static void addConnector(string $driver, \Closure $resolver)
* @method static string getDefaultDriver()
* @method static void setDefaultDriver(string $name)
* @method static string getName(string|null $connection = null)
* @method static \Illuminate\Contracts\Foundation\Application getApplication()
* @method static \Illuminate\Queue\QueueManager setApplication(\Illuminate\Contracts\Foundation\Application $app)
* @method static int size(string|null $queue = null)
* @method static mixed push(string|object $job, mixed $data = '', string|null $queue = null)
* @method static mixed pushOn(string $queue, string|object $job, mixed $data = '')
* @method static mixed pushRaw(string $payload, string|null $queue = null, array $options = [])
* @method static mixed later(\DateTimeInterface|\DateInterval|int $delay, string|object $job, mixed $data = '', string|null $queue = null)
* @method static mixed laterOn(string $queue, \DateTimeInterface|\DateInterval|int $delay, string|object $job, mixed $data = '')
* @method static mixed bulk(array $jobs, mixed $data = '', string|null $queue = null)
* @method static \Illuminate\Contracts\Queue\Job|null pop(string|null $queue = null)
* @method static string getConnectionName()
* @method static \Illuminate\Contracts\Queue\Queue setConnectionName(string $name)
* @method static int pendingSize(string|null $queue = null)
* @method static int delayedSize(string|null $queue = null)
* @method static int reservedSize(string|null $queue = null)
* @method static int|null creationTimeOfOldestPendingJob(string|null $queue = null)
* @method static mixed getJobTries(mixed $job)
* @method static mixed getJobBackoff(mixed $job)
* @method static mixed getJobExpiration(mixed $job)
* @method static void createPayloadUsing(callable|null $callback)
* @method static array getConfig()
* @method static \Illuminate\Queue\Queue setConfig(array $config)
* @method static \Illuminate\Container\Container getContainer()
* @method static void setContainer(\Illuminate\Container\Container $container)
* @method static \Illuminate\Support\Testing\Fakes\QueueFake except(array|string $jobsToBeQueued)
* @method static void assertPushed(string|\Closure $job, callable|int|null $callback = null)
* @method static void assertPushedTimes(string $job, int $times = 1)
* @method static void assertPushedOn(string $queue, string|\Closure $job, callable|null $callback = null)
* @method static void assertPushedWithChain(string $job, array $expectedChain = [], callable|null $callback = null)
* @method static void assertPushedWithoutChain(string $job, callable|null $callback = null)
* @method static void assertClosurePushed(callable|int|null $callback = null)
* @method static void assertClosureNotPushed(callable|null $callback = null)
* @method static void assertNotPushed(string|\Closure $job, callable|null $callback = null)
* @method static void assertCount(int $expectedCount)
* @method static void assertNothingPushed()
* @method static \Illuminate\Support\Collection pushed(string $job, callable|null $callback = null)
* @method static \Illuminate\Support\Collection pushedRaw(null|\Closure $callback = null)
* @method static \Illuminate\Support\Collection listenersPushed(string $listenerClass, \Closure|null $callback = null)
* @method static bool hasPushed(string $job)
* @method static bool shouldFakeJob(object $job)
* @method static array pushedJobs()
* @method static array rawPushes()
* @method static \Illuminate\Support\Testing\Fakes\QueueFake serializeAndRestore(bool $serializeAndRestore = true)
* @method static void releaseUniqueJobLocks()
*
* @see \Illuminate\Queue\QueueManager
* @see \Illuminate\Queue\Queue
* @see \Illuminate\Support\Testing\Fakes\QueueFake
*/
class Queue extends Facade
{
/**
* Register a callback to be executed to pick jobs.
*
* @param string $workerName
* @param callable $callback
* @return void
*/
public static function popUsing($workerName, $callback)
{
Worker::popUsing($workerName, $callback);
}
/**
* Replace the bound instance with a fake.
*
* @param array|string $jobsToFake
* @return \Illuminate\Support\Testing\Fakes\QueueFake
*/
public static function fake($jobsToFake = [])
{
$actualQueueManager = static::isFake()
? tap(static::getFacadeRoot(), fn ($fake) => $fake->releaseUniqueJobLocks())->queue
: static::getFacadeRoot();
return tap(new QueueFake(static::getFacadeApplication(), $jobsToFake, $actualQueueManager), function ($fake) {
static::swap($fake);
});
}
/**
* Replace the bound instance with a fake that fakes all jobs except the given jobs.
*
* @param string[]|string $jobsToAllow
* @return \Illuminate\Support\Testing\Fakes\QueueFake
*/
public static function fakeExcept($jobsToAllow)
{
return static::fake()->except($jobsToAllow);
}
/**
* Replace the bound instance with a fake during the given callable's execution.
*
* @param callable $callable
* @param array $jobsToFake
* @return mixed
*/
public static function fakeFor(callable $callable, array $jobsToFake = [])
{
$originalQueueManager = static::getFacadeRoot();
static::fake($jobsToFake);
try {
return $callable();
} finally {
static::swap($originalQueueManager);
}
}
/**
* Replace the bound instance with a fake during the given callable's execution.
*
* @param callable $callable
* @param array $jobsToAllow
* @return mixed
*/
public static function fakeExceptFor(callable $callable, array $jobsToAllow = [])
{
$originalQueueManager = static::getFacadeRoot();
static::fakeExcept($jobsToAllow);
try {
return $callable();
} finally {
static::swap($originalQueueManager);
}
}
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'queue';
}
}

View File

@@ -1,34 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
/**
* @method static \Illuminate\Cache\RateLimiter for(\UnitEnum|string $name, \Closure $callback)
* @method static \Closure|null limiter(\UnitEnum|string $name)
* @method static mixed attempt(string $key, int $maxAttempts, \Closure $callback, \DateTimeInterface|\DateInterval|int $decaySeconds = 60)
* @method static bool tooManyAttempts(string $key, int $maxAttempts)
* @method static int hit(string $key, \DateTimeInterface|\DateInterval|int $decaySeconds = 60)
* @method static int increment(string $key, \DateTimeInterface|\DateInterval|int $decaySeconds = 60, int $amount = 1)
* @method static int decrement(string $key, \DateTimeInterface|\DateInterval|int $decaySeconds = 60, int $amount = 1)
* @method static mixed attempts(string $key)
* @method static bool resetAttempts(string $key)
* @method static int remaining(string $key, int $maxAttempts)
* @method static int retriesLeft(string $key, int $maxAttempts)
* @method static void clear(string $key)
* @method static int availableIn(string $key)
* @method static string cleanRateLimiterKey(string $key)
*
* @see \Illuminate\Cache\RateLimiter
*/
class RateLimiter extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return \Illuminate\Cache\RateLimiter::class;
}
}

View File

@@ -1,39 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
/**
* @method static \Illuminate\Http\RedirectResponse back(int $status = 302, array $headers = [], mixed $fallback = false)
* @method static \Illuminate\Http\RedirectResponse refresh(int $status = 302, array $headers = [])
* @method static \Illuminate\Http\RedirectResponse guest(string $path, int $status = 302, array $headers = [], bool|null $secure = null)
* @method static \Illuminate\Http\RedirectResponse intended(mixed $default = '/', int $status = 302, array $headers = [], bool|null $secure = null)
* @method static \Illuminate\Http\RedirectResponse to(string $path, int $status = 302, array $headers = [], bool|null $secure = null)
* @method static \Illuminate\Http\RedirectResponse away(string $path, int $status = 302, array $headers = [])
* @method static \Illuminate\Http\RedirectResponse secure(string $path, int $status = 302, array $headers = [])
* @method static \Illuminate\Http\RedirectResponse route(\BackedEnum|string $route, mixed $parameters = [], int $status = 302, array $headers = [])
* @method static \Illuminate\Http\RedirectResponse signedRoute(\BackedEnum|string $route, mixed $parameters = [], \DateTimeInterface|\DateInterval|int|null $expiration = null, int $status = 302, array $headers = [])
* @method static \Illuminate\Http\RedirectResponse temporarySignedRoute(\BackedEnum|string $route, \DateTimeInterface|\DateInterval|int|null $expiration, mixed $parameters = [], int $status = 302, array $headers = [])
* @method static \Illuminate\Http\RedirectResponse action(string|array $action, mixed $parameters = [], int $status = 302, array $headers = [])
* @method static \Illuminate\Routing\UrlGenerator getUrlGenerator()
* @method static void setSession(\Illuminate\Session\Store $session)
* @method static string|null getIntendedUrl()
* @method static \Illuminate\Routing\Redirector setIntendedUrl(string $url)
* @method static void macro(string $name, object|callable $macro)
* @method static void mixin(object $mixin, bool $replace = true)
* @method static bool hasMacro(string $name)
* @method static void flushMacros()
*
* @see \Illuminate\Routing\Redirector
*/
class Redirect extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'redirect';
}
}

View File

@@ -1,320 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
/**
* @method static \Illuminate\Redis\Connections\Connection connection(\UnitEnum|string|null $name = null)
* @method static \Illuminate\Redis\Connections\Connection resolve(string|null $name = null)
* @method static array connections()
* @method static void enableEvents()
* @method static void disableEvents()
* @method static void setDriver(string $driver)
* @method static void purge(string|null $name = null)
* @method static \Illuminate\Redis\RedisManager extend(string $driver, \Closure $callback)
* @method static void createSubscription(array|string $channels, \Closure $callback, string $method = 'subscribe')
* @method static \Illuminate\Redis\Limiters\ConcurrencyLimiterBuilder funnel(string $name)
* @method static \Illuminate\Redis\Limiters\DurationLimiterBuilder throttle(string $name)
* @method static mixed client()
* @method static void subscribe(array|string $channels, \Closure $callback)
* @method static void psubscribe(array|string $channels, \Closure $callback)
* @method static mixed command(string $method, array $parameters = [])
* @method static void listen(\Closure $callback)
* @method static void listenForFailures(\Closure $callback)
* @method static string|null getName()
* @method static \Illuminate\Redis\Connections\Connection setName(string $name)
* @method static \Illuminate\Contracts\Events\Dispatcher|null getEventDispatcher()
* @method static void setEventDispatcher(\Illuminate\Contracts\Events\Dispatcher $events)
* @method static void unsetEventDispatcher()
* @method static void macro(string $name, object|callable $macro)
* @method static void mixin(object $mixin, bool $replace = true)
* @method static bool hasMacro(string $name)
* @method static void flushMacros()
* @method static mixed macroCall(string $method, array $parameters)
* @method static string _compress(string $value)
* @method static string _uncompress(string $value)
* @method static string _prefix(string $key)
* @method static string _serialize(mixed $value)
* @method static mixed _unserialize(string $value)
* @method static string _pack(mixed $value)
* @method static mixed _unpack(string $value)
* @method static mixed acl(string $subcmd, string ...$args)
* @method static \Redis|int|false append(string $key, mixed $value)
* @method static \Redis|bool auth(mixed $credentials)
* @method static \Redis|bool bgSave()
* @method static \Redis|bool bgrewriteaof()
* @method static \Redis|array|false waitaof(int $numlocal, int $numreplicas, int $timeout)
* @method static \Redis|int|false bitcount(string $key, int $start = 0, int $end = -1, bool $bybit = false)
* @method static \Redis|int|false bitop(string $operation, string $deskey, string $srckey, string ...$other_keys)
* @method static \Redis|int|false bitpos(string $key, bool $bit, int $start = 0, int $end = -1, bool $bybit = false)
* @method static \Redis|array|false|null blPop(array|string $key_or_keys, string|int|float $timeout_or_key, mixed ...$extra_args)
* @method static \Redis|array|false|null brPop(array|string $key_or_keys, string|int|float $timeout_or_key, mixed ...$extra_args)
* @method static \Redis|string|false brpoplpush(string $src, string $dst, int|float $timeout)
* @method static \Redis|array|false bzPopMax(array|string $key, string|int $timeout_or_key, mixed ...$extra_args)
* @method static \Redis|array|false bzPopMin(array|string $key, string|int $timeout_or_key, mixed ...$extra_args)
* @method static \Redis|array|false|null bzmpop(float $timeout, array $keys, string $from, int $count = 1)
* @method static \Redis|array|false|null zmpop(array $keys, string $from, int $count = 1)
* @method static \Redis|array|false|null blmpop(float $timeout, array $keys, string $from, int $count = 1)
* @method static \Redis|array|false|null lmpop(array $keys, string $from, int $count = 1)
* @method static bool clearLastError()
* @method static bool close()
* @method static mixed config(string $operation, array|string|null $key_or_settings = null, string|null $value = null)
* @method static bool connect(string $host, int $port = 6379, float $timeout = 0, string|null $persistent_id = null, int $retry_interval = 0, float $read_timeout = 0, array|null $context = null)
* @method static \Redis|bool copy(string $src, string $dst, array|null $options = null)
* @method static \Redis|int|false dbSize()
* @method static \Redis|string debug(string $key)
* @method static \Redis|int|false decr(string $key, int $by = 1)
* @method static \Redis|int|false decrBy(string $key, int $value)
* @method static \Redis|int|false del(array|string $key, string ...$other_keys)
* @method static \Redis|int|false delifeq(string $key, mixed $value)
* @method static \Redis|bool discard()
* @method static \Redis|string|false dump(string $key)
* @method static \Redis|string|false echo(string $str)
* @method static mixed eval(string $script, array $args = [], int $num_keys = 0)
* @method static mixed eval_ro(string $script_sha, array $args = [], int $num_keys = 0)
* @method static mixed evalsha(string $sha1, array $args = [], int $num_keys = 0)
* @method static mixed evalsha_ro(string $sha1, array $args = [], int $num_keys = 0)
* @method static \Redis|array|false exec()
* @method static \Redis|int|bool exists(mixed $key, mixed ...$other_keys)
* @method static \Redis|bool expire(string $key, int $timeout, string|null $mode = null)
* @method static \Redis|bool expireAt(string $key, int $timestamp, string|null $mode = null)
* @method static \Redis|bool failover(array|null $to = null, bool $abort = false, int $timeout = 0)
* @method static \Redis|int|false expiretime(string $key)
* @method static \Redis|int|false pexpiretime(string $key)
* @method static mixed fcall(string $fn, array $keys = [], array $args = [])
* @method static mixed fcall_ro(string $fn, array $keys = [], array $args = [])
* @method static \Redis|bool flushAll(bool|null $sync = null)
* @method static \Redis|bool flushDB(bool|null $sync = null)
* @method static \Redis|array|string|bool function(string $operation, mixed ...$args)
* @method static \Redis|int|false geoadd(string $key, float $lng, float $lat, string $member, mixed ...$other_triples_and_options)
* @method static \Redis|float|false geodist(string $key, string $src, string $dst, string|null $unit = null)
* @method static \Redis|array|false geohash(string $key, string $member, string ...$other_members)
* @method static \Redis|array|false geopos(string $key, string $member, string ...$other_members)
* @method static mixed georadius(string $key, float $lng, float $lat, float $radius, string $unit, array $options = [])
* @method static mixed georadius_ro(string $key, float $lng, float $lat, float $radius, string $unit, array $options = [])
* @method static mixed georadiusbymember(string $key, string $member, float $radius, string $unit, array $options = [])
* @method static mixed georadiusbymember_ro(string $key, string $member, float $radius, string $unit, array $options = [])
* @method static array geosearch(string $key, array|string $position, array|int|float $shape, string $unit, array $options = [])
* @method static \Redis|array|int|false geosearchstore(string $dst, string $src, array|string $position, array|int|float $shape, string $unit, array $options = [])
* @method static mixed get(string $key)
* @method static \Redis|array|false getWithMeta(string $key)
* @method static mixed getAuth()
* @method static \Redis|int|false getBit(string $key, int $idx)
* @method static \Redis|string|bool getEx(string $key, array $options = [])
* @method static int getDBNum()
* @method static \Redis|string|bool getDel(string $key)
* @method static string getHost()
* @method static string|null getLastError()
* @method static int getMode()
* @method static mixed getOption(int $option)
* @method static string|null getPersistentID()
* @method static int getPort()
* @method static string|false serverName()
* @method static string|false serverVersion()
* @method static \Redis|string|false getRange(string $key, int $start, int $end)
* @method static \Redis|array|string|int|false lcs(string $key1, string $key2, array|null $options = null)
* @method static float getReadTimeout()
* @method static \Redis|string|false getset(string $key, mixed $value)
* @method static float|false getTimeout()
* @method static array getTransferredBytes()
* @method static void clearTransferredBytes()
* @method static \Redis|int|false hDel(string $key, string $field, string ...$other_fields)
* @method static \Redis|bool hExists(string $key, string $field)
* @method static mixed hGet(string $key, string $member)
* @method static \Redis|array|false hGetAll(string $key)
* @method static mixed hGetWithMeta(string $key, string $member)
* @method static \Redis|int|false hIncrBy(string $key, string $field, int $value)
* @method static \Redis|float|false hIncrByFloat(string $key, string $field, float $value)
* @method static \Redis|array|false hKeys(string $key)
* @method static \Redis|int|false hLen(string $key)
* @method static \Redis|array|false hMget(string $key, array $fields)
* @method static \Redis|array|false hgetex(string $key, array $fields, array|string|null $expiry = null)
* @method static \Redis|int|false hsetex(string $key, array $fields, array|null $expiry = null)
* @method static \Redis|array|false hgetdel(string $key, array $fields)
* @method static \Redis|bool hMset(string $key, array $fieldvals)
* @method static \Redis|array|string|false hRandField(string $key, array|null $options = null)
* @method static \Redis|int|false hSet(string $key, mixed ...$fields_and_vals)
* @method static \Redis|bool hSetNx(string $key, string $field, mixed $value)
* @method static \Redis|int|false hStrLen(string $key, string $field)
* @method static \Redis|array|false hVals(string $key)
* @method static \Redis|array|false hexpire(string $key, int $ttl, array $fields, string|null $mode = null)
* @method static \Redis|array|false hpexpire(string $key, int $ttl, array $fields, string|null $mode = null)
* @method static \Redis|array|false hexpireat(string $key, int $time, array $fields, string|null $mode = null)
* @method static \Redis|array|false hpexpireat(string $key, int $mstime, array $fields, string|null $mode = null)
* @method static \Redis|array|false httl(string $key, array $fields)
* @method static \Redis|array|false hpttl(string $key, array $fields)
* @method static \Redis|array|false hexpiretime(string $key, array $fields)
* @method static \Redis|array|false hpexpiretime(string $key, array $fields)
* @method static \Redis|array|false hpersist(string $key, array $fields)
* @method static \Redis|array|bool hscan(string $key, string|int|null $iterator, string|null $pattern = null, int $count = 0)
* @method static \Redis|int|false expiremember(string $key, string $field, int $ttl, string|null $unit = null)
* @method static \Redis|int|false expirememberat(string $key, string $field, int $timestamp)
* @method static \Redis|int|false incr(string $key, int $by = 1)
* @method static \Redis|int|false incrBy(string $key, int $value)
* @method static \Redis|float|false incrByFloat(string $key, float $value)
* @method static \Redis|array|false info(string ...$sections)
* @method static bool isConnected()
* @method static void keys(string $pattern)
* @method static void lInsert(string $key, string $pos, mixed $pivot, mixed $value)
* @method static \Redis|int|false lLen(string $key)
* @method static \Redis|string|false lMove(string $src, string $dst, string $wherefrom, string $whereto)
* @method static \Redis|string|false blmove(string $src, string $dst, string $wherefrom, string $whereto, float $timeout)
* @method static \Redis|array|string|bool lPop(string $key, int $count = 0)
* @method static \Redis|array|int|bool|null lPos(string $key, mixed $value, array|null $options = null)
* @method static \Redis|int|false lPush(string $key, mixed ...$elements)
* @method static \Redis|int|false rPush(string $key, mixed ...$elements)
* @method static \Redis|int|false lPushx(string $key, mixed $value)
* @method static \Redis|int|false rPushx(string $key, mixed $value)
* @method static \Redis|bool lSet(string $key, int $index, mixed $value)
* @method static int lastSave()
* @method static mixed lindex(string $key, int $index)
* @method static \Redis|array|false lrange(string $key, int $start, int $end)
* @method static \Redis|int|false lrem(string $key, mixed $value, int $count = 0)
* @method static \Redis|bool ltrim(string $key, int $start, int $end)
* @method static \Redis|array|false mget(array $keys)
* @method static \Redis|bool migrate(string $host, int $port, array|string $key, int $dstdb, int $timeout, bool $copy = false, bool $replace = false, mixed $credentials = null)
* @method static \Redis|bool move(string $key, int $index)
* @method static \Redis|bool mset(array $key_values)
* @method static \Redis|bool msetnx(array $key_values)
* @method static \Redis|bool multi(int $value = 1)
* @method static \Redis|string|int|false object(string $subcommand, string $key)
* @method static bool pconnect(string $host, int $port = 6379, float $timeout = 0, string|null $persistent_id = null, int $retry_interval = 0, float $read_timeout = 0, array|null $context = null)
* @method static \Redis|bool persist(string $key)
* @method static bool pexpire(string $key, int $timeout, string|null $mode = null)
* @method static \Redis|bool pexpireAt(string $key, int $timestamp, string|null $mode = null)
* @method static \Redis|int pfadd(string $key, array $elements)
* @method static \Redis|int|false pfcount(array|string $key_or_keys)
* @method static \Redis|bool pfmerge(string $dst, array $srckeys)
* @method static \Redis|string|bool ping(string|null $message = null)
* @method static \Redis|bool pipeline()
* @method static \Redis|bool psetex(string $key, int $expire, mixed $value)
* @method static \Redis|int|false pttl(string $key)
* @method static \Redis|int|false publish(string $channel, string $message)
* @method static mixed pubsub(string $command, mixed $arg = null)
* @method static \Redis|array|bool punsubscribe(array $patterns)
* @method static \Redis|array|string|bool rPop(string $key, int $count = 0)
* @method static \Redis|string|false randomKey()
* @method static mixed rawcommand(string $command, mixed ...$args)
* @method static \Redis|bool rename(string $old_name, string $new_name)
* @method static \Redis|bool renameNx(string $key_src, string $key_dst)
* @method static \Redis|bool reset()
* @method static \Redis|bool restore(string $key, int $ttl, string $value, array|null $options = null)
* @method static mixed role()
* @method static \Redis|string|false rpoplpush(string $srckey, string $dstkey)
* @method static \Redis|int|false sAdd(string $key, mixed $value, mixed ...$other_values)
* @method static int sAddArray(string $key, array $values)
* @method static \Redis|array|false sDiff(string $key, string ...$other_keys)
* @method static \Redis|int|false sDiffStore(string $dst, string $key, string ...$other_keys)
* @method static \Redis|array|false sInter(array|string $key, string ...$other_keys)
* @method static \Redis|int|false sintercard(array $keys, int $limit = -1)
* @method static \Redis|int|false sInterStore(array|string $key, string ...$other_keys)
* @method static \Redis|array|false sMembers(string $key)
* @method static \Redis|array|false sMisMember(string $key, string $member, string ...$other_members)
* @method static \Redis|bool sMove(string $src, string $dst, mixed $value)
* @method static \Redis|array|string|false sPop(string $key, int $count = 0)
* @method static mixed sRandMember(string $key, int $count = 0)
* @method static \Redis|array|false sUnion(string $key, string ...$other_keys)
* @method static \Redis|int|false sUnionStore(string $dst, string $key, string ...$other_keys)
* @method static \Redis|bool save()
* @method static array|false scan(string|int|null $iterator, string|null $pattern = null, int $count = 0, string|null $type = null)
* @method static \Redis|int|false scard(string $key)
* @method static mixed script(string $command, mixed ...$args)
* @method static \Redis|bool select(int $db)
* @method static \Redis|string|bool set(string $key, mixed $value, mixed $options = null)
* @method static \Redis|int|false setBit(string $key, int $idx, bool $value)
* @method static \Redis|int|false setRange(string $key, int $index, string $value)
* @method static bool setOption(int $option, mixed $value)
* @method static void setex(string $key, int $expire, mixed $value)
* @method static \Redis|bool setnx(string $key, mixed $value)
* @method static \Redis|bool sismember(string $key, mixed $value)
* @method static \Redis|bool replicaof(string|null $host = null, int $port = 6379)
* @method static \Redis|int|false touch(array|string $key_or_array, string ...$more_keys)
* @method static mixed slowlog(string $operation, int $length = 0)
* @method static mixed sort(string $key, array|null $options = null)
* @method static mixed sort_ro(string $key, array|null $options = null)
* @method static \Redis|int|false srem(string $key, mixed $value, mixed ...$other_values)
* @method static array|false sscan(string $key, string|int|null $iterator, string|null $pattern = null, int $count = 0)
* @method static bool ssubscribe(array $channels, callable $cb)
* @method static \Redis|int|false strlen(string $key)
* @method static \Redis|array|bool sunsubscribe(array $channels)
* @method static \Redis|bool swapdb(int $src, int $dst)
* @method static \Redis|array time()
* @method static \Redis|int|false ttl(string $key)
* @method static \Redis|int|false type(string $key)
* @method static \Redis|int|false unlink(array|string $key, string ...$other_keys)
* @method static \Redis|array|bool unsubscribe(array $channels)
* @method static \Redis|bool unwatch()
* @method static \Redis|bool watch(array|string $key, string ...$other_keys)
* @method static int|false wait(int $numreplicas, int $timeout)
* @method static int|false xack(string $key, string $group, array $ids)
* @method static \Redis|string|false xadd(string $key, string $id, array $values, int $maxlen = 0, bool $approx = false, bool $nomkstream = false)
* @method static \Redis|array|bool xautoclaim(string $key, string $group, string $consumer, int $min_idle, string $start, int $count = -1, bool $justid = false)
* @method static \Redis|array|bool xclaim(string $key, string $group, string $consumer, int $min_idle, array $ids, array $options)
* @method static \Redis|int|false xdel(string $key, array $ids)
* @method static mixed xgroup(string $operation, string|null $key = null, string|null $group = null, string|null $id_or_consumer = null, bool $mkstream = false, int $entries_read = -2)
* @method static mixed xinfo(string $operation, string|null $arg1 = null, string|null $arg2 = null, int $count = -1)
* @method static \Redis|int|false xlen(string $key)
* @method static \Redis|array|false xpending(string $key, string $group, string|null $start = null, string|null $end = null, int $count = -1, string|null $consumer = null)
* @method static \Redis|array|bool xrange(string $key, string $start, string $end, int $count = -1)
* @method static \Redis|array|bool xread(array $streams, int $count = -1, int $block = -1)
* @method static \Redis|array|bool xreadgroup(string $group, string $consumer, array $streams, int $count = 1, int $block = 1)
* @method static \Redis|array|bool xrevrange(string $key, string $end, string $start, int $count = -1)
* @method static \Redis|int|false vadd(string $key, array $values, mixed $element, array|null $options = null)
* @method static \Redis|array|false vsim(string $key, mixed $member, array|null $options = null)
* @method static \Redis|int|false vcard(string $key)
* @method static \Redis|int|false vdim(string $key)
* @method static \Redis|array|false vinfo(string $key)
* @method static \Redis|bool vismember(string $key, mixed $member)
* @method static \Redis|array|false vemb(string $key, mixed $member, bool $raw = false)
* @method static \Redis|array|string|false vrandmember(string $key, int $count = 0)
* @method static \Redis|array|false vrange(string $key, string $min, string $max, int $count = -1)
* @method static \Redis|int|false vrem(string $key, mixed $member)
* @method static \Redis|int|false vsetattr(string $key, mixed $member, array|string $attributes)
* @method static \Redis|array|string|false vgetattr(string $key, mixed $member, bool $decode = true)
* @method static \Redis|array|false vlinks(string $key, mixed $member, bool $withscores = false)
* @method static \Redis|int|false xtrim(string $key, string $threshold, bool $approx = false, bool $minid = false, int $limit = -1)
* @method static \Redis|int|float|false zAdd(string $key, array|float $score_or_options, mixed ...$more_scores_and_mems)
* @method static \Redis|int|false zCard(string $key)
* @method static \Redis|int|false zCount(string $key, string|int $start, string|int $end)
* @method static \Redis|float|false zIncrBy(string $key, float $value, mixed $member)
* @method static \Redis|int|false zLexCount(string $key, string $min, string $max)
* @method static \Redis|array|false zMscore(string $key, mixed $member, mixed ...$other_members)
* @method static \Redis|array|false zPopMax(string $key, int|null $count = null)
* @method static \Redis|array|false zPopMin(string $key, int|null $count = null)
* @method static \Redis|array|false zRange(string $key, string|int $start, string|int $end, array|bool|null $options = null)
* @method static \Redis|array|false zRangeByLex(string $key, string $min, string $max, int $offset = -1, int $count = -1)
* @method static \Redis|array|false zRangeByScore(string $key, string $start, string $end, array $options = [])
* @method static \Redis|int|false zrangestore(string $dstkey, string $srckey, string $start, string $end, array|bool|null $options = null)
* @method static \Redis|array|string zRandMember(string $key, array|null $options = null)
* @method static \Redis|int|false zRank(string $key, mixed $member)
* @method static \Redis|int|false zRem(mixed $key, mixed $member, mixed ...$other_members)
* @method static \Redis|int|false zRemRangeByLex(string $key, string $min, string $max)
* @method static \Redis|int|false zRemRangeByRank(string $key, int $start, int $end)
* @method static \Redis|int|false zRemRangeByScore(string $key, string $start, string $end)
* @method static \Redis|array|false zRevRange(string $key, int $start, int $end, mixed $scores = null)
* @method static \Redis|array|false zRevRangeByLex(string $key, string $max, string $min, int $offset = -1, int $count = -1)
* @method static \Redis|array|false zRevRangeByScore(string $key, string $max, string $min, array|bool $options = [])
* @method static \Redis|int|false zRevRank(string $key, mixed $member)
* @method static \Redis|float|false zScore(string $key, mixed $member)
* @method static \Redis|array|false zdiff(array $keys, array|null $options = null)
* @method static \Redis|int|false zdiffstore(string $dst, array $keys)
* @method static \Redis|array|false zinter(array $keys, array|null $weights = null, array|null $options = null)
* @method static \Redis|int|false zintercard(array $keys, int $limit = -1)
* @method static \Redis|int|false zinterstore(string $dst, array $keys, array|null $weights = null, string|null $aggregate = null)
* @method static \Redis|array|false zscan(string $key, string|int|null $iterator, string|null $pattern = null, int $count = 0)
* @method static \Redis|array|false zunion(array $keys, array|null $weights = null, array|null $options = null)
* @method static \Redis|int|false zunionstore(string $dst, array $keys, array|null $weights = null, string|null $aggregate = null)
*
* @see \Illuminate\Redis\RedisManager
*/
class Redis extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'redis';
}
}

View File

@@ -1,210 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
/**
* @method static \Illuminate\Http\Request capture()
* @method static \Illuminate\Http\Request instance()
* @method static string method()
* @method static \Illuminate\Support\Uri uri()
* @method static string root()
* @method static string url()
* @method static string fullUrl()
* @method static string fullUrlWithQuery(array $query)
* @method static string fullUrlWithoutQuery(array|string $keys)
* @method static string path()
* @method static string decodedPath()
* @method static string|null segment(int $index, string|null $default = null)
* @method static array segments()
* @method static bool is(mixed ...$patterns)
* @method static bool routeIs(mixed ...$patterns)
* @method static bool fullUrlIs(mixed ...$patterns)
* @method static string host()
* @method static string httpHost()
* @method static string schemeAndHttpHost()
* @method static bool ajax()
* @method static bool pjax()
* @method static bool prefetch()
* @method static bool secure()
* @method static string|null ip()
* @method static array ips()
* @method static string|null userAgent()
* @method static array getAcceptableContentTypes()
* @method static \Illuminate\Http\Request merge(array $input)
* @method static \Illuminate\Http\Request mergeIfMissing(array $input)
* @method static \Illuminate\Http\Request replace(array $input)
* @method static \Symfony\Component\HttpFoundation\InputBag|mixed json(string|null $key = null, mixed $default = null)
* @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 bool hasSession(bool $skipIfUninitialized = false)
* @method static \Symfony\Component\HttpFoundation\Session\SessionInterface getSession()
* @method static \Illuminate\Contracts\Session\Session session()
* @method static void setLaravelSession(\Illuminate\Contracts\Session\Session $session)
* @method static void setRequestLocale(string $locale)
* @method static void setDefaultRequestLocale(string $locale)
* @method static mixed user(string|null $guard = null)
* @method static \Illuminate\Routing\Route|object|string|null route(string|null $param = null, mixed $default = null)
* @method static string fingerprint()
* @method static \Illuminate\Http\Request setJson(\Symfony\Component\HttpFoundation\InputBag $json)
* @method static \Closure getUserResolver()
* @method static \Illuminate\Http\Request setUserResolver(\Closure $callback)
* @method static \Closure getRouteResolver()
* @method static \Illuminate\Http\Request setRouteResolver(\Closure $callback)
* @method static array toArray()
* @method static void initialize(array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], string|resource|null $content = null)
* @method static \Illuminate\Http\Request createFromGlobals()
* @method static \Illuminate\Http\Request create(string $uri, string $method = 'GET', array $parameters = [], array $cookies = [], array $files = [], array $server = [], string|resource|null $content = null)
* @method static void setFactory(callable|null $callable)
* @method static void overrideGlobals()
* @method static void setTrustedProxies(array $proxies, int $trustedHeaderSet)
* @method static string[] getTrustedProxies()
* @method static int getTrustedHeaderSet()
* @method static void setTrustedHosts(array $hostPatterns)
* @method static string[] getTrustedHosts()
* @method static string normalizeQueryString(string|null $qs)
* @method static void enableHttpMethodParameterOverride()
* @method static bool getHttpMethodParameterOverride()
* @method static void setAllowedHttpMethodOverride(string[]|null $methods)
* @method static string[]|null getAllowedHttpMethodOverride()
* @method static bool hasPreviousSession()
* @method static void setSession(\Symfony\Component\HttpFoundation\Session\SessionInterface $session)
* @method static array getClientIps()
* @method static string|null getClientIp()
* @method static string getScriptName()
* @method static string getPathInfo()
* @method static string getBasePath()
* @method static string getBaseUrl()
* @method static string getScheme()
* @method static int|string|null getPort()
* @method static string|null getUser()
* @method static string|null getPassword()
* @method static string|null getUserInfo()
* @method static string getHttpHost()
* @method static string getRequestUri()
* @method static string getSchemeAndHttpHost()
* @method static string getUri()
* @method static string getUriForPath(string $path)
* @method static string getRelativeUriForPath(string $path)
* @method static string|null getQueryString()
* @method static bool isSecure()
* @method static string getHost()
* @method static void setMethod(string $method)
* @method static string getMethod()
* @method static string getRealMethod()
* @method static string|null getMimeType(string $format)
* @method static string[] getMimeTypes(string $format)
* @method static string|null getFormat(string|null $mimeType, bool $subtypeFallback = null)
* @method static void setFormat(string $format, string|string[] $mimeTypes)
* @method static string|null getRequestFormat(string|null $default = 'html')
* @method static void setRequestFormat(string|null $format)
* @method static string|null getContentTypeFormat()
* @method static void setDefaultLocale(string $locale)
* @method static string getDefaultLocale()
* @method static void setLocale(string $locale)
* @method static string getLocale()
* @method static bool isMethod(string $method)
* @method static bool isMethodSafe()
* @method static bool isMethodIdempotent()
* @method static bool isMethodCacheable()
* @method static string|null getProtocolVersion()
* @method static string|resource getContent(bool $asResource = false)
* @method static \Symfony\Component\HttpFoundation\InputBag getPayload()
* @method static array getETags()
* @method static bool isNoCache()
* @method static string|null getPreferredFormat(string|null $default = 'html')
* @method static string|null getPreferredLanguage(string[] $locales = null)
* @method static string[] getLanguages()
* @method static string[] getCharsets()
* @method static string[] getEncodings()
* @method static bool isXmlHttpRequest()
* @method static bool preferSafeContent()
* @method static bool isFromTrustedProxy()
* @method static array filterPrecognitiveRules(array $rules)
* @method static bool isAttemptingPrecognition()
* @method static bool isPrecognitive()
* @method static bool isJson()
* @method static bool expectsJson()
* @method static bool wantsJson()
* @method static bool wantsMarkdown()
* @method static bool accepts(string|array $contentTypes)
* @method static string|null prefers(string|array $contentTypes)
* @method static bool acceptsAnyContentType()
* @method static bool acceptsJson()
* @method static bool acceptsMarkdown()
* @method static bool acceptsHtml()
* @method static bool matchesType(string $actual, string $type)
* @method static string format(string $default = 'html')
* @method static string|array|null old(string|null $key = null, \Illuminate\Database\Eloquent\Model|string|array|null $default = null)
* @method static void flash()
* @method static void flashOnly(mixed $keys)
* @method static void flashExcept(mixed $keys)
* @method static void flush()
* @method static string|array|null server(string|null $key = null, string|array|null $default = null)
* @method static bool hasHeader(string $key)
* @method static string|array|null header(string|null $key = null, string|array|null $default = null)
* @method static string|null bearerToken()
* @method static array keys()
* @method static array all(mixed $keys = null)
* @method static mixed input(string|null $key = null, mixed $default = null)
* @method static \Illuminate\Support\Fluent fluent(array|string|null $key = null, array $default = [])
* @method static string|array|null query(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 bool hasCookie(string $key)
* @method static string|array|null cookie(string|null $key = null, string|array|null $default = null)
* @method static array allFiles()
* @method static bool hasFile(string $key)
* @method static array|\Illuminate\Http\UploadedFile|\Illuminate\Http\UploadedFile[]|null file(string|null $key = null, mixed $default = null)
* @method static \Illuminate\Http\Request dump(mixed $keys = [])
* @method static never dd(mixed ...$args)
* @method static bool exists(string|array $key)
* @method static bool has(string|array $key)
* @method static bool hasAny(string|array $keys)
* @method static \Illuminate\Http\Request|mixed whenHas(string $key, callable $callback, callable|null $default = null)
* @method static bool filled(string|array $key)
* @method static bool isNotFilled(string|array $key)
* @method static bool anyFilled(string|array $keys)
* @method static \Illuminate\Http\Request|mixed whenFilled(string $key, callable $callback, callable|null $default = null)
* @method static bool missing(string|array $key)
* @method static \Illuminate\Http\Request|mixed whenMissing(string $key, callable $callback, callable|null $default = null)
* @method static \Illuminate\Support\Stringable str(string $key, mixed $default = null)
* @method static \Illuminate\Support\Stringable string(string $key, mixed $default = null)
* @method static bool boolean(string|null $key = null, bool $default = false)
* @method static int integer(string $key, int $default = 0)
* @method static float float(string $key, float $default = 0)
* @method static float|int clamp(string $key, int|float $min, int|float $max, int|float $default = 0)
* @method static \Illuminate\Support\Carbon|null date(string $key, string|null $format = null, \UnitEnum|string|null $tz = null)
* @method static \Carbon\CarbonInterval|null interval(string $key, \Carbon\Unit|string|null $unit = null)
* @method static \BackedEnum|\BackedEnum|null enum(string $key, string $enumClass, \BackedEnum|null $default = null)
* @method static \BackedEnum[] enums(string $key, string $enumClass)
* @method static array array(array|string|null $key = null)
* @method static \Illuminate\Support\Collection collect(array|string|null $key = null)
* @method static array only(mixed $keys)
* @method static array except(mixed $keys)
* @method static \Illuminate\Http\Request|mixed when(\Closure|mixed|null $value = null, callable|null $callback = null, callable|null $default = null)
* @method static \Illuminate\Http\Request|mixed unless(\Closure|mixed|null $value = null, callable|null $callback = null, callable|null $default = null)
* @method static void macro(string $name, object|callable $macro)
* @method static void mixin(object $mixin, bool $replace = true)
* @method static bool hasMacro(string $name)
* @method static void flushMacros()
* @method static array validate(array $rules, ...$params)
* @method static array validateWithBag(string $errorBag, array $rules, ...$params)
* @method static bool hasValidSignature(bool $absolute = true)
* @method static bool hasValidRelativeSignature()
* @method static bool hasValidSignatureWhileIgnoring($ignoreQuery = [], $absolute = true)
* @method static bool hasValidRelativeSignatureWhileIgnoring($ignoreQuery = [])
*
* @see \Illuminate\Http\Request
*/
class Request extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'request';
}
}

View File

@@ -1,42 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
use Illuminate\Contracts\Routing\ResponseFactory as ResponseFactoryContract;
/**
* @method static \Illuminate\Http\Response make(mixed $content = '', int $status = 200, array $headers = [])
* @method static \Illuminate\Http\Response noContent(int $status = 204, array $headers = [])
* @method static \Illuminate\Http\Response view(string|array $view, array $data = [], int $status = 200, array $headers = [])
* @method static \Illuminate\Http\JsonResponse json(mixed $data = [], int $status = 200, array $headers = [], int $options = 0)
* @method static \Illuminate\Http\JsonResponse jsonp(string $callback, mixed $data = [], int $status = 200, array $headers = [], int $options = 0)
* @method static \Symfony\Component\HttpFoundation\StreamedResponse eventStream(\Closure $callback, array $headers = [], \Illuminate\Http\StreamedEvent|string|null $endStreamWith = '</stream>')
* @method static \Symfony\Component\HttpFoundation\StreamedResponse stream(callable|null $callback, int $status = 200, array $headers = [])
* @method static \Symfony\Component\HttpFoundation\StreamedJsonResponse streamJson(array $data, int $status = 200, array $headers = [], int $encodingOptions = 15)
* @method static \Symfony\Component\HttpFoundation\StreamedResponse streamDownload(callable $callback, string|null $name = null, array $headers = [], string|null $disposition = 'attachment')
* @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(\SplFileInfo|string $file, array $headers = [])
* @method static \Illuminate\Http\RedirectResponse redirectTo(string $path, int $status = 302, array $headers = [], bool|null $secure = null)
* @method static \Illuminate\Http\RedirectResponse redirectToRoute(\BackedEnum|string $route, mixed $parameters = [], int $status = 302, array $headers = [])
* @method static \Illuminate\Http\RedirectResponse redirectToAction(array|string $action, mixed $parameters = [], int $status = 302, array $headers = [])
* @method static \Illuminate\Http\RedirectResponse redirectGuest(string $path, int $status = 302, array $headers = [], bool|null $secure = null)
* @method static \Illuminate\Http\RedirectResponse redirectToIntended(string $default = '/', int $status = 302, array $headers = [], bool|null $secure = null)
* @method static void macro(string $name, object|callable $macro)
* @method static void mixin(object $mixin, bool $replace = true)
* @method static bool hasMacro(string $name)
* @method static void flushMacros()
*
* @see \Illuminate\Routing\ResponseFactory
*/
class Response extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return ResponseFactoryContract::class;
}
}

View File

@@ -1,119 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
/**
* @method static \Illuminate\Routing\Route get(string $uri, array|string|callable|null $action = null)
* @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 patch(string $uri, array|string|callable|null $action = null)
* @method static \Illuminate\Routing\Route delete(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 any(string $uri, array|string|callable|null $action = null)
* @method static \Illuminate\Routing\Route fallback(array|string|callable|null $action)
* @method static \Illuminate\Routing\Route redirect(string $uri, string $destination, int $status = 302)
* @method static \Illuminate\Routing\Route permanentRedirect(string $uri, string $destination)
* @method static \Illuminate\Routing\Route view(string $uri, string $view, array $data = [], int|array $status = 200, array $headers = [])
* @method static \Illuminate\Routing\Route match(array|string $methods, string $uri, array|string|callable|null $action = null)
* @method static void resources(array $resources, array $options = [])
* @method static void softDeletableResources(array $resources, array $options = [])
* @method static \Illuminate\Routing\PendingResourceRegistration resource(string $name, string $controller, array $options = [])
* @method static void apiResources(array $resources, array $options = [])
* @method static \Illuminate\Routing\PendingResourceRegistration apiResource(string $name, string $controller, array $options = [])
* @method static void singletons(array $singletons, array $options = [])
* @method static \Illuminate\Routing\PendingSingletonResourceRegistration singleton(string $name, string $controller, array $options = [])
* @method static void apiSingletons(array $singletons, array $options = [])
* @method static \Illuminate\Routing\PendingSingletonResourceRegistration apiSingleton(string $name, string $controller, array $options = [])
* @method static \Illuminate\Routing\Router group(array $attributes, \Closure|array|string $routes)
* @method static array mergeWithLastGroup(array $new, bool $prependExistingPrefix = true)
* @method static string getLastGroupPrefix()
* @method static \Illuminate\Routing\Route addRoute(array|string $methods, string $uri, array|string|callable|null $action)
* @method static \Illuminate\Routing\Route newRoute(array|string $methods, string $uri, mixed $action)
* @method static \Symfony\Component\HttpFoundation\Response respondWithRoute(string $name)
* @method static \Symfony\Component\HttpFoundation\Response dispatch(\Illuminate\Http\Request $request)
* @method static \Symfony\Component\HttpFoundation\Response dispatchToRoute(\Illuminate\Http\Request $request)
* @method static array gatherRouteMiddleware(\Illuminate\Routing\Route $route)
* @method static array resolveMiddleware(array $middleware, array $excluded = [])
* @method static \Symfony\Component\HttpFoundation\Response prepareResponse(\Symfony\Component\HttpFoundation\Request $request, mixed $response)
* @method static \Symfony\Component\HttpFoundation\Response toResponse(\Symfony\Component\HttpFoundation\Request $request, mixed $response)
* @method static \Illuminate\Routing\Route substituteBindings(\Illuminate\Routing\Route $route)
* @method static void substituteImplicitBindings(\Illuminate\Routing\Route $route)
* @method static \Illuminate\Routing\Router substituteImplicitBindingsUsing(callable $callback)
* @method static void matched(string|callable $callback)
* @method static array getMiddleware()
* @method static \Illuminate\Routing\Router aliasMiddleware(string $name, string $class)
* @method static bool hasMiddlewareGroup(string $name)
* @method static array getMiddlewareGroups()
* @method static \Illuminate\Routing\Router middlewareGroup(string $name, array $middleware)
* @method static \Illuminate\Routing\Router prependMiddlewareToGroup(string $group, string $middleware)
* @method static \Illuminate\Routing\Router pushMiddlewareToGroup(string $group, string $middleware)
* @method static \Illuminate\Routing\Router removeMiddlewareFromGroup(string $group, string $middleware)
* @method static \Illuminate\Routing\Router flushMiddlewareGroups()
* @method static void bind(string $key, string|callable $binder)
* @method static void model(string $key, string $class, \Closure|null $callback = null)
* @method static \Closure|null getBindingCallback(string $key)
* @method static array getPatterns()
* @method static void pattern(string $key, string $pattern)
* @method static void patterns(array $patterns)
* @method static bool hasGroupStack()
* @method static array getGroupStack()
* @method static mixed input(string $key, string|null $default = null)
* @method static \Illuminate\Http\Request getCurrentRequest()
* @method static \Illuminate\Routing\Route|null getCurrentRoute()
* @method static \Illuminate\Routing\Route|null current()
* @method static bool has(string|array $name)
* @method static string|null currentRouteName()
* @method static bool is(mixed ...$patterns)
* @method static bool currentRouteNamed(mixed ...$patterns)
* @method static string|null currentRouteAction()
* @method static bool uses(array|string ...$patterns)
* @method static bool currentRouteUses(string $action)
* @method static void singularResourceParameters(bool $singular = true)
* @method static void resourceParameters(array $parameters = [])
* @method static array|null resourceVerbs(array $verbs = [])
* @method static \Illuminate\Routing\RouteCollectionInterface getRoutes()
* @method static void setRoutes(\Illuminate\Routing\RouteCollection $routes)
* @method static void setCompiledRoutes(array $routes)
* @method static array uniqueMiddleware(array $middleware)
* @method static \Illuminate\Routing\Router setContainer(\Illuminate\Container\Container $container)
* @method static void macro(string $name, object|callable $macro)
* @method static void mixin(object $mixin, bool $replace = true)
* @method static bool hasMacro(string $name)
* @method static void flushMacros()
* @method static mixed macroCall(string $method, array $parameters)
* @method static \Illuminate\Support\HigherOrderTapProxy|\Illuminate\Routing\Router tap(callable|null $callback = null)
* @method static \Illuminate\Routing\RouteRegistrar attribute(string $key, mixed $value)
* @method static \Illuminate\Routing\RouteRegistrar whereAlpha(array|string $parameters)
* @method static \Illuminate\Routing\RouteRegistrar whereAlphaNumeric(array|string $parameters)
* @method static \Illuminate\Routing\RouteRegistrar whereNumber(array|string $parameters)
* @method static \Illuminate\Routing\RouteRegistrar whereUlid(array|string $parameters)
* @method static \Illuminate\Routing\RouteRegistrar whereUuid(array|string $parameters)
* @method static \Illuminate\Routing\RouteRegistrar whereIn(array|string $parameters, array $values)
* @method static \Illuminate\Routing\RouteRegistrar as(string $value)
* @method static \Illuminate\Routing\RouteRegistrar can(\UnitEnum|string $ability, array|string $models = [])
* @method static \Illuminate\Routing\RouteRegistrar controller(string $controller)
* @method static \Illuminate\Routing\RouteRegistrar domain(\BackedEnum|string $value)
* @method static \Illuminate\Routing\RouteRegistrar middleware(array|string|null $middleware)
* @method static \Illuminate\Routing\RouteRegistrar missing(\Closure $missing)
* @method static \Illuminate\Routing\RouteRegistrar name(\BackedEnum|string $value)
* @method static \Illuminate\Routing\RouteRegistrar namespace(string|null $value)
* @method static \Illuminate\Routing\RouteRegistrar prefix(string $prefix)
* @method static \Illuminate\Routing\RouteRegistrar scopeBindings()
* @method static \Illuminate\Routing\RouteRegistrar where(array $where)
* @method static \Illuminate\Routing\RouteRegistrar withoutMiddleware(array|string $middleware)
* @method static \Illuminate\Routing\RouteRegistrar withoutScopedBindings()
*
* @see \Illuminate\Routing\Router
*/
class Route extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'router';
}
}

View File

@@ -1,100 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
use Illuminate\Console\Scheduling\Schedule as ConsoleSchedule;
/**
* @method static \Illuminate\Console\Scheduling\CallbackEvent call(string|callable $callback, array $parameters = [])
* @method static \Illuminate\Console\Scheduling\Event command(\Symfony\Component\Console\Command\Command|string $command, array $parameters = [])
* @method static \Illuminate\Console\Scheduling\CallbackEvent job(object|string $job, \UnitEnum|string|null $queue = null, \UnitEnum|string|null $connection = null)
* @method static \Illuminate\Console\Scheduling\Event exec(string $command, array $parameters = [])
* @method static void group(\Closure $events)
* @method static string compileArrayInput(string|int $key, array $value)
* @method static bool serverShouldRun(\Illuminate\Console\Scheduling\Event $event, \DateTimeInterface $time)
* @method static \Illuminate\Support\Collection dueEvents(\Illuminate\Contracts\Foundation\Application $app)
* @method static \Illuminate\Console\Scheduling\Event[] events()
* @method static \Illuminate\Console\Scheduling\Schedule useCache(\UnitEnum|string $store)
* @method static void macro(string $name, object|callable $macro)
* @method static void mixin(object $mixin, bool $replace = true)
* @method static bool hasMacro(string $name)
* @method static void flushMacros()
* @method static mixed macroCall(string $method, array $parameters)
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes withoutOverlapping(int $expiresAt = 1440)
* @method static void mergeAttributes(\Illuminate\Console\Scheduling\Event $event)
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes user(string $user)
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes environments(mixed $environments)
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes evenInMaintenanceMode()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes onOneServer()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes runInBackground()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes when(\Closure|bool $callback)
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes skip(\Closure|bool $callback)
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes name(string $description)
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes description(string $description)
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes cron(string $expression)
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes between(string $startTime, string $endTime)
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes unlessBetween(string $startTime, string $endTime)
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes everySecond()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes everyTwoSeconds()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes everyFiveSeconds()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes everyTenSeconds()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes everyFifteenSeconds()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes everyTwentySeconds()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes everyThirtySeconds()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes everyMinute()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes everyTwoMinutes()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes everyThreeMinutes()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes everyFourMinutes()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes everyFiveMinutes()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes everyTenMinutes()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes everyFifteenMinutes()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes everyThirtyMinutes()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes hourly()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes hourlyAt(array|string|int|int[] $offset)
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes everyOddHour(array|string|int $offset = 0)
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes everyTwoHours(array|string|int $offset = 0)
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes everyThreeHours(array|string|int $offset = 0)
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes everyFourHours(array|string|int $offset = 0)
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes everySixHours(array|string|int $offset = 0)
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes daily()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes at(string $time)
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes dailyAt(string $time)
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes twiceDaily(int $first = 1, int $second = 13)
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes twiceDailyAt(int $first = 1, int $second = 13, int $offset = 0)
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes weekdays()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes weekends()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes mondays()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes tuesdays()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes wednesdays()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes thursdays()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes fridays()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes saturdays()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes sundays()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes weekly()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes weeklyOn(mixed $dayOfWeek, string $time = '0:0')
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes monthly()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes monthlyOn(int $dayOfMonth = 1, string $time = '0:0')
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes twiceMonthly(int $first = 1, int $second = 16, string $time = '0:0')
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes lastDayOfMonth(string $time = '0:0')
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes daysOfMonth(array|int ...$days)
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes quarterly()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes quarterlyOn(int $dayOfQuarter = 1, string $time = '0:0')
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes yearly()
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes yearlyOn(int $month = 1, int|string $dayOfMonth = 1, string $time = '0:0')
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes days(mixed $days)
* @method static \Illuminate\Console\Scheduling\PendingEventAttributes timezone(\UnitEnum|\DateTimeZone|string $timezone)
*
* @see \Illuminate\Console\Scheduling\Schedule
*/
class Schedule extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return ConsoleSchedule::class;
}
}

View File

@@ -1,88 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
/**
* @method static void defaultStringLength(int $length)
* @method static void defaultTimePrecision(int|null $precision)
* @method static void defaultMorphKeyType(string $type)
* @method static void morphUsingUuids()
* @method static void morphUsingUlids()
* @method static bool createDatabase(string $name)
* @method static bool dropDatabaseIfExists(string $name)
* @method static array getSchemas()
* @method static bool hasTable(string $table)
* @method static bool hasView(string $view)
* @method static array getTables(string|string[]|null $schema = null)
* @method static array getTableListing(string|string[]|null $schema = null, bool $schemaQualified = true)
* @method static array getViews(string|string[]|null $schema = null)
* @method static array getTypes(string|string[]|null $schema = null)
* @method static bool hasColumn(string $table, string $column)
* @method static bool hasColumns(string $table, array $columns)
* @method static void whenTableHasColumn(string $table, string $column, \Closure $callback)
* @method static void whenTableDoesntHaveColumn(string $table, string $column, \Closure $callback)
* @method static void whenTableHasIndex(string $table, string|array $index, \Closure $callback, string|null $type = null)
* @method static void whenTableDoesntHaveIndex(string $table, string|array $index, \Closure $callback, string|null $type = null)
* @method static string getColumnType(string $table, string $column, bool $fullDefinition = false)
* @method static array getColumnListing(string $table)
* @method static array getColumns(string $table)
* @method static array getIndexes(string $table)
* @method static array getIndexListing(string $table)
* @method static bool hasIndex(string $table, string|array $index, string|null $type = null)
* @method static array getForeignKeys(string $table)
* @method static void table(string $table, \Closure $callback)
* @method static void create(string $table, \Closure $callback)
* @method static void drop(string $table)
* @method static void dropIfExists(string $table)
* @method static void dropColumns(string $table, string|array $columns)
* @method static void dropAllTables()
* @method static void dropAllViews()
* @method static void dropAllTypes()
* @method static void rename(string $from, string $to)
* @method static bool enableForeignKeyConstraints()
* @method static bool disableForeignKeyConstraints()
* @method static mixed withoutForeignKeyConstraints(\Closure $callback)
* @method static void ensureVectorExtensionExists(string|null $schema = null)
* @method static void ensureExtensionExists(string $name, string|null $schema = null)
* @method static string[]|null getCurrentSchemaListing()
* @method static string|null getCurrentSchemaName()
* @method static array parseSchemaAndTable(string $reference, string|bool|null $withDefaultSchema = null)
* @method static \Illuminate\Database\Connection getConnection()
* @method static void blueprintResolver(\Closure $resolver)
* @method static void macro(string $name, object|callable $macro)
* @method static void mixin(object $mixin, bool $replace = true)
* @method static bool hasMacro(string $name)
* @method static void flushMacros()
*
* @see \Illuminate\Database\Schema\Builder
*/
class Schema extends Facade
{
/**
* Indicates if the resolved facade should be cached.
*
* @var bool
*/
protected static $cached = false;
/**
* 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 the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'db.schema';
}
}

View File

@@ -1,90 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
/**
* @method static bool shouldBlock()
* @method static string|null blockDriver()
* @method static int defaultRouteBlockLockSeconds()
* @method static int defaultRouteBlockWaitSeconds()
* @method static array getSessionConfig()
* @method static string|null getDefaultDriver()
* @method static void setDefaultDriver(string $name)
* @method static mixed driver(string|null $driver = null)
* @method static \Illuminate\Session\SessionManager extend(string $driver, \Closure $callback)
* @method static array getDrivers()
* @method static \Illuminate\Contracts\Container\Container getContainer()
* @method static \Illuminate\Session\SessionManager setContainer(\Illuminate\Contracts\Container\Container $container)
* @method static \Illuminate\Session\SessionManager forgetDrivers()
* @method static bool start()
* @method static void save()
* @method static void ageFlashData()
* @method static array all()
* @method static array only(array $keys)
* @method static array except(array $keys)
* @method static bool exists(\UnitEnum|string|array $key)
* @method static bool missing(\UnitEnum|string|array $key)
* @method static bool has(\UnitEnum|string|array $key)
* @method static bool hasAny(\UnitEnum|string|array $key)
* @method static mixed get(\UnitEnum|string $key, mixed $default = null)
* @method static mixed pull(\UnitEnum|string $key, mixed $default = null)
* @method static bool hasOldInput(string|null $key = null)
* @method static mixed getOldInput(string|null $key = null, mixed $default = null)
* @method static void replace(array $attributes)
* @method static void put(\UnitEnum|string|array $key, mixed $value = null)
* @method static mixed remember(\UnitEnum|string $key, \Closure $callback)
* @method static void push(\UnitEnum|string $key, mixed $value)
* @method static mixed increment(\UnitEnum|string $key, int $amount = 1)
* @method static int decrement(\UnitEnum|string $key, int $amount = 1)
* @method static void flash(\UnitEnum|string $key, mixed $value = true)
* @method static void now(\UnitEnum|string $key, mixed $value)
* @method static void reflash()
* @method static void keep(mixed $keys = null)
* @method static void flashInput(array $value)
* @method static \Illuminate\Contracts\Cache\Repository cache()
* @method static mixed remove(\UnitEnum|string $key)
* @method static void forget(\UnitEnum|string|array $keys)
* @method static void flush()
* @method static bool invalidate()
* @method static bool regenerate(bool $destroy = false)
* @method static bool migrate(bool $destroy = false)
* @method static bool isStarted()
* @method static string getName()
* @method static void setName(string $name)
* @method static string id()
* @method static string getId()
* @method static void setId(string|null $id)
* @method static bool isValidId(string|null $id)
* @method static void setExists(bool $value)
* @method static string token()
* @method static void regenerateToken()
* @method static bool hasPreviousUri()
* @method static \Illuminate\Support\Uri previousUri()
* @method static string|null previousUrl()
* @method static void setPreviousUrl(string $url)
* @method static string|null previousRoute()
* @method static void setPreviousRoute(string|null $route)
* @method static void passwordConfirmed()
* @method static \SessionHandlerInterface getHandler()
* @method static \SessionHandlerInterface setHandler(\SessionHandlerInterface $handler)
* @method static bool handlerNeedsRequest()
* @method static void setRequestOnHandler(\Illuminate\Http\Request $request)
* @method static void macro(string $name, object|callable $macro)
* @method static void mixin(object $mixin, bool $replace = true)
* @method static bool hasMacro(string $name)
* @method static void flushMacros()
*
* @see \Illuminate\Session\SessionManager
*/
class Session extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'session';
}
}

View File

@@ -1,183 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
use Illuminate\Filesystem\Filesystem;
use function Illuminate\Support\enum_value;
/**
* @method static \Illuminate\Contracts\Filesystem\Filesystem drive(string|null $name = null)
* @method static \Illuminate\Contracts\Filesystem\Filesystem disk(\UnitEnum|string|null $name = null)
* @method static \Illuminate\Contracts\Filesystem\Cloud cloud()
* @method static \Illuminate\Contracts\Filesystem\Filesystem build(string|array $config)
* @method static \Illuminate\Contracts\Filesystem\Filesystem createLocalDriver(array $config, string $name = 'local')
* @method static \Illuminate\Contracts\Filesystem\Filesystem createFtpDriver(array $config)
* @method static \Illuminate\Contracts\Filesystem\Filesystem createSftpDriver(array $config)
* @method static \Illuminate\Contracts\Filesystem\Cloud createS3Driver(array $config)
* @method static \Illuminate\Contracts\Filesystem\Filesystem createScopedDriver(array $config)
* @method static \Illuminate\Filesystem\FilesystemManager set(string $name, mixed $disk)
* @method static string getDefaultDriver()
* @method static string getDefaultCloudDriver()
* @method static \Illuminate\Filesystem\FilesystemManager forgetDisk(array|string $disk)
* @method static void purge(string|null $name = null)
* @method static \Illuminate\Filesystem\FilesystemManager extend(string $driver, \Closure $callback)
* @method static \Illuminate\Filesystem\FilesystemManager setApplication(\Illuminate\Contracts\Foundation\Application $app)
* @method static string path(string $path)
* @method static bool exists(string $path)
* @method static string|null get(string $path)
* @method static resource|null readStream(string $path)
* @method static bool put(string $path, \Psr\Http\Message\StreamInterface|\Illuminate\Http\File|\Illuminate\Http\UploadedFile|string|resource $contents, mixed $options = [])
* @method static string|false putFile(\Illuminate\Http\File|\Illuminate\Http\UploadedFile|string $path, \Illuminate\Http\File|\Illuminate\Http\UploadedFile|string|array|null $file = null, mixed $options = [])
* @method static string|false putFileAs(\Illuminate\Http\File|\Illuminate\Http\UploadedFile|string $path, \Illuminate\Http\File|\Illuminate\Http\UploadedFile|string|array|null $file, string|array|null $name = null, mixed $options = [])
* @method static bool writeStream(string $path, resource $resource, array $options = [])
* @method static string getVisibility(string $path)
* @method static bool setVisibility(string $path, string $visibility)
* @method static bool prepend(string $path, string $data)
* @method static bool append(string $path, string $data)
* @method static bool delete(string|array $paths)
* @method static bool copy(string $from, string $to)
* @method static bool move(string $from, string $to)
* @method static int size(string $path)
* @method static int lastModified(string $path)
* @method static array files(string|null $directory = null, bool $recursive = false)
* @method static array allFiles(string|null $directory = null)
* @method static array directories(string|null $directory = null, bool $recursive = false)
* @method static array allDirectories(string|null $directory = null)
* @method static bool makeDirectory(string $path)
* @method static bool deleteDirectory(string $directory)
* @method static \Illuminate\Filesystem\FilesystemAdapter assertExists(string|array $path, string|null $content = null)
* @method static \Illuminate\Filesystem\FilesystemAdapter assertCount(string $path, int $count, bool $recursive = false)
* @method static \Illuminate\Filesystem\FilesystemAdapter assertMissing(string|array $path)
* @method static \Illuminate\Filesystem\FilesystemAdapter assertDirectoryEmpty(string $path)
* @method static bool missing(string $path)
* @method static bool fileExists(string $path)
* @method static bool fileMissing(string $path)
* @method static bool directoryExists(string $path)
* @method static bool directoryMissing(string $path)
* @method static array|null json(string $path, int $flags = 0)
* @method static \Symfony\Component\HttpFoundation\StreamedResponse response(string $path, string|null $name = null, array $headers = [], string|null $disposition = 'inline')
* @method static \Symfony\Component\HttpFoundation\StreamedResponse serve(\Illuminate\Http\Request $request, string $path, string|null $name = null, array $headers = [])
* @method static \Symfony\Component\HttpFoundation\StreamedResponse download(string $path, string|null $name = null, array $headers = [])
* @method static string|false checksum(string $path, array $options = [])
* @method static string|false mimeType(string $path)
* @method static string url(string $path)
* @method static bool providesTemporaryUrls()
* @method static bool providesTemporaryUploadUrls()
* @method static string temporaryUrl(string $path, \DateTimeInterface $expiration, array $options = [])
* @method static array temporaryUploadUrl(string $path, \DateTimeInterface $expiration, array $options = [])
* @method static \League\Flysystem\FilesystemOperator getDriver()
* @method static \League\Flysystem\FilesystemAdapter getAdapter()
* @method static array getConfig()
* @method static void serveUsing(\Closure $callback)
* @method static void buildTemporaryUrlsUsing(\Closure $callback)
* @method static void buildTemporaryUploadUrlsUsing(\Closure $callback)
* @method static \Illuminate\Filesystem\FilesystemAdapter|mixed when(\Closure|mixed|null $value = null, callable|null $callback = null, callable|null $default = null)
* @method static \Illuminate\Filesystem\FilesystemAdapter|mixed unless(\Closure|mixed|null $value = null, callable|null $callback = null, callable|null $default = null)
* @method static void macro(string $name, object|callable $macro)
* @method static void mixin(object $mixin, bool $replace = true)
* @method static bool hasMacro(string $name)
* @method static void flushMacros()
* @method static mixed macroCall(string $method, array $parameters)
* @method static bool has(string $location)
* @method static string read(string $location)
* @method static \League\Flysystem\DirectoryListing listContents(string $location, bool $deep = false)
* @method static int fileSize(string $path)
* @method static string visibility(string $path)
* @method static void write(string $location, string $contents, array $config = [])
* @method static void createDirectory(string $location, array $config = [])
*
* @see \Illuminate\Filesystem\FilesystemManager
*/
class Storage extends Facade
{
/**
* Replace the given disk with a local testing disk.
*
* @param \UnitEnum|string|null $disk
* @param array $config
* @return \Illuminate\Filesystem\LocalFilesystemAdapter
*/
public static function fake($disk = null, array $config = [])
{
$root = self::getRootPath($disk = enum_value($disk) ?: static::$app['config']->get('filesystems.default'));
if ($token = ParallelTesting::token()) {
$root = "{$root}_test_{$token}";
}
(new Filesystem)->cleanDirectory($root);
static::set($disk, $fake = static::createLocalDriver(
self::buildDiskConfiguration($disk, $config, root: $root)
));
return tap($fake, function ($fake) {
$fake->buildTemporaryUrlsUsing(function ($path, $expiration) {
return URL::to($path.'?expiration='.$expiration->getTimestamp());
});
$fake->buildTemporaryUploadUrlsUsing(function ($path, $expiration) {
return ['url' => URL::to($path.'?expiration='.$expiration->getTimestamp()), 'headers' => []];
});
});
}
/**
* Replace the given disk with a persistent local testing disk.
*
* @param \UnitEnum|string|null $disk
* @param array $config
* @return \Illuminate\Filesystem\LocalFilesystemAdapter
*/
public static function persistentFake($disk = null, array $config = [])
{
$disk = enum_value($disk) ?: static::$app['config']->get('filesystems.default');
static::set($disk, $fake = static::createLocalDriver(
self::buildDiskConfiguration($disk, $config, root: self::getRootPath($disk))
));
return $fake;
}
/**
* Get the root path of the given disk.
*
* @param string $disk
* @return string
*/
protected static function getRootPath(string $disk): string
{
return storage_path('framework/testing/disks/'.$disk);
}
/**
* Assemble the configuration of the given disk.
*
* @param string $disk
* @param array $config
* @param string $root
* @return array
*/
protected static function buildDiskConfiguration(string $disk, array $config, string $root): array
{
$originalConfig = static::$app['config']["filesystems.disks.{$disk}"] ?? [];
return array_merge([
'throw' => $originalConfig['throw'] ?? false],
$config,
['root' => $root]
);
}
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'filesystem';
}
}

View File

@@ -1,66 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
/**
* @method static string full()
* @method static string current()
* @method static string previous(mixed $fallback = false)
* @method static string previousPath(mixed $fallback = false)
* @method static string to(string $path, mixed $extra = [], bool|null $secure = null)
* @method static string query(string $path, array $query = [], mixed $extra = [], bool|null $secure = null)
* @method static string secure(string $path, array $parameters = [])
* @method static string asset(string $path, bool|null $secure = null)
* @method static string secureAsset(string $path)
* @method static string assetFrom(string $root, string $path, bool|null $secure = null)
* @method static string formatScheme(bool|null $secure = null)
* @method static string signedRoute(\BackedEnum|string $name, mixed $parameters = [], \DateTimeInterface|\DateInterval|int|null $expiration = null, bool $absolute = true)
* @method static string temporarySignedRoute(\BackedEnum|string $name, \DateTimeInterface|\DateInterval|int $expiration, array $parameters = [], bool $absolute = true)
* @method static bool hasValidSignature(\Illuminate\Http\Request $request, bool $absolute = true, \Closure|array $ignoreQuery = [])
* @method static bool hasValidRelativeSignature(\Illuminate\Http\Request $request, \Closure|array $ignoreQuery = [])
* @method static bool hasCorrectSignature(\Illuminate\Http\Request $request, bool $absolute = true, \Closure|array $ignoreQuery = [])
* @method static bool signatureHasNotExpired(\Illuminate\Http\Request $request)
* @method static string route(\BackedEnum|string $name, mixed $parameters = [], bool $absolute = true)
* @method static string toRoute(\Illuminate\Routing\Route $route, mixed $parameters, bool $absolute)
* @method static string action(string|array $action, mixed $parameters = [], bool $absolute = true)
* @method static array formatParameters(mixed $parameters)
* @method static string formatRoot(string $scheme, string|null $root = null)
* @method static string format(string $root, string $path, \Illuminate\Routing\Route|null $route = null)
* @method static bool isValidUrl(string $path)
* @method static void defaults(array $defaults)
* @method static array getDefaultParameters()
* @method static void forceScheme(string|null $scheme)
* @method static void forceHttps(bool $force = true)
* @method static void useOrigin(string|null $root)
* @method static void useAssetOrigin(string|null $root)
* @method static \Illuminate\Routing\UrlGenerator formatHostUsing(\Closure $callback)
* @method static \Illuminate\Routing\UrlGenerator formatPathUsing(\Closure $callback)
* @method static \Closure pathFormatter()
* @method static \Illuminate\Http\Request getRequest()
* @method static void setRequest(\Illuminate\Http\Request $request)
* @method static \Illuminate\Routing\UrlGenerator setRoutes(\Illuminate\Routing\RouteCollectionInterface $routes)
* @method static \Illuminate\Routing\UrlGenerator setSessionResolver(callable $sessionResolver)
* @method static \Illuminate\Routing\UrlGenerator setKeyResolver(callable $keyResolver)
* @method static \Illuminate\Routing\UrlGenerator withKeyResolver(callable $keyResolver)
* @method static \Illuminate\Routing\UrlGenerator resolveMissingNamedRoutesUsing(callable $missingNamedRouteResolver)
* @method static string getRootControllerNamespace()
* @method static \Illuminate\Routing\UrlGenerator setRootControllerNamespace(string $rootNamespace)
* @method static void macro(string $name, object|callable $macro)
* @method static void mixin(object $mixin, bool $replace = true)
* @method static bool hasMacro(string $name)
* @method static void flushMacros()
*
* @see \Illuminate\Routing\UrlGenerator
*/
class URL extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'url';
}
}

View File

@@ -1,34 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
/**
* @method static \Illuminate\Validation\Validator make(array $data, array $rules, array $messages = [], array $attributes = [])
* @method static array validate(array $data, array $rules, array $messages = [], array $attributes = [])
* @method static void extend(string $rule, \Closure|string $extension, string|null $message = null)
* @method static void extendImplicit(string $rule, \Closure|string $extension, string|null $message = null)
* @method static void extendDependent(string $rule, \Closure|string $extension, string|null $message = null)
* @method static void replacer(string $rule, \Closure|string $replacer)
* @method static void includeUnvalidatedArrayKeys()
* @method static void excludeUnvalidatedArrayKeys()
* @method static void resolver(\Closure $resolver)
* @method static \Illuminate\Contracts\Translation\Translator getTranslator()
* @method static \Illuminate\Validation\PresenceVerifierInterface getPresenceVerifier()
* @method static void setPresenceVerifier(\Illuminate\Validation\PresenceVerifierInterface $presenceVerifier)
* @method static \Illuminate\Contracts\Container\Container|null getContainer()
* @method static \Illuminate\Validation\Factory setContainer(\Illuminate\Contracts\Container\Container $container)
*
* @see \Illuminate\Validation\Factory
*/
class Validator extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'validator';
}
}

View File

@@ -1,99 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
/**
* @method static \Illuminate\Contracts\View\View file(string $path, \Illuminate\Contracts\Support\Arrayable|array $data = [], array $mergeData = [])
* @method static \Illuminate\Contracts\View\View make(string $view, \Illuminate\Contracts\Support\Arrayable|array $data = [], array $mergeData = [])
* @method static \Illuminate\Contracts\View\View first(array $views, \Illuminate\Contracts\Support\Arrayable|array $data = [], array $mergeData = [])
* @method static string renderWhen(bool $condition, string $view, \Illuminate\Contracts\Support\Arrayable|array $data = [], array $mergeData = [])
* @method static string renderUnless(bool $condition, string $view, \Illuminate\Contracts\Support\Arrayable|array $data = [], array $mergeData = [])
* @method static string renderEach(string $view, array $data, string $iterator, string $empty = 'raw|')
* @method static bool exists(string $view)
* @method static \Illuminate\Contracts\View\Engine getEngineFromPath(string $path)
* @method static mixed share(array|string $key, mixed $value = null)
* @method static void incrementRender()
* @method static void decrementRender()
* @method static bool doneRendering()
* @method static bool hasRenderedOnce(string $id)
* @method static void markAsRenderedOnce(string $id)
* @method static void addLocation(string $location)
* @method static void prependLocation(string $location)
* @method static \Illuminate\View\Factory addNamespace(string $namespace, string|array $hints)
* @method static \Illuminate\View\Factory prependNamespace(string $namespace, string|array $hints)
* @method static \Illuminate\View\Factory replaceNamespace(string $namespace, string|array $hints)
* @method static void addExtension(string $extension, string $engine, \Closure|null $resolver = null)
* @method static void flushState()
* @method static void flushStateIfDoneRendering()
* @method static array getExtensions()
* @method static \Illuminate\View\Engines\EngineResolver getEngineResolver()
* @method static \Illuminate\View\ViewFinderInterface getFinder()
* @method static void setFinder(\Illuminate\View\ViewFinderInterface $finder)
* @method static void flushFinderCache()
* @method static \Illuminate\Contracts\Events\Dispatcher getDispatcher()
* @method static void setDispatcher(\Illuminate\Contracts\Events\Dispatcher $events)
* @method static \Illuminate\Contracts\Container\Container getContainer()
* @method static void setContainer(\Illuminate\Contracts\Container\Container $container)
* @method static mixed shared(string $key, mixed $default = null)
* @method static array getShared()
* @method static void macro(string $name, object|callable $macro)
* @method static void mixin(object $mixin, bool $replace = true)
* @method static bool hasMacro(string $name)
* @method static void flushMacros()
* @method static void startComponent(\Illuminate\Contracts\View\View|\Illuminate\Contracts\Support\Htmlable|\Closure|string $view, array $data = [])
* @method static void startComponentFirst(array $names, array $data = [])
* @method static string renderComponent()
* @method static mixed getConsumableComponentData(string $key, mixed $default = null)
* @method static void slot(string $name, string|null $content = null, array $attributes = [])
* @method static void endSlot()
* @method static array creator(array|string $views, \Closure|string $callback)
* @method static array composers(array $composers)
* @method static array composer(array|string $views, \Closure|string $callback)
* @method static void callComposer(\Illuminate\Contracts\View\View $view)
* @method static void callCreator(\Illuminate\Contracts\View\View $view)
* @method static void startFragment(string $fragment)
* @method static string stopFragment()
* @method static mixed getFragment(string $name, string|null $default = null)
* @method static array getFragments()
* @method static void flushFragments()
* @method static void startSection(string $section, string|null $content = null)
* @method static void inject(string $section, string $content)
* @method static string yieldSection()
* @method static string stopSection(bool $overwrite = false)
* @method static string appendSection()
* @method static string yieldContent(string $section, string $default = '')
* @method static string parentPlaceholder(string $section = '')
* @method static bool hasSection(string $name)
* @method static bool sectionMissing(string $name)
* @method static mixed getSection(string $name, string|null $default = null)
* @method static array getSections()
* @method static void flushSections()
* @method static void addLoop(\Countable|array $data)
* @method static void incrementLoopIndices()
* @method static void popLoop()
* @method static \stdClass|null getLastLoop()
* @method static array getLoopStack()
* @method static void startPush(string $section, string $content = '')
* @method static string stopPush()
* @method static void startPrepend(string $section, string $content = '')
* @method static string stopPrepend()
* @method static string yieldPushContent(string $section, string $default = '')
* @method static bool isStackEmpty(string $section)
* @method static void flushStacks()
* @method static void startTranslation(array $replacements = [])
* @method static string renderTranslation()
*
* @see \Illuminate\View\Factory
*/
class View extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'view';
}
}

View File

@@ -1,49 +0,0 @@
<?php
namespace Illuminate\Support\Facades;
/**
* @method static array preloadedAssets()
* @method static string|null cspNonce()
* @method static string useCspNonce(string|null $nonce = null)
* @method static \Illuminate\Foundation\Vite useIntegrityKey(string|false $key)
* @method static \Illuminate\Foundation\Vite withEntryPoints(array $entryPoints)
* @method static \Illuminate\Foundation\Vite mergeEntryPoints(array $entryPoints)
* @method static \Illuminate\Foundation\Vite useManifestFilename(string $filename)
* @method static \Illuminate\Foundation\Vite createAssetPathsUsing(callable|null $resolver)
* @method static string hotFile()
* @method static \Illuminate\Foundation\Vite useHotFile(string $path)
* @method static \Illuminate\Foundation\Vite useBuildDirectory(string $path)
* @method static \Illuminate\Foundation\Vite useScriptTagAttributes(callable|array $attributes)
* @method static \Illuminate\Foundation\Vite useStyleTagAttributes(callable|array $attributes)
* @method static \Illuminate\Foundation\Vite usePreloadTagAttributes(callable|array|false $attributes)
* @method static \Illuminate\Foundation\Vite prefetch(int|null $concurrency = null, string $event = 'load')
* @method static \Illuminate\Foundation\Vite useWaterfallPrefetching(int|null $concurrency = null)
* @method static \Illuminate\Foundation\Vite useAggressivePrefetching()
* @method static \Illuminate\Foundation\Vite usePrefetchStrategy(string|null $strategy, array $config = [])
* @method static \Illuminate\Support\HtmlString|void reactRefresh()
* @method static string asset(string $asset, string|null $buildDirectory = null)
* @method static string content(string $asset, string|null $buildDirectory = null)
* @method static string|null manifestHash(string|null $buildDirectory = null)
* @method static bool isRunningHot()
* @method static string toHtml()
* @method static void flush()
* @method static void macro(string $name, object|callable $macro)
* @method static void mixin(object $mixin, bool $replace = true)
* @method static bool hasMacro(string $name)
* @method static void flushMacros()
*
* @see \Illuminate\Foundation\Vite
*/
class Vite extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return \Illuminate\Foundation\Vite::class;
}
}

View File

@@ -1,354 +0,0 @@
<?php
namespace Illuminate\Support;
use ArrayAccess;
use ArrayIterator;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Contracts\Support\Jsonable;
use Illuminate\Support\Traits\Conditionable;
use Illuminate\Support\Traits\InteractsWithData;
use Illuminate\Support\Traits\Macroable;
use IteratorAggregate;
use JsonSerializable;
use Traversable;
/**
* @template TKey of array-key
* @template TValue
*
* @implements \Illuminate\Contracts\Support\Arrayable<TKey, TValue>
* @implements \ArrayAccess<TKey, TValue>
*/
class Fluent implements Arrayable, ArrayAccess, IteratorAggregate, Jsonable, JsonSerializable
{
use Conditionable, InteractsWithData, Macroable {
__call as macroCall;
}
/**
* All of the attributes set on the fluent instance.
*
* @var array<TKey, TValue>
*/
protected $attributes = [];
/**
* Create a new fluent instance.
*
* @param iterable<TKey, TValue> $attributes
*/
public function __construct($attributes = [])
{
$this->fill($attributes);
}
/**
* Create a new fluent instance.
*
* @param iterable<TKey, TValue> $attributes
* @return static
*/
public static function make($attributes = [])
{
return new static($attributes);
}
/**
* Get an attribute from the fluent instance using "dot" notation.
*
* @template TGetDefault
*
* @param TKey $key
* @param TGetDefault|(\Closure(): TGetDefault) $default
* @return TValue|TGetDefault
*/
public function get($key, $default = null)
{
return data_get($this->attributes, $key, $default);
}
/**
* Set an attribute on the fluent instance using "dot" notation.
*
* @param TKey $key
* @param TValue $value
* @return $this
*/
public function set($key, $value)
{
data_set($this->attributes, $key, $value);
return $this;
}
/**
* Fill the fluent instance with an array of attributes.
*
* @param iterable<TKey, TValue> $attributes
* @return $this
*/
public function fill($attributes)
{
foreach ($attributes as $key => $value) {
$this->attributes[$key] = $value;
}
return $this;
}
/**
* Get an attribute from the fluent instance.
*
* @param string $key
* @param mixed $default
* @return mixed
*/
public function value($key, $default = null)
{
if (array_key_exists($key, $this->attributes)) {
return $this->attributes[$key];
}
return value($default);
}
/**
* Get the value of the given key as a new Fluent instance.
*
* @param string $key
* @param mixed $default
* @return static
*/
public function scope($key, $default = null)
{
return new static(
(array) $this->get($key, $default)
);
}
/**
* Get all of the attributes from the fluent instance.
*
* @param mixed $keys
* @return array
*/
public function all($keys = null)
{
$data = $this->data();
if (! $keys) {
return $data;
}
$results = [];
foreach (is_array($keys) ? $keys : func_get_args() as $key) {
Arr::set($results, $key, Arr::get($data, $key));
}
return $results;
}
/**
* Get data from the fluent instance.
*
* @param string|null $key
* @param mixed $default
* @return mixed
*/
protected function data($key = null, $default = null)
{
return $this->get($key, $default);
}
/**
* Get the attributes from the fluent instance.
*
* @return array<TKey, TValue>
*/
public function getAttributes()
{
return $this->attributes;
}
/**
* Convert the fluent instance to an array.
*
* @return array<TKey, TValue>
*/
public function toArray()
{
return $this->attributes;
}
/**
* Convert the object into something JSON serializable.
*
* @return array<TKey, TValue>
*/
public function jsonSerialize(): array
{
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);
}
/**
* Convert the fluent instance to pretty print formatted JSON.
*
* @param int $options
* @return string
*/
public function toPrettyJson(int $options = 0)
{
return $this->toJson(JSON_PRETTY_PRINT | $options);
}
/**
* Determine if the fluent instance is empty.
*
* @return bool
*/
public function isEmpty(): bool
{
return empty($this->attributes);
}
/**
* Determine if the fluent instance is not empty.
*
* @return bool
*/
public function isNotEmpty(): bool
{
return ! $this->isEmpty();
}
/**
* Determine if the given offset exists.
*
* @param TKey $offset
* @return bool
*/
public function offsetExists($offset): bool
{
return isset($this->attributes[$offset]);
}
/**
* Get the value for a given offset.
*
* @param TKey $offset
* @return TValue|null
*/
public function offsetGet($offset): mixed
{
return $this->value($offset);
}
/**
* Set the value at the given offset.
*
* @param TKey $offset
* @param TValue $value
* @return void
*/
public function offsetSet($offset, $value): void
{
$this->attributes[$offset] = $value;
}
/**
* Unset the value at the given offset.
*
* @param TKey $offset
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->attributes[$offset]);
}
/**
* Get an iterator for the attributes.
*
* @return ArrayIterator<TKey, TValue>
*/
public function getIterator(): Traversable
{
return new ArrayIterator($this->attributes);
}
/**
* Handle dynamic calls to the fluent instance to set attributes.
*
* @param TKey $method
* @param array{0: ?TValue} $parameters
* @return $this
*/
public function __call($method, $parameters)
{
if (static::hasMacro($method)) {
return $this->macroCall($method, $parameters);
}
$this->attributes[$method] = count($parameters) > 0 ? array_first($parameters) : true;
return $this;
}
/**
* Dynamically retrieve the value of an attribute.
*
* @param TKey $key
* @return TValue|null
*/
public function __get($key)
{
return $this->value($key);
}
/**
* Dynamically set the value of an attribute.
*
* @param TKey $key
* @param TValue $value
* @return void
*/
public function __set($key, $value)
{
$this->offsetSet($key, $value);
}
/**
* Dynamically check if an attribute is set.
*
* @param TKey $key
* @return bool
*/
public function __isset($key)
{
return $this->offsetExists($key);
}
/**
* Dynamically unset an attribute.
*
* @param TKey $key
* @return void
*/
public function __unset($key)
{
$this->offsetUnset($key);
}
}

View File

@@ -1,37 +0,0 @@
<?php
namespace Illuminate\Support;
class HigherOrderTapProxy
{
/**
* The target being tapped.
*
* @var mixed
*/
public $target;
/**
* Create a new tap proxy instance.
*
* @param mixed $target
*/
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;
}
}

View File

@@ -1,66 +0,0 @@
<?php
namespace Illuminate\Support;
use Illuminate\Contracts\Support\Htmlable;
use Stringable;
class HtmlString implements Htmlable, Stringable
{
/**
* The HTML string.
*
* @var string
*/
protected $html;
/**
* Create a new HTML string instance.
*
* @param string $html
*/
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 ?? '') === '';
}
/**
* Determine if the given HTML string is not empty.
*
* @return bool
*/
public function isNotEmpty()
{
return ! $this->isEmpty();
}
/**
* Get the HTML string.
*
* @return string
*/
public function __toString()
{
return $this->toHtml() ?? '';
}
}

View File

@@ -1,83 +0,0 @@
<?php
namespace Illuminate\Support;
use Carbon\CarbonInterval;
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()->addSeconds($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();
}
/**
* Given a start time, format the total run time for human readability.
*
* @param float $startTime
* @param float|null $endTime
* @return string
*/
protected function runTimeForHumans($startTime, $endTime = null)
{
$endTime ??= microtime(true);
$runTime = ($endTime - $startTime) * 1000;
return $runTime > 1000
? CarbonInterval::milliseconds($runTime)->cascade()->forHumans(short: true)
: number_format($runTime, 2).'ms';
}
}

View File

@@ -1,159 +0,0 @@
<?php
namespace Illuminate\Support;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Contracts\Support\Jsonable;
use JsonSerializable;
use Stringable;
use UnitEnum;
class Js implements Htmlable, Stringable
{
/**
* The JavaScript string.
*
* @var string
*/
protected $js;
/**
* Flags that should be used when encoding to JSON.
*
* @var int
*/
protected const REQUIRED_FLAGS = JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_THROW_ON_ERROR;
/**
* Create a new class instance.
*
* @param mixed $data
* @param int|null $flags
* @param int $depth
*
* @throws \JsonException
*/
public function __construct($data, $flags = 0, $depth = 512)
{
$this->js = $this->convertDataToJavaScriptExpression($data, $flags, $depth);
}
/**
* Create a new JavaScript string from the given data.
*
* @param mixed $data
* @param int $flags
* @param int $depth
* @return static
*
* @throws \JsonException
*/
public static function from($data, $flags = 0, $depth = 512)
{
return new static($data, $flags, $depth);
}
/**
* Convert the given data to a JavaScript expression.
*
* @param mixed $data
* @param int $flags
* @param int $depth
* @return string
*
* @throws \JsonException
*/
protected function convertDataToJavaScriptExpression($data, $flags = 0, $depth = 512)
{
if ($data instanceof self) {
return $data->toHtml();
}
if ($data instanceof Htmlable &&
! $data instanceof Arrayable &&
! $data instanceof Jsonable &&
! $data instanceof JsonSerializable) {
$data = $data->toHtml();
}
if ($data instanceof UnitEnum) {
$data = enum_value($data);
}
$json = static::encode($data, $flags, $depth);
if (is_string($data)) {
return "'".substr($json, 1, -1)."'";
}
return $this->convertJsonToJavaScriptExpression($json, $flags);
}
/**
* Encode the given data as JSON.
*
* Invalid UTF-8 sequences are replaced with <20> instead of throwing.
*
* @param mixed $data
* @param int $flags
* @param int $depth
* @return string
*
* @throws \JsonException
*/
public static function encode($data, $flags = 0, $depth = 512)
{
if ($data instanceof Jsonable) {
return $data->toJson($flags | static::REQUIRED_FLAGS);
}
if ($data instanceof Arrayable && ! ($data instanceof JsonSerializable)) {
$data = $data->toArray();
}
return json_encode($data, $flags | static::REQUIRED_FLAGS | JSON_INVALID_UTF8_SUBSTITUTE, $depth);
}
/**
* Convert the given JSON to a JavaScript expression.
*
* @param string $json
* @param int $flags
* @return string
*
* @throws \JsonException
*/
protected function convertJsonToJavaScriptExpression($json, $flags = 0)
{
if ($json === '[]' || $json === '{}') {
return $json;
}
if (Str::startsWith($json, ['"', '{', '['])) {
return "JSON.parse('".substr(json_encode($json, $flags | static::REQUIRED_FLAGS), 1, -1)."')";
}
return $json;
}
/**
* Get the string representation of the data for use in HTML.
*
* @return string
*/
public function toHtml()
{
return $this->js;
}
/**
* Get the string representation of the data for use in HTML.
*
* @return string
*/
public function __toString()
{
return $this->toHtml();
}
}

View File

@@ -1,21 +0,0 @@
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.

View File

@@ -1,284 +0,0 @@
<?php
namespace Illuminate\Support;
use RuntimeException;
class Lottery
{
/**
* The number of expected wins.
*
* @var int|float
*/
protected $chances;
/**
* The number of potential opportunities to win.
*
* @var int|null
*/
protected $outOf;
/**
* The winning callback.
*
* @var null|callable
*/
protected $winner;
/**
* The losing callback.
*
* @var null|callable
*/
protected $loser;
/**
* The factory that should be used to generate results.
*
* @var callable|null
*/
protected static $resultFactory;
/**
* Create a new Lottery instance.
*
* @param int|float $chances
* @param int<1, max>|null $outOf
*/
public function __construct($chances, $outOf = null)
{
if ($outOf === null && is_float($chances) && $chances > 1) {
throw new RuntimeException('Float must not be greater than 1.');
}
if ($outOf !== null && $outOf < 1) {
throw new RuntimeException('Lottery "out of" value must be greater than or equal to 1.');
}
$this->chances = $chances;
$this->outOf = $outOf;
}
/**
* Create a new Lottery instance.
*
* @param int|float $chances
* @param int|null $outOf
* @return static
*/
public static function odds($chances, $outOf = null)
{
return new static($chances, $outOf);
}
/**
* Set the winner callback.
*
* @param callable $callback
* @return $this
*/
public function winner($callback)
{
$this->winner = $callback;
return $this;
}
/**
* Set the loser callback.
*
* @param callable $callback
* @return $this
*/
public function loser($callback)
{
$this->loser = $callback;
return $this;
}
/**
* Run the lottery.
*
* @param mixed ...$args
* @return mixed
*/
public function __invoke(...$args)
{
return $this->runCallback(...$args);
}
/**
* Run the lottery.
*
* @param null|int $times
* @return mixed
*/
public function choose($times = null)
{
if ($times === null) {
return $this->runCallback();
}
$results = [];
for ($i = 0; $i < $times; $i++) {
$results[] = $this->runCallback();
}
return $results;
}
/**
* Run the winner or loser callback, randomly.
*
* @param mixed ...$args
* @return callable
*/
protected function runCallback(...$args)
{
return $this->wins()
? ($this->winner ?? fn () => true)(...$args)
: ($this->loser ?? fn () => false)(...$args);
}
/**
* Determine if the lottery "wins" or "loses".
*
* @return bool
*/
protected function wins()
{
return static::resultFactory()($this->chances, $this->outOf);
}
/**
* The factory that determines the lottery result.
*
* @return callable
*/
protected static function resultFactory()
{
return static::$resultFactory ?? fn ($chances, $outOf) => $outOf === null
? random_int(0, PHP_INT_MAX) / PHP_INT_MAX <= $chances
: random_int(1, $outOf) <= $chances;
}
/**
* Force the lottery to always result in a win.
*
* @param callable|null $callback
* @return void
*/
public static function alwaysWin($callback = null)
{
self::setResultFactory(fn () => true);
if ($callback === null) {
return;
}
$callback();
static::determineResultNormally();
}
/**
* Force the lottery to always result in a lose.
*
* @param callable|null $callback
* @return void
*/
public static function alwaysLose($callback = null)
{
self::setResultFactory(fn () => false);
if ($callback === null) {
return;
}
$callback();
static::determineResultNormally();
}
/**
* Set the sequence that will be used to determine lottery results.
*
* @param array $sequence
* @param callable|null $whenMissing
* @return void
*/
public static function fix($sequence, $whenMissing = null)
{
static::forceResultWithSequence($sequence, $whenMissing);
}
/**
* Set the sequence that will be used to determine lottery results.
*
* @param array $sequence
* @param callable|null $whenMissing
* @return void
*/
public static function forceResultWithSequence($sequence, $whenMissing = null)
{
$next = 0;
$whenMissing ??= function ($chances, $outOf) use (&$next) {
$factoryCache = static::$resultFactory;
static::$resultFactory = null;
$result = static::resultFactory()($chances, $outOf);
static::$resultFactory = $factoryCache;
$next++;
return $result;
};
static::setResultFactory(function ($chances, $outOf) use (&$next, $sequence, $whenMissing) {
if (array_key_exists($next, $sequence)) {
return $sequence[$next++];
}
return $whenMissing($chances, $outOf);
});
}
/**
* Indicate that the lottery results should be determined normally.
*
* @return void
*/
public static function determineResultsNormally()
{
static::determineResultNormally();
}
/**
* Indicate that the lottery results should be determined normally.
*
* @return void
*/
public static function determineResultNormally()
{
static::$resultFactory = null;
}
/**
* Set the factory that should be used to determine the lottery results.
*
* @param callable $factory
* @return void
*/
public static function setResultFactory($factory)
{
self::$resultFactory = $factory;
}
}

View File

@@ -1,188 +0,0 @@
<?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 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
*/
public function __construct(Container $container)
{
$this->container = $container;
$this->config = $container->make('config');
}
/**
* Get the default driver name.
*
* @return string|null
*/
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.
return $this->drivers[$driver] ??= $this->createDriver($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);
}
$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;
}
/**
* Get the container instance used by the manager.
*
* @return \Illuminate\Contracts\Container\Container
*/
public function getContainer()
{
return $this->container;
}
/**
* Set the container instance used by the manager.
*
* @param \Illuminate\Contracts\Container\Container $container
* @return $this
*/
public function setContainer(Container $container)
{
$this->container = $container;
return $this;
}
/**
* Forget all of the resolved driver instances.
*
* @return $this
*/
public function forgetDrivers()
{
$this->drivers = [];
return $this;
}
/**
* Dynamically call the default driver instance.
*
* @param string $method
* @param array $parameters
* @return mixed
*/
public function __call($method, $parameters)
{
return $this->driver()->$method(...$parameters);
}
}

View File

@@ -1,454 +0,0 @@
<?php
namespace Illuminate\Support;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Contracts\Support\Jsonable;
use Illuminate\Contracts\Support\MessageBag as MessageBagContract;
use Illuminate\Contracts\Support\MessageProvider;
use JsonSerializable;
use Stringable;
class MessageBag implements Jsonable, JsonSerializable, MessageBagContract, MessageProvider, Stringable
{
/**
* All of the registered messages.
*
* @var array<string, array<string>>
*/
protected $messages = [];
/**
* Default format for message output.
*
* @var string
*/
protected $format = ':message';
/**
* Create a new message bag instance.
*
* @param array<string, Arrayable|string|array<string>> $messages
*/
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<string>
*/
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<string, array<string>> $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|null $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;
}
/**
* Determine if messages don't exist for all of the given keys.
*
* @param array|string|null $key
* @return bool
*/
public function missing($key)
{
$keys = is_array($key) ? $key : func_get_args();
return ! $this->hasAny($keys);
}
/**
* 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<string>|array<string, array<string>>
*/
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<string, array<string>>
*/
protected function getMessagesForWildcardKey($key, $format)
{
return (new Collection($this->messages))
->filter(fn ($messages, $messageKey) => 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<string>
*/
public function all($format = null)
{
$format = $this->checkFormat($format);
$all = [];
foreach ($this->messages as $key => $messages) {
array_push($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));
}
/**
* Remove a message from the message bag.
*
* @param string $key
* @return $this
*/
public function forget($key)
{
unset($this->messages[$key]);
return $this;
}
/**
* Format an array of messages.
*
* @param array<string> $messages
* @param string $format
* @param string $messageKey
* @return array<string>
*/
protected function transform($messages, $format, $messageKey)
{
if ($format == ':message') {
return (array) $messages;
}
return (new Collection((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<string, array<string>>
*/
public function messages()
{
return $this->messages;
}
/**
* Get the raw messages in the message bag.
*
* @return array<string, array<string>>
*/
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(): int
{
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(): array
{
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 object to pretty print formatted JSON.
*
* @param int $options
* @return string
*/
public function toPrettyJson(int $options = 0)
{
return $this->toJson(JSON_PRETTY_PRINT | $options);
}
/**
* Convert the message bag to its string representation.
*
* @return string
*/
public function __toString()
{
return $this->toJson();
}
}

View File

@@ -1,230 +0,0 @@
<?php
namespace Illuminate\Support;
use Closure;
use InvalidArgumentException;
use RuntimeException;
abstract class MultipleInstanceManager
{
/**
* The application instance.
*
* @var \Illuminate\Contracts\Foundation\Application
*/
protected $app;
/**
* The configuration repository instance.
*
* @var \Illuminate\Contracts\Config\Repository
*/
protected $config;
/**
* The array of resolved instances.
*
* @var array
*/
protected $instances = [];
/**
* The registered custom instance creators.
*
* @var array
*/
protected $customCreators = [];
/**
* The key name of the "driver" equivalent configuration option.
*
* @var string
*/
protected $driverKey = 'driver';
/**
* Create a new manager instance.
*
* @param \Illuminate\Contracts\Foundation\Application $app
*/
public function __construct($app)
{
$this->app = $app;
$this->config = $app->make('config');
}
/**
* Get the default instance name.
*
* @return string
*/
abstract public function getDefaultInstance();
/**
* Set the default instance name.
*
* @param string $name
* @return void
*/
abstract public function setDefaultInstance($name);
/**
* Get the instance specific configuration.
*
* @param string $name
* @return array
*/
abstract public function getInstanceConfig($name);
/**
* Get an instance by name.
*
* @param string|null $name
* @return mixed
*/
public function instance($name = null)
{
$name = $name ?: $this->getDefaultInstance();
return $this->instances[$name] = $this->get($name);
}
/**
* Attempt to get an instance from the local cache.
*
* @param string $name
* @return mixed
*/
protected function get($name)
{
return $this->instances[$name] ?? $this->resolve($name);
}
/**
* Resolve the given instance.
*
* @param string $name
* @return mixed
*
* @throws \InvalidArgumentException
* @throws \RuntimeException
*/
protected function resolve($name)
{
$config = $this->getInstanceConfig($name);
if (is_null($config)) {
throw new InvalidArgumentException("Instance [{$name}] is not defined.");
}
if (! array_key_exists($this->driverKey, $config)) {
throw new RuntimeException("Instance [{$name}] does not specify a {$this->driverKey}.");
}
$driverName = $config[$this->driverKey];
if (isset($this->customCreators[$driverName])) {
return $this->callCustomCreator($config);
} else {
$createMethod = 'create'.ucfirst($driverName).ucfirst($this->driverKey);
if (method_exists($this, $createMethod)) {
return $this->{$createMethod}($config);
}
$createMethod = 'create'.Str::studly($driverName).ucfirst($this->driverKey);
if (method_exists($this, $createMethod)) {
return $this->{$createMethod}($config);
}
throw new InvalidArgumentException("Instance {$this->driverKey} [{$config[$this->driverKey]}] is not supported.");
}
}
/**
* Call a custom instance creator.
*
* @param array $config
* @return mixed
*/
protected function callCustomCreator(array $config)
{
return $this->customCreators[$config[$this->driverKey]]($this->app, $config);
}
/**
* Unset the given instances.
*
* @param array|string|null $name
* @return $this
*/
public function forgetInstance($name = null)
{
$name ??= $this->getDefaultInstance();
foreach ((array) $name as $instanceName) {
if (isset($this->instances[$instanceName])) {
unset($this->instances[$instanceName]);
}
}
return $this;
}
/**
* Disconnect the given instance and remove from local cache.
*
* @param string|null $name
* @return void
*/
public function purge($name = null)
{
$name ??= $this->getDefaultInstance();
unset($this->instances[$name]);
}
/**
* Register a custom instance creator Closure.
*
* @param string $name
* @param \Closure $callback
*
* @param-closure-this $this $callback
*
* @return $this
*/
public function extend($name, Closure $callback)
{
$this->customCreators[$name] = $callback->bindTo($this, $this);
return $this;
}
/**
* Set the application instance used by the manager.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @return $this
*/
public function setApplication($app)
{
$this->app = $app;
return $this;
}
/**
* Dynamically call the default instance.
*
* @param string $method
* @param array $parameters
* @return mixed
*/
public function __call($method, $parameters)
{
return $this->instance()->$method(...$parameters);
}
}

View File

@@ -1,112 +0,0 @@
<?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 (! str_contains($key, '::')) {
$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;
}
/**
* Flush the cache of parsed keys.
*
* @return void
*/
public function flushParsedKeys()
{
$this->parsed = [];
}
}

View File

@@ -1,456 +0,0 @@
<?php
namespace Illuminate\Support;
use Illuminate\Support\Traits\Macroable;
use NumberFormatter;
use RuntimeException;
class Number
{
use Macroable;
/**
* The current default locale.
*
* @var string
*/
protected static $locale = 'en';
/**
* The current default currency.
*
* @var string
*/
protected static $currency = 'USD';
/**
* Format the given number according to the current locale.
*
* @param int|float $number
* @param int|null $precision
* @param int|null $maxPrecision
* @param string|null $locale
* @return string|false
*/
public static function format(int|float $number, ?int $precision = null, ?int $maxPrecision = null, ?string $locale = null)
{
static::ensureIntlExtensionIsInstalled();
$formatter = new NumberFormatter($locale ?? static::$locale, NumberFormatter::DECIMAL);
if (! is_null($maxPrecision)) {
$formatter->setAttribute(NumberFormatter::MAX_FRACTION_DIGITS, $maxPrecision);
} elseif (! is_null($precision)) {
$formatter->setAttribute(NumberFormatter::FRACTION_DIGITS, $precision);
}
return $formatter->format($number);
}
/**
* Parse the given string according to the specified format type.
*
* @param string $string
* @param int|null $type
* @param string|null $locale
* @return int|float|false
*/
public static function parse(string $string, ?int $type = NumberFormatter::TYPE_DOUBLE, ?string $locale = null): int|float|false
{
static::ensureIntlExtensionIsInstalled();
$formatter = new NumberFormatter($locale ?? static::$locale, NumberFormatter::DECIMAL);
return $formatter->parse($string, $type);
}
/**
* Parse a string into an integer according to the specified locale.
*
* @param string $string
* @param string|null $locale
* @return int|false
*/
public static function parseInt(string $string, ?string $locale = null): int|false
{
return self::parse($string, NumberFormatter::TYPE_INT32, $locale);
}
/**
* Parse a string into a float according to the specified locale.
*
* @param string $string
* @param string|null $locale
* @return float|false
*/
public static function parseFloat(string $string, ?string $locale = null): float|false
{
return self::parse($string, NumberFormatter::TYPE_DOUBLE, $locale);
}
/**
* Spell out the given number in the given locale.
*
* @param int|float $number
* @param string|null $locale
* @param int|null $after
* @param int|null $until
* @return string
*/
public static function spell(int|float $number, ?string $locale = null, ?int $after = null, ?int $until = null)
{
static::ensureIntlExtensionIsInstalled();
if (! is_null($after) && $number <= $after) {
return static::format($number, locale: $locale);
}
if (! is_null($until) && $number >= $until) {
return static::format($number, locale: $locale);
}
$formatter = new NumberFormatter($locale ?? static::$locale, NumberFormatter::SPELLOUT);
return $formatter->format($number);
}
/**
* Convert the given number to ordinal form.
*
* @param int|float $number
* @param string|null $locale
* @return string
*/
public static function ordinal(int|float $number, ?string $locale = null)
{
static::ensureIntlExtensionIsInstalled();
$formatter = new NumberFormatter($locale ?? static::$locale, NumberFormatter::ORDINAL);
return $formatter->format($number);
}
/**
* Spell out the given number in the given locale in ordinal form.
*
* @param int|float $number
* @param string|null $locale
* @return string
*/
public static function spellOrdinal(int|float $number, ?string $locale = null)
{
static::ensureIntlExtensionIsInstalled();
$formatter = new NumberFormatter($locale ?? static::$locale, NumberFormatter::SPELLOUT);
$formatter->setTextAttribute(NumberFormatter::DEFAULT_RULESET, '%spellout-ordinal');
return $formatter->format($number);
}
/**
* Convert the given number to its percentage equivalent.
*
* @param int|float $number
* @param int $precision
* @param int|null $maxPrecision
* @param string|null $locale
* @return string|false
*/
public static function percentage(int|float $number, int $precision = 0, ?int $maxPrecision = null, ?string $locale = null)
{
static::ensureIntlExtensionIsInstalled();
$formatter = new NumberFormatter($locale ?? static::$locale, NumberFormatter::PERCENT);
if (! is_null($maxPrecision)) {
$formatter->setAttribute(NumberFormatter::MAX_FRACTION_DIGITS, $maxPrecision);
} else {
$formatter->setAttribute(NumberFormatter::FRACTION_DIGITS, $precision);
}
return $formatter->format($number / 100);
}
/**
* Convert the given number to its currency equivalent.
*
* @param int|float $number
* @param string $in
* @param string|null $locale
* @param int|null $precision
* @return string|false
*/
public static function currency(int|float $number, string $in = '', ?string $locale = null, ?int $precision = null)
{
static::ensureIntlExtensionIsInstalled();
$formatter = new NumberFormatter($locale ?? static::$locale, NumberFormatter::CURRENCY);
if (! is_null($precision)) {
$formatter->setAttribute(NumberFormatter::FRACTION_DIGITS, $precision);
}
return $formatter->formatCurrency($number, ! empty($in) ? $in : static::$currency);
}
/**
* Convert the given number to its file size equivalent.
*
* @param int|float $bytes
* @param int $precision
* @param int|null $maxPrecision
* @return string
*/
public static function fileSize(int|float $bytes, int $precision = 0, ?int $maxPrecision = null)
{
$units = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
$unitCount = count($units);
for ($i = 0; (abs($bytes) / 1024) > 0.9 && ($i < $unitCount - 1); $i++) {
$bytes /= 1024;
}
return sprintf('%s %s', static::format($bytes, $precision, $maxPrecision), $units[$i]);
}
/**
* Convert the number to its human-readable equivalent.
*
* @param int|float $number
* @param int $precision
* @param int|null $maxPrecision
* @return string|false
*/
public static function abbreviate(int|float $number, int $precision = 0, ?int $maxPrecision = null)
{
return static::forHumans($number, $precision, $maxPrecision, abbreviate: true);
}
/**
* Convert the number to its human-readable equivalent.
*
* @param int|float $number
* @param int $precision
* @param int|null $maxPrecision
* @param bool $abbreviate
* @return string|false
*/
public static function forHumans(int|float $number, int $precision = 0, ?int $maxPrecision = null, bool $abbreviate = false)
{
return static::summarize($number, $precision, $maxPrecision, $abbreviate ? [
3 => 'K',
6 => 'M',
9 => 'B',
12 => 'T',
15 => 'Q',
] : [
3 => ' thousand',
6 => ' million',
9 => ' billion',
12 => ' trillion',
15 => ' quadrillion',
]);
}
/**
* Convert the number to its human-readable equivalent.
*
* @param int|float $number
* @param int $precision
* @param int|null $maxPrecision
* @param array $units
* @return string|false
*/
protected static function summarize(int|float $number, int $precision = 0, ?int $maxPrecision = null, array $units = [])
{
if (empty($units)) {
$units = [
3 => 'K',
6 => 'M',
9 => 'B',
12 => 'T',
15 => 'Q',
];
}
switch (true) {
case (float) $number === 0.0:
return $precision > 0 ? static::format(0, $precision, $maxPrecision) : '0';
case $number < 0:
return sprintf('-%s', static::summarize(abs($number), $precision, $maxPrecision, $units));
case $number >= 1e15:
return sprintf('%s'.end($units), static::summarize($number / 1e15, $precision, $maxPrecision, $units));
}
$numberExponent = floor(log10($number));
$displayExponent = $numberExponent - ($numberExponent % 3);
$number /= pow(10, $displayExponent);
return trim(sprintf('%s%s', static::format($number, $precision, $maxPrecision), $units[$displayExponent] ?? ''));
}
/**
* Clamp the given number between the given minimum and maximum.
*
* @param int|float $number
* @param int|float $min
* @param int|float $max
* @return int|float
*/
public static function clamp(int|float $number, int|float $min, int|float $max)
{
return min(max($number, $min), $max);
}
/**
* Split the given number into pairs of min/max values.
*
* @param int|float $to
* @param int|float $by
* @param int|float $start
* @param int|float $offset
* @return list<array{int|float, int|float}>
*/
public static function pairs(int|float $to, int|float $by, int|float $start = 0, int|float $offset = 1)
{
if ($by == 0) {
throw new \InvalidArgumentException('The $by argument must not be zero.');
}
$by = abs($by);
$output = [];
for ($lower = $start; $lower < $to; $lower += $by) {
$upper = $lower + $by - $offset;
if ($upper > $to) {
$upper = $to;
}
$output[] = [$lower, $upper];
}
return $output;
}
/**
* Remove any trailing zero digits after the decimal point of the given number.
*
* @param int|float $number
* @return int|float
*/
public static function trim(int|float $number)
{
if (is_infinite($number) || is_nan($number)) {
return $number;
}
return json_decode(json_encode($number));
}
/**
* Execute the given callback using the given locale.
*
* @template TReturn
*
* @param string $locale
* @param callable(): TReturn $callback
* @return TReturn
*/
public static function withLocale(string $locale, callable $callback)
{
$previousLocale = static::$locale;
static::useLocale($locale);
try {
return $callback();
} finally {
static::useLocale($previousLocale);
}
}
/**
* Execute the given callback using the given currency.
*
* @template TReturn
*
* @param string $currency
* @param callable(): TReturn $callback
* @return TReturn
*/
public static function withCurrency(string $currency, callable $callback)
{
$previousCurrency = static::$currency;
static::useCurrency($currency);
try {
return $callback();
} finally {
static::useCurrency($previousCurrency);
}
}
/**
* Set the default locale.
*
* @param string $locale
* @return void
*/
public static function useLocale(string $locale)
{
static::$locale = $locale;
}
/**
* Set the default currency.
*
* @param string $currency
* @return void
*/
public static function useCurrency(string $currency)
{
static::$currency = $currency;
}
/**
* Get the default locale.
*
* @return string
*/
public static function defaultLocale()
{
return static::$locale;
}
/**
* Get the default currency.
*
* @return string
*/
public static function defaultCurrency()
{
return static::$currency;
}
/**
* Ensure the "intl" PHP extension is installed.
*
* @return void
*
* @throws \RuntimeException
*/
protected static function ensureIntlExtensionIsInstalled()
{
if (! extension_loaded('intl')) {
$method = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2)[1]['function'];
throw new RuntimeException('The "intl" PHP extension is required to use the ['.$method.'] method.');
}
}
}

View File

@@ -1,99 +0,0 @@
<?php
namespace Illuminate\Support;
use WeakMap;
class Once
{
/**
* The current globally used instance.
*
* @var static|null
*/
protected static ?self $instance = null;
/**
* Indicates if the once instance is enabled.
*
* @var bool
*/
protected static bool $enabled = true;
/**
* Create a new once instance.
*
* @param \WeakMap<object, array<string, mixed>> $values
*/
protected function __construct(protected WeakMap $values)
{
//
}
/**
* Create a new once instance.
*
* @return static
*/
public static function instance()
{
return static::$instance ??= new static(new WeakMap);
}
/**
* Get the value of the given onceable.
*
* @param Onceable $onceable
* @return mixed
*/
public function value(Onceable $onceable)
{
if (! static::$enabled) {
return call_user_func($onceable->callable);
}
$object = $onceable->object ?: $this;
$hash = $onceable->hash;
if (! isset($this->values[$object])) {
$this->values[$object] = [];
}
if (array_key_exists($hash, $this->values[$object])) {
return $this->values[$object][$hash];
}
return $this->values[$object][$hash] = call_user_func($onceable->callable);
}
/**
* Re-enable the once instance if it was disabled.
*
* @return void
*/
public static function enable()
{
static::$enabled = true;
}
/**
* Disable the once instance.
*
* @return void
*/
public static function disable()
{
static::$enabled = false;
}
/**
* Flush the once instance.
*
* @return void
*/
public static function flush()
{
static::$instance = null;
}
}

View File

@@ -1,92 +0,0 @@
<?php
namespace Illuminate\Support;
use Closure;
use Illuminate\Contracts\Support\HasOnceHash;
use Laravel\SerializableClosure\Support\ReflectionClosure;
class Onceable
{
/**
* Create a new onceable instance.
*
* @param string $hash
* @param object|null $object
* @param callable $callable
*/
public function __construct(
public string $hash,
public ?object $object,
public $callable,
) {
//
}
/**
* Tries to create a new onceable instance from the given trace.
*
* @param array<int, array<string, mixed>> $trace
* @return static|null
*/
public static function tryFromTrace(array $trace, callable $callable)
{
if (! is_null($hash = static::hashFromTrace($trace, $callable))) {
$object = static::objectFromTrace($trace);
return new static($hash, $object, $callable);
}
}
/**
* Computes the object of the onceable from the given trace, if any.
*
* @param array<int, array<string, mixed>> $trace
* @return object|null
*/
protected static function objectFromTrace(array $trace)
{
return $trace[1]['object'] ?? null;
}
/**
* Computes the hash of the onceable from the given trace.
*
* @param array<int, array<string, mixed>> $trace
* @return string|null
*/
protected static function hashFromTrace(array $trace, callable $callable)
{
if (str_contains($trace[0]['file'] ?? '', 'eval()\'d code')) {
return null;
}
$uses = array_map(
static function (mixed $argument) {
if ($argument instanceof HasOnceHash) {
return $argument->onceHash();
}
if (is_object($argument)) {
return spl_object_hash($argument);
}
return $argument;
},
$callable instanceof Closure ? (new ReflectionClosure($callable))->getClosureUsedVariables() : [],
);
$class = $callable instanceof Closure ? (new ReflectionClosure($callable))->getClosureCalledClass()?->getName() : null;
$class ??= isset($trace[1]['class']) ? $trace[1]['class'] : null;
return hash('xxh128', sprintf(
'%s@%s%s:%s (%s)',
$trace[0]['file'],
$class ? $class.'@' : '',
$trace[1]['function'],
$trace[0]['line'],
serialize($uses),
));
}
}

View File

@@ -1,130 +0,0 @@
<?php
namespace Illuminate\Support;
use ArrayAccess;
use ArrayObject;
use Illuminate\Support\Traits\Macroable;
class Optional implements ArrayAccess
{
use Macroable {
__call as macroCall;
}
/**
* The underlying object.
*
* @var mixed
*/
protected $value;
/**
* Create a new optional instance.
*
* @param mixed $value
*/
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): bool
{
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): mixed
{
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): void
{
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): void
{
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);
}
}
}

View File

@@ -1,127 +0,0 @@
<?php
namespace Illuminate\Support;
use Doctrine\Inflector\InflectorFactory;
class Pluralizer
{
/**
* The cached inflector instance.
*
* @var static
*/
protected static $inflector;
/**
* The language that should be used by the inflector.
*
* @var string
*/
protected static $language = 'english';
/**
* Uncountable non-nouns word forms.
*
* Contains words supported by Doctrine/Inflector/Rules/English/Uninflected.php
*
* @var string[]
*/
public static $uncountable = [
'recommended',
'related',
];
/**
* Get the plural form of an English word.
*
* @param string $value
* @param int|array|\Countable $count
* @return string
*/
public static function plural($value, $count = 2)
{
if (is_countable($count)) {
$count = count($count);
}
if ((int) abs($count) === 1 || static::uncountable($value) || preg_match('/^(.*)[A-Za-z0-9\x{0080}-\x{FFFF}]$/u', $value) == 0) {
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()
{
if (is_null(static::$inflector)) {
static::$inflector = InflectorFactory::createForLanguage(static::$language)->build();
}
return static::$inflector;
}
/**
* Specify the language that should be used by the inflector.
*
* @param string $language
* @return void
*/
public static function useLanguage(string $language)
{
static::$language = $language;
static::$inflector = null;
}
}

View File

@@ -1,69 +0,0 @@
<?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 (str_ends_with($part, '\\')) {
$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 strlen($arg) > 2 && $char === $arg[0] && $char === $arg[strlen($arg) - 1];
}
}

Some files were not shown because too many files have changed in this diff Show More