Upgrade framework

This commit is contained in:
2023-11-14 16:54:35 +01:00
parent 1648a5cd42
commit 4fcf6fffcc
10548 changed files with 693138 additions and 466698 deletions

View File

@@ -7,9 +7,9 @@ interface Authorizable
/**
* Determine if the entity has a given ability.
*
* @param string $ability
* @param iterable|string $abilities
* @param array|mixed $arguments
* @return bool
*/
public function can($ability, $arguments = []);
public function can($abilities, $arguments = []);
}

View File

@@ -21,6 +21,16 @@ interface Gate
*/
public function define($ability, $callback);
/**
* Define abilities for a resource.
*
* @param string $name
* @param string $class
* @param array|null $abilities
* @return $this
*/
public function resource($name, $class, array $abilities = null);
/**
* Define a policy class for a given class type.
*
@@ -65,13 +75,22 @@ interface Gate
public function denies($ability, $arguments = []);
/**
* Determine if the given ability should be granted.
* Determine if all of the given abilities should be granted for the current user.
*
* @param string $ability
* @param iterable|string $abilities
* @param array|mixed $arguments
* @return bool
*/
public function check($ability, $arguments = []);
public function check($abilities, $arguments = []);
/**
* Determine if any one of the given abilities should be granted for the current user.
*
* @param iterable|string $abilities
* @param array|mixed $arguments
* @return bool
*/
public function any($abilities, $arguments = []);
/**
* Determine if the given ability should be granted for the current user.
@@ -84,6 +103,26 @@ interface Gate
*/
public function authorize($ability, $arguments = []);
/**
* Inspect the user for the given ability.
*
* @param string $ability
* @param array|mixed $arguments
* @return \Illuminate\Auth\Access\Response
*/
public function inspect($ability, $arguments = []);
/**
* Get the raw result from the authorization callback.
*
* @param string $ability
* @param array|mixed $arguments
* @return mixed
*
* @throws \Illuminate\Auth\Access\AuthorizationException
*/
public function raw($ability, $arguments = []);
/**
* Get a policy instance for a given class.
*
@@ -101,4 +140,11 @@ interface Gate
* @return static
*/
public function forUser($user);
/**
* Get all of the defined abilities.
*
* @return array
*/
public function abilities();
}

View File

@@ -8,7 +8,7 @@ interface Factory
* Get a guard instance by name.
*
* @param string|null $name
* @return mixed
* @return \Illuminate\Contracts\Auth\Guard|\Illuminate\Contracts\Auth\StatefulGuard
*/
public function guard($name = null);

View File

@@ -28,7 +28,7 @@ interface Guard
/**
* Get the ID for the currently authenticated user.
*
* @return int|null
* @return int|string|null
*/
public function id();
@@ -40,6 +40,13 @@ interface Guard
*/
public function validate(array $credentials = []);
/**
* Determine if the guard has a user instance.
*
* @return bool
*/
public function hasUser();
/**
* Set the current user.
*

View File

@@ -0,0 +1,8 @@
<?php
namespace Illuminate\Contracts\Auth\Middleware;
interface AuthenticatesRequests
{
//
}

View File

@@ -0,0 +1,34 @@
<?php
namespace Illuminate\Contracts\Auth;
interface MustVerifyEmail
{
/**
* Determine if the user has verified their email address.
*
* @return bool
*/
public function hasVerifiedEmail();
/**
* Mark the given user's email as verified.
*
* @return bool
*/
public function markEmailAsVerified();
/**
* Send the email verification notification.
*
* @return void
*/
public function sendEmailVerificationNotification();
/**
* Get the email address that should be used for verification.
*
* @return string
*/
public function getEmailForVerification();
}

View File

@@ -27,13 +27,6 @@ interface PasswordBroker
*/
const INVALID_USER = 'passwords.user';
/**
* Constant representing an invalid password.
*
* @var string
*/
const INVALID_PASSWORD = 'passwords.password';
/**
* Constant representing an invalid token.
*
@@ -41,36 +34,28 @@ interface PasswordBroker
*/
const INVALID_TOKEN = 'passwords.token';
/**
* Constant representing a throttled reset attempt.
*
* @var string
*/
const RESET_THROTTLED = 'passwords.throttled';
/**
* Send a password reset link to a user.
*
* @param array $credentials
* @param \Closure|null $callback
* @return string
*/
public function sendResetLink(array $credentials);
public function sendResetLink(array $credentials, Closure $callback = null);
/**
* Reset the password for the given token.
*
* @param array $credentials
* @param array $credentials
* @param \Closure $callback
* @return mixed
*/
public function reset(array $credentials, Closure $callback);
/**
* Set a custom password validator.
*
* @param \Closure $callback
* @return void
*/
public function validator(Closure $callback);
/**
* Determine if the passwords match for the request.
*
* @param array $credentials
* @return bool
*/
public function validateNewPassword(array $credentials);
}

View File

@@ -8,7 +8,7 @@ interface PasswordBrokerFactory
* Get a password broker instance by name.
*
* @param string|null $name
* @return mixed
* @return \Illuminate\Contracts\Auth\PasswordBroker
*/
public function broker($name = null);
}

View File

@@ -8,7 +8,7 @@ interface StatefulGuard extends Guard
* Attempt to authenticate a user using the given credentials.
*
* @param array $credentials
* @param bool $remember
* @param bool $remember
* @return bool
*/
public function attempt(array $credentials = [], $remember = false);
@@ -34,8 +34,8 @@ interface StatefulGuard extends Guard
* Log the given user ID into the application.
*
* @param mixed $id
* @param bool $remember
* @return \Illuminate\Contracts\Auth\Authenticatable
* @param bool $remember
* @return \Illuminate\Contracts\Auth\Authenticatable|bool
*/
public function loginUsingId($id, $remember = false);
@@ -43,7 +43,7 @@ interface StatefulGuard extends Guard
* Log the given user ID into the application without sessions or cookies.
*
* @param mixed $id
* @return bool
* @return \Illuminate\Contracts\Auth\Authenticatable|bool
*/
public function onceUsingId($id);

View File

@@ -15,7 +15,7 @@ interface UserProvider
/**
* Retrieve a user by their unique identifier and "remember me" token.
*
* @param mixed $identifier
* @param mixed $identifier
* @param string $token
* @return \Illuminate\Contracts\Auth\Authenticatable|null
*/

View File

@@ -28,6 +28,8 @@ interface Broadcaster
* @param string $event
* @param array $payload
* @return void
*
* @throws \Illuminate\Broadcasting\BroadcastException
*/
public function broadcast(array $channels, $event, array $payload = []);
}

View File

@@ -7,8 +7,8 @@ interface Factory
/**
* Get a broadcaster implementation by name.
*
* @param string $name
* @return void
* @param string|null $name
* @return \Illuminate\Contracts\Broadcasting\Broadcaster
*/
public function connection($name = null);
}

View File

@@ -0,0 +1,20 @@
<?php
namespace Illuminate\Contracts\Broadcasting;
interface HasBroadcastChannel
{
/**
* Get the broadcast channel route definition that is associated with the given entity.
*
* @return string
*/
public function broadcastChannelRoute();
/**
* Get the broadcast channel name that is associated with the given entity.
*
* @return string
*/
public function broadcastChannel();
}

View File

@@ -0,0 +1,8 @@
<?php
namespace Illuminate\Contracts\Broadcasting;
interface ShouldBeUnique
{
//
}

View File

@@ -7,7 +7,7 @@ interface ShouldBroadcast
/**
* Get the channels the event should broadcast on.
*
* @return array
* @return \Illuminate\Broadcasting\Channel|\Illuminate\Broadcasting\Channel[]|string[]|string
*/
public function broadcastOn();
}

View File

@@ -12,6 +12,17 @@ interface Dispatcher
*/
public function dispatch($command);
/**
* Dispatch a command to its appropriate handler in the current process.
*
* Queueable jobs will be dispatched to the "sync" queue.
*
* @param mixed $command
* @param mixed $handler
* @return mixed
*/
public function dispatchSync($command, $handler = null);
/**
* Dispatch a command to its appropriate handler in the current process.
*
@@ -21,6 +32,22 @@ interface Dispatcher
*/
public function dispatchNow($command, $handler = null);
/**
* Determine if the given command has a handler.
*
* @param mixed $command
* @return bool
*/
public function hasCommandHandler($command);
/**
* Retrieve the handler for a command.
*
* @param mixed $command
* @return bool|mixed
*/
public function getCommandHandler($command);
/**
* Set the pipes commands should be piped through before dispatching.
*
@@ -28,4 +55,12 @@ interface Dispatcher
* @return $this
*/
public function pipeThrough(array $pipes);
/**
* Map a command to a handler.
*
* @param array $map
* @return $this
*/
public function map(array $map);
}

View File

@@ -4,6 +4,22 @@ namespace Illuminate\Contracts\Bus;
interface QueueingDispatcher extends Dispatcher
{
/**
* Attempt to find the batch with the given ID.
*
* @param string $batchId
* @return \Illuminate\Bus\Batch|null
*/
public function findBatch(string $batchId);
/**
* Create a new batch of queueable jobs.
*
* @param \Illuminate\Support\Collection|array $jobs
* @return \Illuminate\Bus\PendingBatch
*/
public function batch($jobs);
/**
* Dispatch a command to its appropriate handler behind a queue.
*

View File

@@ -8,7 +8,7 @@ interface Factory
* Get a cache store instance by name.
*
* @param string|null $name
* @return mixed
* @return \Illuminate\Contracts\Cache\Repository
*/
public function store($name = null);
}

View File

@@ -0,0 +1,44 @@
<?php
namespace Illuminate\Contracts\Cache;
interface Lock
{
/**
* Attempt to acquire the lock.
*
* @param callable|null $callback
* @return mixed
*/
public function get($callback = null);
/**
* Attempt to acquire the lock for the given number of seconds.
*
* @param int $seconds
* @param callable|null $callback
* @return mixed
*/
public function block($seconds, $callback = null);
/**
* Release the lock.
*
* @return bool
*/
public function release();
/**
* Returns the current owner of the lock.
*
* @return string
*/
public function owner();
/**
* Releases this lock in disregard of ownership.
*
* @return void
*/
public function forceRelease();
}

View File

@@ -0,0 +1,25 @@
<?php
namespace Illuminate\Contracts\Cache;
interface LockProvider
{
/**
* Get a lock instance.
*
* @param string $name
* @param int $seconds
* @param string|null $owner
* @return \Illuminate\Contracts\Cache\Lock
*/
public function lock($name, $seconds = 0, $owner = null);
/**
* Restore a lock instance using the owner identifier.
*
* @param string $name
* @param string $owner
* @return \Illuminate\Contracts\Cache\Lock
*/
public function restoreLock($name, $owner);
}

View File

@@ -0,0 +1,10 @@
<?php
namespace Illuminate\Contracts\Cache;
use Exception;
class LockTimeoutException extends Exception
{
//
}

View File

@@ -3,31 +3,15 @@
namespace Illuminate\Contracts\Cache;
use Closure;
use Psr\SimpleCache\CacheInterface;
interface Repository
interface Repository extends CacheInterface
{
/**
* Determine if an item exists in the cache.
*
* @param string $key
* @return bool
*/
public function has($key);
/**
* Retrieve an item from the cache by key.
*
* @param string $key
* @param mixed $default
* @return mixed
*/
public function get($key, $default = null);
/**
* Retrieve an item from the cache and delete it.
*
* @param string $key
* @param mixed $default
* @param mixed $default
* @return mixed
*/
public function pull($key, $default = null);
@@ -36,21 +20,21 @@ interface Repository
* Store an item in the cache.
*
* @param string $key
* @param mixed $value
* @param \DateTime|float|int $minutes
* @return void
* @param mixed $value
* @param \DateTimeInterface|\DateInterval|int|null $ttl
* @return bool
*/
public function put($key, $value, $minutes);
public function put($key, $value, $ttl = null);
/**
* Store an item in the cache if the key does not exist.
*
* @param string $key
* @param mixed $value
* @param \DateTime|float|int $minutes
* @param mixed $value
* @param \DateTimeInterface|\DateInterval|int|null $ttl
* @return bool
*/
public function add($key, $value, $minutes);
public function add($key, $value, $ttl = null);
/**
* Increment the value of an item in the cache.
@@ -74,34 +58,34 @@ interface Repository
* Store an item in the cache indefinitely.
*
* @param string $key
* @param mixed $value
* @return void
* @param mixed $value
* @return bool
*/
public function forever($key, $value);
/**
* Get an item from the cache, or store the default value.
* Get an item from the cache, or execute the given Closure and store the result.
*
* @param string $key
* @param \DateTime|float|int $minutes
* @param \DateTimeInterface|\DateInterval|int|null $ttl
* @param \Closure $callback
* @return mixed
*/
public function remember($key, $minutes, Closure $callback);
public function remember($key, $ttl, Closure $callback);
/**
* Get an item from the cache, or store the default value forever.
* Get an item from the cache, or execute the given Closure and store the result forever.
*
* @param string $key
* @param string $key
* @param \Closure $callback
* @return mixed
*/
public function sear($key, Closure $callback);
/**
* Get an item from the cache, or store the default value forever.
* Get an item from the cache, or execute the given Closure and store the result forever.
*
* @param string $key
* @param string $key
* @param \Closure $callback
* @return mixed
*/
@@ -110,8 +94,15 @@ interface Repository
/**
* Remove an item from the cache.
*
* @param string $key
* @param string $key
* @return bool
*/
public function forget($key);
/**
* Get the cache store implementation.
*
* @return \Illuminate\Contracts\Cache\Store
*/
public function getStore();
}

View File

@@ -23,29 +23,29 @@ interface Store
public function many(array $keys);
/**
* Store an item in the cache for a given number of minutes.
* Store an item in the cache for a given number of seconds.
*
* @param string $key
* @param mixed $value
* @param float|int $minutes
* @return void
* @param mixed $value
* @param int $seconds
* @return bool
*/
public function put($key, $value, $minutes);
public function put($key, $value, $seconds);
/**
* Store multiple items in the cache for a given number of minutes.
* Store multiple items in the cache for a given number of seconds.
*
* @param array $values
* @param float|int $minutes
* @return void
* @param int $seconds
* @return bool
*/
public function putMany(array $values, $minutes);
public function putMany(array $values, $seconds);
/**
* Increment the value of an item in the cache.
*
* @param string $key
* @param mixed $value
* @param mixed $value
* @return int|bool
*/
public function increment($key, $value = 1);
@@ -54,7 +54,7 @@ interface Store
* Decrement the value of an item in the cache.
*
* @param string $key
* @param mixed $value
* @param mixed $value
* @return int|bool
*/
public function decrement($key, $value = 1);
@@ -63,8 +63,8 @@ interface Store
* Store an item in the cache indefinitely.
*
* @param string $key
* @param mixed $value
* @return void
* @param mixed $value
* @return bool
*/
public function forever($key, $value);

View File

@@ -15,8 +15,8 @@ interface Repository
/**
* Get the specified configuration value.
*
* @param string $key
* @param mixed $default
* @param array|string $key
* @param mixed $default
* @return mixed
*/
public function get($key, $default = null);
@@ -32,7 +32,7 @@ interface Repository
* Set a given configuration value.
*
* @param array|string $key
* @param mixed $value
* @param mixed $value
* @return void
*/
public function set($key, $value = null);

View File

@@ -5,13 +5,14 @@ namespace Illuminate\Contracts\Console;
interface Application
{
/**
* Call a console application command.
* Run an Artisan console command by name.
*
* @param string $command
* @param array $parameters
* @param \Symfony\Component\Console\Output\OutputInterface|null $outputBuffer
* @return int
*/
public function call($command, array $parameters = []);
public function call($command, array $parameters = [], $outputBuffer = null);
/**
* Get the output from the last command.

View File

@@ -0,0 +1,8 @@
<?php
namespace Illuminate\Contracts\Console;
interface Isolatable
{
//
}

View File

@@ -4,11 +4,18 @@ namespace Illuminate\Contracts\Console;
interface Kernel
{
/**
* Bootstrap the application for artisan commands.
*
* @return void
*/
public function bootstrap();
/**
* Handle an incoming console command.
*
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @param \Symfony\Component\Console\Output\OutputInterface|null $output
* @return int
*/
public function handle($input, $output = null);
@@ -18,9 +25,10 @@ interface Kernel
*
* @param string $command
* @param array $parameters
* @param \Symfony\Component\Console\Output\OutputInterface|null $outputBuffer
* @return int
*/
public function call($command, array $parameters = []);
public function call($command, array $parameters = [], $outputBuffer = null);
/**
* Queue an Artisan console command by name.
@@ -44,4 +52,13 @@ interface Kernel
* @return string
*/
public function output();
/**
* Terminate the application.
*
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param int $status
* @return void
*/
public function terminate($input, $status);
}

View File

@@ -3,8 +3,9 @@
namespace Illuminate\Contracts\Container;
use Exception;
use Psr\Container\ContainerExceptionInterface;
class BindingResolutionException extends Exception
class BindingResolutionException extends Exception implements ContainerExceptionInterface
{
//
}

View File

@@ -0,0 +1,11 @@
<?php
namespace Illuminate\Contracts\Container;
use Exception;
use Psr\Container\ContainerExceptionInterface;
class CircularDependencyException extends Exception implements ContainerExceptionInterface
{
//
}

View File

@@ -3,8 +3,9 @@
namespace Illuminate\Contracts\Container;
use Closure;
use Psr\Container\ContainerInterface;
interface Container
interface Container extends ContainerInterface
{
/**
* Determine if the given abstract type has been bound.
@@ -20,6 +21,8 @@ interface Container
* @param string $abstract
* @param string $alias
* @return void
*
* @throws \LogicException
*/
public function alias($abstract, $alias);
@@ -27,7 +30,7 @@ interface Container
* Assign a set of tags to a given binding.
*
* @param array|string $abstracts
* @param array|mixed ...$tags
* @param array|mixed ...$tags
* @return void
*/
public function tag($abstracts, $tags);
@@ -35,15 +38,15 @@ interface Container
/**
* Resolve all of the bindings for a given tag.
*
* @param array $tag
* @return array
* @param string $tag
* @return iterable
*/
public function tagged($tag);
/**
* Register a binding with the container.
*
* @param string|array $abstract
* @param string $abstract
* @param \Closure|string|null $concrete
* @param bool $shared
* @return void
@@ -63,16 +66,43 @@ interface Container
/**
* Register a shared binding in the container.
*
* @param string|array $abstract
* @param string $abstract
* @param \Closure|string|null $concrete
* @return void
*/
public function singleton($abstract, $concrete = null);
/**
* Register a shared binding if it hasn't already been registered.
*
* @param string $abstract
* @param \Closure|string|null $concrete
* @return void
*/
public function singletonIf($abstract, $concrete = null);
/**
* Register a scoped binding in the container.
*
* @param string $abstract
* @param \Closure|string|null $concrete
* @return void
*/
public function scoped($abstract, $concrete = null);
/**
* Register a scoped binding if it hasn't already been registered.
*
* @param string $abstract
* @param \Closure|string|null $concrete
* @return void
*/
public function scopedIf($abstract, $concrete = null);
/**
* "Extend" an abstract type in the container.
*
* @param string $abstract
* @param string $abstract
* @param \Closure $closure
* @return void
*
@@ -84,15 +114,25 @@ interface Container
* Register an existing instance as shared in the container.
*
* @param string $abstract
* @param mixed $instance
* @return void
* @param mixed $instance
* @return mixed
*/
public function instance($abstract, $instance);
/**
* Define a contextual binding.
* Add a contextual binding to the container.
*
* @param string $concrete
* @param string $abstract
* @param \Closure|string $implementation
* @return void
*/
public function addContextualBinding($concrete, $abstract, $implementation);
/**
* Define a contextual binding.
*
* @param string|array $concrete
* @return \Illuminate\Contracts\Container\ContextualBindingBuilder
*/
public function when($concrete);
@@ -105,13 +145,23 @@ interface Container
*/
public function factory($abstract);
/**
* Flush the container of all bindings and resolved instances.
*
* @return void
*/
public function flush();
/**
* Resolve the given type from the container.
*
* @param string $abstract
* @param array $parameters
* @return mixed
*
* @throws \Illuminate\Contracts\Container\BindingResolutionException
*/
public function make($abstract);
public function make($abstract, array $parameters = []);
/**
* Call the given Closure / class@method and inject its dependencies.
@@ -126,15 +176,24 @@ interface Container
/**
* Determine if the given abstract type has been resolved.
*
* @param string $abstract
* @param string $abstract
* @return bool
*/
public function resolved($abstract);
/**
* Register a new before resolving callback.
*
* @param \Closure|string $abstract
* @param \Closure|null $callback
* @return void
*/
public function beforeResolving($abstract, Closure $callback = null);
/**
* Register a new resolving callback.
*
* @param string $abstract
* @param \Closure|string $abstract
* @param \Closure|null $callback
* @return void
*/
@@ -143,7 +202,7 @@ interface Container
/**
* Register a new after resolving callback.
*
* @param string $abstract
* @param \Closure|string $abstract
* @param \Closure|null $callback
* @return void
*/

View File

@@ -15,8 +15,25 @@ interface ContextualBindingBuilder
/**
* Define the implementation for the contextual binding.
*
* @param \Closure|string $implementation
* @param \Closure|string|array $implementation
* @return void
*/
public function give($implementation);
/**
* Define tagged services to be used as the implementation for the contextual binding.
*
* @param string $tag
* @return void
*/
public function giveTagged($tag);
/**
* Specify the configuration item to bind as a primitive.
*
* @param string $key
* @param mixed $default
* @return void
*/
public function giveConfig($key, $default = null);
}

View File

@@ -9,34 +9,38 @@ interface Factory
*
* @param string $name
* @param string $value
* @param int $minutes
* @param string $path
* @param string $domain
* @param bool $secure
* @param bool $httpOnly
* @param int $minutes
* @param string|null $path
* @param string|null $domain
* @param bool|null $secure
* @param bool $httpOnly
* @param bool $raw
* @param string|null $sameSite
* @return \Symfony\Component\HttpFoundation\Cookie
*/
public function make($name, $value, $minutes = 0, $path = null, $domain = null, $secure = false, $httpOnly = true);
public function make($name, $value, $minutes = 0, $path = null, $domain = null, $secure = null, $httpOnly = true, $raw = false, $sameSite = null);
/**
* Create a cookie that lasts "forever" (five years).
*
* @param string $name
* @param string $value
* @param string $path
* @param string $domain
* @param bool $secure
* @param bool $httpOnly
* @param string|null $path
* @param string|null $domain
* @param bool|null $secure
* @param bool $httpOnly
* @param bool $raw
* @param string|null $sameSite
* @return \Symfony\Component\HttpFoundation\Cookie
*/
public function forever($name, $value, $path = null, $domain = null, $secure = false, $httpOnly = true);
public function forever($name, $value, $path = null, $domain = null, $secure = null, $httpOnly = true, $raw = false, $sameSite = null);
/**
* Expire the given cookie.
*
* @param string $name
* @param string $path
* @param string $domain
* @param string|null $path
* @param string|null $domain
* @return \Symfony\Component\HttpFoundation\Cookie
*/
public function forget($name, $path = null, $domain = null);

View File

@@ -16,8 +16,10 @@ interface QueueingFactory extends Factory
* Remove a cookie from the queue.
*
* @param string $name
* @param string|null $path
* @return void
*/
public function unqueue($name);
public function unqueue($name, $path = null);
/**
* Get the cookies which have been queued for the next request.

View File

@@ -0,0 +1,14 @@
<?php
namespace Illuminate\Contracts\Database\Eloquent;
use Illuminate\Contracts\Database\Query\Builder as BaseContract;
/**
* This interface is intentionally empty and exists to improve IDE support.
*
* @mixin \Illuminate\Database\Eloquent\Builder
*/
interface Builder extends BaseContract
{
}

View File

@@ -0,0 +1,15 @@
<?php
namespace Illuminate\Contracts\Database\Eloquent;
interface Castable
{
/**
* Get the name of the caster class to use when casting from / to this cast target.
*
* @param array $arguments
* @return string
* @return string|\Illuminate\Contracts\Database\Eloquent\CastsAttributes|\Illuminate\Contracts\Database\Eloquent\CastsInboundAttributes
*/
public static function castUsing(array $arguments);
}

View File

@@ -0,0 +1,28 @@
<?php
namespace Illuminate\Contracts\Database\Eloquent;
interface CastsAttributes
{
/**
* Transform the attribute from the underlying model values.
*
* @param \Illuminate\Database\Eloquent\Model $model
* @param string $key
* @param mixed $value
* @param array $attributes
* @return mixed
*/
public function get($model, string $key, $value, array $attributes);
/**
* Transform the attribute to its underlying model values.
*
* @param \Illuminate\Database\Eloquent\Model $model
* @param string $key
* @param mixed $value
* @param array $attributes
* @return mixed
*/
public function set($model, string $key, $value, array $attributes);
}

View File

@@ -0,0 +1,17 @@
<?php
namespace Illuminate\Contracts\Database\Eloquent;
interface CastsInboundAttributes
{
/**
* Transform the attribute to its underlying model values.
*
* @param \Illuminate\Database\Eloquent\Model $model
* @param string $key
* @param mixed $value
* @param array $attributes
* @return mixed
*/
public function set($model, string $key, $value, array $attributes);
}

View File

@@ -0,0 +1,28 @@
<?php
namespace Illuminate\Contracts\Database\Eloquent;
interface DeviatesCastableAttributes
{
/**
* Increment the attribute.
*
* @param \Illuminate\Database\Eloquent\Model $model
* @param string $key
* @param mixed $value
* @param array $attributes
* @return mixed
*/
public function increment($model, string $key, $value, array $attributes);
/**
* Decrement the attribute.
*
* @param \Illuminate\Database\Eloquent\Model $model
* @param string $key
* @param mixed $value
* @param array $attributes
* @return mixed
*/
public function decrement($model, string $key, $value, array $attributes);
}

View File

@@ -0,0 +1,17 @@
<?php
namespace Illuminate\Contracts\Database\Eloquent;
interface SerializesCastableAttributes
{
/**
* Serialize the attribute when converting the model to an array.
*
* @param \Illuminate\Database\Eloquent\Model $model
* @param string $key
* @param mixed $value
* @param array $attributes
* @return mixed
*/
public function serialize($model, string $key, $value, array $attributes);
}

View File

@@ -0,0 +1,30 @@
<?php
namespace Illuminate\Contracts\Database\Eloquent;
interface SupportsPartialRelations
{
/**
* Indicate that the relation is a single result of a larger one-to-many relationship.
*
* @param string|null $column
* @param string|\Closure|null $aggregate
* @param string $relation
* @return $this
*/
public function ofMany($column = 'id', $aggregate = 'MAX', $relation = null);
/**
* Determine whether the relationship is a one-of-many relationship.
*
* @return bool
*/
public function isOneOfMany();
/**
* Get the one of many inner join subselect query builder instance.
*
* @return \Illuminate\Database\Eloquent\Builder|void
*/
public function getOneOfManySubQuery();
}

View File

@@ -0,0 +1,8 @@
<?php
namespace Illuminate\Contracts\Database\Events;
interface MigrationEvent
{
//
}

View File

@@ -20,16 +20,54 @@ class ModelIdentifier
*/
public $id;
/**
* The relationships loaded on the model.
*
* @var array
*/
public $relations;
/**
* The connection name of the model.
*
* @var string|null
*/
public $connection;
/**
* The class name of the model collection.
*
* @var string|null
*/
public $collectionClass;
/**
* Create a new model identifier.
*
* @param string $class
* @param mixed $id
* @param array $relations
* @param mixed $connection
* @return void
*/
public function __construct($class, $id)
public function __construct($class, $id, array $relations, $connection)
{
$this->id = $id;
$this->class = $class;
$this->relations = $relations;
$this->connection = $connection;
}
/**
* Specify the collection class that should be used when serializing / restoring collections.
*
* @param string|null $collectionClass
* @return $this
*/
public function useCollectionClass(?string $collectionClass)
{
$this->collectionClass = $collectionClass;
return $this;
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace Illuminate\Contracts\Database\Query;
/**
* This interface is intentionally empty and exists to improve IDE support.
*
* @mixin \Illuminate\Database\Query\Builder
*/
interface Builder
{
}

View File

@@ -2,33 +2,47 @@
namespace Illuminate\Contracts\Debug;
use Exception;
use Throwable;
interface ExceptionHandler
{
/**
* Report or log an exception.
*
* @param \Exception $e
* @param \Throwable $e
* @return void
*
* @throws \Throwable
*/
public function report(Exception $e);
public function report(Throwable $e);
/**
* Determine if the exception should be reported.
*
* @param \Throwable $e
* @return bool
*/
public function shouldReport(Throwable $e);
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $e
* @param \Throwable $e
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Throwable
*/
public function render($request, Exception $e);
public function render($request, Throwable $e);
/**
* Render an exception to the console.
*
* @param \Symfony\Component\Console\Output\OutputInterface $output
* @param \Exception $e
* @param \Throwable $e
* @return void
*
* @internal This method is not meant to be used or overwritten outside the framework.
*/
public function renderForConsole($output, Exception $e);
public function renderForConsole($output, Throwable $e);
}

View File

@@ -7,9 +7,11 @@ interface Encrypter
/**
* Encrypt the given value.
*
* @param string $value
* @param mixed $value
* @param bool $serialize
* @return string
*
* @throws \Illuminate\Contracts\Encryption\EncryptException
*/
public function encrypt($value, $serialize = true);
@@ -18,7 +20,16 @@ interface Encrypter
*
* @param string $payload
* @param bool $unserialize
* @return string
* @return mixed
*
* @throws \Illuminate\Contracts\Encryption\DecryptException
*/
public function decrypt($payload, $unserialize = true);
/**
* Get the encryption key that the encrypter is currently using.
*
* @return string
*/
public function getKey();
}

View File

@@ -0,0 +1,26 @@
<?php
namespace Illuminate\Contracts\Encryption;
interface StringEncrypter
{
/**
* Encrypt a string without serialization.
*
* @param string $value
* @return string
*
* @throws \Illuminate\Contracts\Encryption\EncryptException
*/
public function encryptString($value);
/**
* Decrypt the given string without unserialization.
*
* @param string $payload
* @return string
*
* @throws \Illuminate\Contracts\Encryption\DecryptException
*/
public function decryptString($payload);
}

View File

@@ -7,11 +7,11 @@ interface Dispatcher
/**
* Register an event listener with the dispatcher.
*
* @param string|array $events
* @param mixed $listener
* @param \Closure|string|array $events
* @param \Closure|string|array|null $listener
* @return void
*/
public function listen($events, $listener);
public function listen($events, $listener = null);
/**
* Determine if a given event has listeners.

View File

@@ -7,7 +7,7 @@ interface Factory
/**
* Get a filesystem implementation.
*
* @param string $name
* @param string|null $name
* @return \Illuminate\Contracts\Filesystem\Filesystem
*/
public function disk($name = null);

View File

@@ -30,21 +30,37 @@ interface Filesystem
* Get the contents of a file.
*
* @param string $path
* @return string
*
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
* @return string|null
*/
public function get($path);
/**
* Get a resource to read the file.
*
* @param string $path
* @return resource|null The path resource or null on failure.
*/
public function readStream($path);
/**
* Write the contents of a file.
*
* @param string $path
* @param string|resource $contents
* @param string $visibility
* @param mixed $options
* @return bool
*/
public function put($path, $contents, $visibility = null);
public function put($path, $contents, $options = []);
/**
* Write a new file using a stream.
*
* @param string $path
* @param resource $resource
* @param array $options
* @return bool
*/
public function writeStream($path, $resource, array $options = []);
/**
* Get the visibility for the given path.
@@ -59,7 +75,7 @@ interface Filesystem
*
* @param string $path
* @param string $visibility
* @return void
* @return bool
*/
public function setVisibility($path, $visibility);
@@ -68,7 +84,7 @@ interface Filesystem
*
* @param string $path
* @param string $data
* @return int
* @return bool
*/
public function prepend($path, $data);
@@ -77,7 +93,7 @@ interface Filesystem
*
* @param string $path
* @param string $data
* @return int
* @return bool
*/
public function append($path, $data);

View File

@@ -0,0 +1,10 @@
<?php
namespace Illuminate\Contracts\Filesystem;
use Exception;
class LockTimeoutException extends Exception
{
//
}

View File

@@ -16,16 +16,79 @@ interface Application extends Container
/**
* Get the base path of the Laravel installation.
*
* @param string $path
* @return string
*/
public function basePath();
public function basePath($path = '');
/**
* Get the path to the bootstrap directory.
*
* @param string $path
* @return string
*/
public function bootstrapPath($path = '');
/**
* Get the path to the application configuration files.
*
* @param string $path
* @return string
*/
public function configPath($path = '');
/**
* Get the path to the database directory.
*
* @param string $path
* @return string
*/
public function databasePath($path = '');
/**
* Get the path to the resources directory.
*
* @param string $path
* @return string
*/
public function resourcePath($path = '');
/**
* Get the path to the storage directory.
*
* @param string $path
* @return string
*/
public function storagePath($path = '');
/**
* Get or check the current application environment.
*
* @return string
* @param string|array $environments
* @return string|bool
*/
public function environment();
public function environment(...$environments);
/**
* Determine if the application is running in the console.
*
* @return bool
*/
public function runningInConsole();
/**
* Determine if the application is running unit tests.
*
* @return bool
*/
public function runningUnitTests();
/**
* Get an instance of the maintenance mode manager implementation.
*
* @return \Illuminate\Contracts\Foundation\MaintenanceMode
*/
public function maintenanceMode();
/**
* Determine if the application is currently down for maintenance.
@@ -45,21 +108,28 @@ interface Application extends Container
* Register a service provider with the application.
*
* @param \Illuminate\Support\ServiceProvider|string $provider
* @param array $options
* @param bool $force
* @param bool $force
* @return \Illuminate\Support\ServiceProvider
*/
public function register($provider, $options = [], $force = false);
public function register($provider, $force = false);
/**
* Register a deferred provider and service.
*
* @param string $provider
* @param string $service
* @param string|null $service
* @return void
*/
public function registerDeferredProvider($provider, $service = null);
/**
* Resolve a service provider instance from the class name.
*
* @param string $provider
* @return \Illuminate\Support\ServiceProvider
*/
public function resolveProvider($provider);
/**
* Boot the application's service providers.
*
@@ -70,7 +140,7 @@ interface Application extends Container
/**
* Register a new boot listener.
*
* @param mixed $callback
* @param callable $callback
* @return void
*/
public function booting($callback);
@@ -78,15 +148,84 @@ interface Application extends Container
/**
* Register a new "booted" listener.
*
* @param mixed $callback
* @param callable $callback
* @return void
*/
public function booted($callback);
/**
* Get the path to the cached services.php file.
* Run the given array of bootstrap classes.
*
* @param array $bootstrappers
* @return void
*/
public function bootstrapWith(array $bootstrappers);
/**
* Get the current application locale.
*
* @return string
*/
public function getCachedServicesPath();
public function getLocale();
/**
* Get the application namespace.
*
* @return string
*
* @throws \RuntimeException
*/
public function getNamespace();
/**
* Get the registered service provider instances if any exist.
*
* @param \Illuminate\Support\ServiceProvider|string $provider
* @return array
*/
public function getProviders($provider);
/**
* Determine if the application has been bootstrapped before.
*
* @return bool
*/
public function hasBeenBootstrapped();
/**
* Load and boot all of the remaining deferred providers.
*
* @return void
*/
public function loadDeferredProviders();
/**
* Set the current application locale.
*
* @param string $locale
* @return void
*/
public function setLocale($locale);
/**
* Determine if middleware has been disabled for the application.
*
* @return bool
*/
public function shouldSkipMiddleware();
/**
* Register a terminating callback with the application.
*
* @param callable|string $callback
* @return \Illuminate\Contracts\Foundation\Application
*/
public function terminating($callback);
/**
* Terminate the application.
*
* @return void
*/
public function terminate();
}

View File

@@ -0,0 +1,27 @@
<?php
namespace Illuminate\Contracts\Foundation;
interface CachesConfiguration
{
/**
* Determine if the application configuration is cached.
*
* @return bool
*/
public function configurationIsCached();
/**
* Get the path to the configuration cache file.
*
* @return string
*/
public function getCachedConfigPath();
/**
* Get the path to the cached services.php file.
*
* @return string
*/
public function getCachedServicesPath();
}

View File

@@ -0,0 +1,20 @@
<?php
namespace Illuminate\Contracts\Foundation;
interface CachesRoutes
{
/**
* Determine if the application routes are cached.
*
* @return bool
*/
public function routesAreCached();
/**
* Get the path to the routes cache file.
*
* @return string
*/
public function getCachedRoutesPath();
}

View File

@@ -0,0 +1,14 @@
<?php
namespace Illuminate\Contracts\Foundation;
interface ExceptionRenderer
{
/**
* Renders the given exception as HTML.
*
* @param \Throwable $throwable
* @return string
*/
public function render($throwable);
}

View File

@@ -0,0 +1,35 @@
<?php
namespace Illuminate\Contracts\Foundation;
interface MaintenanceMode
{
/**
* Take the application down for maintenance.
*
* @param array $payload
* @return void
*/
public function activate(array $payload): void;
/**
* Take the application out of maintenance.
*
* @return void
*/
public function deactivate(): void;
/**
* Determine if the application is currently down for maintenance.
*
* @return bool
*/
public function active(): bool;
/**
* Get the data array which was provided when the application was placed into maintenance.
*
* @return array
*/
public function data(): array;
}

View File

@@ -4,11 +4,19 @@ namespace Illuminate\Contracts\Hashing;
interface Hasher
{
/**
* Get information about the given hashed value.
*
* @param string $hashedValue
* @return array
*/
public function info($hashedValue);
/**
* Hash the given value.
*
* @param string $value
* @param array $options
* @param array $options
* @return string
*/
public function make($value, array $options = []);
@@ -18,7 +26,7 @@ interface Hasher
*
* @param string $value
* @param string $hashedValue
* @param array $options
* @param array $options
* @return bool
*/
public function check($value, $hashedValue, array $options = []);
@@ -27,7 +35,7 @@ interface Hasher
* Check if the given hash has been hashed using the given options.
*
* @param string $hashedValue
* @param array $options
* @param array $options
* @return bool
*/
public function needsRehash($hashedValue, array $options = []);

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Taylor Otwell
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -1,98 +0,0 @@
<?php
namespace Illuminate\Contracts\Logging;
interface Log
{
/**
* Log an alert message to the logs.
*
* @param string $message
* @param array $context
* @return void
*/
public function alert($message, array $context = []);
/**
* Log a critical message to the logs.
*
* @param string $message
* @param array $context
* @return void
*/
public function critical($message, array $context = []);
/**
* Log an error message to the logs.
*
* @param string $message
* @param array $context
* @return void
*/
public function error($message, array $context = []);
/**
* Log a warning message to the logs.
*
* @param string $message
* @param array $context
* @return void
*/
public function warning($message, array $context = []);
/**
* Log a notice to the logs.
*
* @param string $message
* @param array $context
* @return void
*/
public function notice($message, array $context = []);
/**
* Log an informational message to the logs.
*
* @param string $message
* @param array $context
* @return void
*/
public function info($message, array $context = []);
/**
* Log a debug message to the logs.
*
* @param string $message
* @param array $context
* @return void
*/
public function debug($message, array $context = []);
/**
* Log a message to the logs.
*
* @param string $level
* @param string $message
* @param array $context
* @return void
*/
public function log($level, $message, array $context = []);
/**
* Register a file log handler.
*
* @param string $path
* @param string $level
* @return void
*/
public function useFiles($path, $level = 'debug');
/**
* Register a daily file log handler.
*
* @param string $path
* @param int $days
* @param string $level
* @return void
*/
public function useDailyFiles($path, $days = 0, $level = 'debug');
}

View File

@@ -0,0 +1,13 @@
<?php
namespace Illuminate\Contracts\Mail;
interface Attachable
{
/**
* Get an attachment instance for this entity.
*
* @return \Illuminate\Mail\Attachment
*/
public function toMailAttachment();
}

View File

@@ -0,0 +1,14 @@
<?php
namespace Illuminate\Contracts\Mail;
interface Factory
{
/**
* Get a mailer instance by name.
*
* @param string|null $name
* @return \Illuminate\Contracts\Mail\Mailer
*/
public function mailer($name = null);
}

View File

@@ -7,23 +7,19 @@ interface MailQueue
/**
* Queue a new e-mail message for sending.
*
* @param string|array $view
* @param array $data
* @param \Closure|string $callback
* @param string $queue
* @param \Illuminate\Contracts\Mail\Mailable|string|array $view
* @param string|null $queue
* @return mixed
*/
public function queue($view, array $data, $callback, $queue = null);
public function queue($view, $queue = null);
/**
* Queue a new e-mail message for sending after (n) seconds.
*
* @param int $delay
* @param string|array $view
* @param array $data
* @param \Closure|string $callback
* @param string $queue
* @param \DateTimeInterface|\DateInterval|int $delay
* @param \Illuminate\Contracts\Mail\Mailable|string|array $view
* @param string|null $queue
* @return mixed
*/
public function later($delay, $view, array $data, $callback, $queue = null);
public function later($delay, $view, $queue = null);
}

View File

@@ -9,25 +9,68 @@ interface Mailable
/**
* Send the message using the given mailer.
*
* @param Mailer $mailer
* @return void
* @param \Illuminate\Contracts\Mail\Factory|\Illuminate\Contracts\Mail\Mailer $mailer
* @return \Illuminate\Mail\SentMessage|null
*/
public function send(Mailer $mailer);
public function send($mailer);
/**
* Queue the given message.
*
* @param Queue $queue
* @param \Illuminate\Contracts\Queue\Factory $queue
* @return mixed
*/
public function queue(Queue $queue);
/**
* Deliver the queued message after the given delay.
* Deliver the queued message after (n) seconds.
*
* @param \DateTime|int $delay
* @param Queue $queue
* @param \DateTimeInterface|\DateInterval|int $delay
* @param \Illuminate\Contracts\Queue\Factory $queue
* @return mixed
*/
public function later($delay, Queue $queue);
/**
* Set the recipients of the message.
*
* @param object|array|string $address
* @param string|null $name
* @return self
*/
public function cc($address, $name = null);
/**
* Set the recipients of the message.
*
* @param object|array|string $address
* @param string|null $name
* @return $this
*/
public function bcc($address, $name = null);
/**
* Set the recipients of the message.
*
* @param object|array|string $address
* @param string|null $name
* @return $this
*/
public function to($address, $name = null);
/**
* Set the locale of the message.
*
* @param string $locale
* @return $this
*/
public function locale($locale);
/**
* Set the name of the mailer that should be used to send the message.
*
* @param string $mailer
* @return $this
*/
public function mailer($mailer);
}

View File

@@ -5,28 +5,37 @@ namespace Illuminate\Contracts\Mail;
interface Mailer
{
/**
* Send a new message when only a raw text part.
* Begin the process of mailing a mailable class instance.
*
* @param mixed $users
* @return \Illuminate\Mail\PendingMail
*/
public function to($users);
/**
* Begin the process of mailing a mailable class instance.
*
* @param mixed $users
* @return \Illuminate\Mail\PendingMail
*/
public function bcc($users);
/**
* Send a new message with only a raw text part.
*
* @param string $text
* @param \Closure|string $callback
* @return int
* @param mixed $callback
* @return \Illuminate\Mail\SentMessage|null
*/
public function raw($text, $callback);
/**
* Send a new message using a view.
*
* @param string|array $view
* @param \Illuminate\Contracts\Mail\Mailable|string|array $view
* @param array $data
* @param \Closure|string $callback
* @return void
* @param \Closure|string|null $callback
* @return \Illuminate\Mail\SentMessage|null
*/
public function send($view, array $data = [], $callback = null);
/**
* Get the array of failed recipients.
*
* @return array
*/
public function failures();
}

View File

@@ -0,0 +1,117 @@
<?php
namespace Illuminate\Contracts\Pagination;
interface CursorPaginator
{
/**
* Get the URL for a given cursor.
*
* @param \Illuminate\Pagination\Cursor|null $cursor
* @return string
*/
public function url($cursor);
/**
* 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);
/**
* Get / set the URL fragment to be appended to URLs.
*
* @param string|null $fragment
* @return $this|string|null
*/
public function fragment($fragment = null);
/**
* Get the URL for the previous page, or null.
*
* @return string|null
*/
public function previousPageUrl();
/**
* The URL for the next page, or null.
*
* @return string|null
*/
public function nextPageUrl();
/**
* Get all of the items being paginated.
*
* @return array
*/
public function items();
/**
* Get the "cursor" of the previous set of items.
*
* @return \Illuminate\Pagination\Cursor|null
*/
public function previousCursor();
/**
* Get the "cursor" of the next set of items.
*
* @return \Illuminate\Pagination\Cursor|null
*/
public function nextCursor();
/**
* Determine how many items are being shown per page.
*
* @return int
*/
public function perPage();
/**
* Get the current cursor being paginated.
*
* @return \Illuminate\Pagination\Cursor|null
*/
public function cursor();
/**
* Determine if there are enough items to split into multiple pages.
*
* @return bool
*/
public function hasPages();
/**
* Get the base path for paginator generated URLs.
*
* @return string|null
*/
public function path();
/**
* Determine if the list of items is empty or not.
*
* @return bool
*/
public function isEmpty();
/**
* Determine if the list of items is not empty.
*
* @return bool
*/
public function isNotEmpty();
/**
* Render the paginator using a given view.
*
* @param string|null $view
* @param array $data
* @return string
*/
public function render($view = null, $data = []);
}

View File

@@ -15,7 +15,7 @@ interface Paginator
/**
* Add a set of query string values to the paginator.
*
* @param array|string $key
* @param array|string|null $key
* @param string|null $value
* @return $this
*/
@@ -25,7 +25,7 @@ interface Paginator
* Get / set the URL fragment to be appended to URLs.
*
* @param string|null $fragment
* @return $this|string
* @return $this|string|null
*/
public function fragment($fragment = null);
@@ -86,12 +86,19 @@ interface Paginator
public function hasPages();
/**
* Determine if there is more items in the data store.
* Determine if there are more items in the data store.
*
* @return bool
*/
public function hasMorePages();
/**
* Get the base path for paginator generated URLs.
*
* @return string|null
*/
public function path();
/**
* Determine if the list of items is empty or not.
*
@@ -99,6 +106,13 @@ interface Paginator
*/
public function isEmpty();
/**
* Determine if the list of items is not empty.
*
* @return bool
*/
public function isNotEmpty();
/**
* Render the paginator using a given view.
*

View File

@@ -0,0 +1,14 @@
<?php
namespace Illuminate\Contracts\Queue;
interface ClearableQueue
{
/**
* Delete all of the jobs from the queue.
*
* @param string $queue
* @return int
*/
public function clear($queue);
}

View File

@@ -7,7 +7,7 @@ interface Factory
/**
* Resolve a queue connection instance.
*
* @param string $name
* @param string|null $name
* @return \Illuminate\Contracts\Queue\Queue
*/
public function connection($name = null);

View File

@@ -4,6 +4,27 @@ namespace Illuminate\Contracts\Queue;
interface Job
{
/**
* Get the UUID of the job.
*
* @return string|null
*/
public function uuid();
/**
* Get the job identifier.
*
* @return string
*/
public function getJobId();
/**
* Get the decoded body of the job.
*
* @return array
*/
public function payload();
/**
* Fire the job.
*
@@ -12,13 +33,20 @@ interface Job
public function fire();
/**
* Release the job back into the queue.
* Release the job back into the queue after (n) seconds.
*
* @param int $delay
* @return mixed
* @param int $delay
* @return void
*/
public function release($delay = 0);
/**
* Determine if the job was released back into the queue.
*
* @return bool
*/
public function isReleased();
/**
* Delete the job from the queue.
*
@@ -48,27 +76,55 @@ interface Job
public function attempts();
/**
* Process an exception that caused the job to fail.
* Determine if the job has been marked as a failure.
*
* @param \Throwable $e
* @return void
* @return bool
*/
public function failed($e);
public function hasFailed();
/**
* The number of times to attempt a job.
* Mark the job as "failed".
*
* @return void
*/
public function markAsFailed();
/**
* Delete the job, call the "failed" method, and raise the failed job event.
*
* @param \Throwable|null $e
* @return void
*/
public function fail($e = null);
/**
* Get the number of times to attempt a job.
*
* @return int|null
*/
public function maxTries();
/**
* The number of seconds the job can run.
* Get the maximum number of exceptions allowed, regardless of attempts.
*
* @return int|null
*/
public function maxExceptions();
/**
* Get the number of seconds the job can run.
*
* @return int|null
*/
public function timeout();
/**
* Get the timestamp indicating when the job should timeout.
*
* @return int|null
*/
public function retryUntil();
/**
* Get the name of the queued job class.
*
@@ -99,10 +155,10 @@ interface Job
*/
public function getQueue();
/**
* Get the raw body string for the job.
*
* @return string
*/
public function getRawBody();
/**
* Get the raw body string for the job.
*
* @return string
*/
public function getRawBody();
}

View File

@@ -13,7 +13,7 @@ interface Monitor
public function looping($callback);
/**
* Register a callback to be executed when a job fails after the maximum amount of retries.
* Register a callback to be executed when a job fails after the maximum number of retries.
*
* @param mixed $callback
* @return void

View File

@@ -7,7 +7,7 @@ interface Queue
/**
* Get the size of the queue.
*
* @param string $queue
* @param string|null $queue
* @return int
*/
public function size($queue = null);
@@ -15,9 +15,9 @@ interface Queue
/**
* Push a new job onto the queue.
*
* @param string $job
* @param mixed $data
* @param string $queue
* @param string|object $job
* @param mixed $data
* @param string|null $queue
* @return mixed
*/
public function push($job, $data = '', $queue = null);
@@ -26,8 +26,8 @@ interface Queue
* Push a new job onto the queue.
*
* @param string $queue
* @param string $job
* @param mixed $data
* @param string|object $job
* @param mixed $data
* @return mixed
*/
public function pushOn($queue, $job, $data = '');
@@ -36,30 +36,30 @@ interface Queue
* Push a raw payload onto the queue.
*
* @param string $payload
* @param string $queue
* @param array $options
* @param string|null $queue
* @param array $options
* @return mixed
*/
public function pushRaw($payload, $queue = null, array $options = []);
/**
* Push a new job onto the queue after a delay.
* Push a new job onto the queue after (n) seconds.
*
* @param \DateTime|int $delay
* @param string $job
* @param mixed $data
* @param string $queue
* @param \DateTimeInterface|\DateInterval|int $delay
* @param string|object $job
* @param mixed $data
* @param string|null $queue
* @return mixed
*/
public function later($delay, $job, $data = '', $queue = null);
/**
* Push a new job onto the queue after a delay.
* Push a new job onto a specific queue after (n) seconds.
*
* @param string $queue
* @param \DateTime|int $delay
* @param string $job
* @param mixed $data
* @param \DateTimeInterface|\DateInterval|int $delay
* @param string|object $job
* @param mixed $data
* @return mixed
*/
public function laterOn($queue, $delay, $job, $data = '');
@@ -67,9 +67,9 @@ interface Queue
/**
* Push an array of jobs onto the queue.
*
* @param array $jobs
* @param mixed $data
* @param string $queue
* @param array $jobs
* @param mixed $data
* @param string|null $queue
* @return mixed
*/
public function bulk($jobs, $data = '', $queue = null);
@@ -77,7 +77,7 @@ interface Queue
/**
* Pop the next job off of the queue.
*
* @param string $queue
* @param string|null $queue
* @return \Illuminate\Contracts\Queue\Job|null
*/
public function pop($queue = null);

View File

@@ -14,7 +14,21 @@ interface QueueableCollection
/**
* Get the identifiers for all of the entities.
*
* @return array
* @return array<int, mixed>
*/
public function getQueueableIds();
/**
* Get the relationships of the entities being queued.
*
* @return array<int, string>
*/
public function getQueueableRelations();
/**
* Get the connection of the entities being queued.
*
* @return string|null
*/
public function getQueueableConnection();
}

View File

@@ -10,4 +10,18 @@ interface QueueableEntity
* @return mixed
*/
public function getQueueableId();
/**
* Get the relationships for the entity.
*
* @return array
*/
public function getQueueableRelations();
/**
* Get the connection of the entity.
*
* @return string|null
*/
public function getQueueableConnection();
}

View File

@@ -0,0 +1,8 @@
<?php
namespace Illuminate\Contracts\Queue;
interface ShouldBeEncrypted
{
//
}

View File

@@ -0,0 +1,8 @@
<?php
namespace Illuminate\Contracts\Queue;
interface ShouldBeUnique
{
//
}

View File

@@ -0,0 +1,8 @@
<?php
namespace Illuminate\Contracts\Queue;
interface ShouldBeUniqueUntilProcessing extends ShouldBeUnique
{
//
}

View File

@@ -0,0 +1,35 @@
<?php
namespace Illuminate\Contracts\Redis;
use Closure;
interface Connection
{
/**
* Subscribe to a set of given channels for messages.
*
* @param array|string $channels
* @param \Closure $callback
* @return void
*/
public function subscribe($channels, Closure $callback);
/**
* Subscribe to a set of given channels with wildcards.
*
* @param array|string $channels
* @param \Closure $callback
* @return void
*/
public function psubscribe($channels, Closure $callback);
/**
* Run a command against the Redis database.
*
* @param string $method
* @param array $parameters
* @return mixed
*/
public function command($method, array $parameters = []);
}

View File

@@ -0,0 +1,25 @@
<?php
namespace Illuminate\Contracts\Redis;
interface Connector
{
/**
* Create a connection to a Redis cluster.
*
* @param array $config
* @param array $options
* @return \Illuminate\Redis\Connections\Connection
*/
public function connect(array $config, array $options);
/**
* Create a connection to a Redis instance.
*
* @param array $config
* @param array $clusterOptions
* @param array $options
* @return \Illuminate\Redis\Connections\Connection
*/
public function connectToCluster(array $config, array $clusterOptions, array $options);
}

View File

@@ -7,7 +7,7 @@ interface Factory
/**
* Get a Redis connection by name.
*
* @param string $name
* @param string|null $name
* @return \Illuminate\Redis\Connections\Connection
*/
public function connection($name = null);

View File

@@ -0,0 +1,10 @@
<?php
namespace Illuminate\Contracts\Redis;
use Exception;
class LimiterTimeoutException extends Exception
{
//
}

View File

@@ -8,7 +8,7 @@ interface Registrar
* Register a new GET route with the router.
*
* @param string $uri
* @param \Closure|array|string $action
* @param array|string|callable $action
* @return \Illuminate\Routing\Route
*/
public function get($uri, $action);
@@ -17,7 +17,7 @@ interface Registrar
* Register a new POST route with the router.
*
* @param string $uri
* @param \Closure|array|string $action
* @param array|string|callable $action
* @return \Illuminate\Routing\Route
*/
public function post($uri, $action);
@@ -26,7 +26,7 @@ interface Registrar
* Register a new PUT route with the router.
*
* @param string $uri
* @param \Closure|array|string $action
* @param array|string|callable $action
* @return \Illuminate\Routing\Route
*/
public function put($uri, $action);
@@ -35,7 +35,7 @@ interface Registrar
* Register a new DELETE route with the router.
*
* @param string $uri
* @param \Closure|array|string $action
* @param array|string|callable $action
* @return \Illuminate\Routing\Route
*/
public function delete($uri, $action);
@@ -44,7 +44,7 @@ interface Registrar
* Register a new PATCH route with the router.
*
* @param string $uri
* @param \Closure|array|string $action
* @param array|string|callable $action
* @return \Illuminate\Routing\Route
*/
public function patch($uri, $action);
@@ -53,7 +53,7 @@ interface Registrar
* Register a new OPTIONS route with the router.
*
* @param string $uri
* @param \Closure|array|string $action
* @param array|string|callable $action
* @return \Illuminate\Routing\Route
*/
public function options($uri, $action);
@@ -63,7 +63,7 @@ interface Registrar
*
* @param array|string $methods
* @param string $uri
* @param \Closure|array|string $action
* @param array|string|callable $action
* @return \Illuminate\Routing\Route
*/
public function match($methods, $uri, $action);
@@ -73,8 +73,8 @@ interface Registrar
*
* @param string $name
* @param string $controller
* @param array $options
* @return void
* @param array $options
* @return \Illuminate\Routing\PendingResourceRegistration
*/
public function resource($name, $controller, array $options = []);

View File

@@ -5,9 +5,9 @@ namespace Illuminate\Contracts\Routing;
interface ResponseFactory
{
/**
* Return a new response from the application.
* Create a new response instance.
*
* @param string $content
* @param array|string $content
* @param int $status
* @param array $headers
* @return \Illuminate\Http\Response
@@ -15,9 +15,18 @@ interface ResponseFactory
public function make($content = '', $status = 200, array $headers = []);
/**
* Return a new view response from the application.
* Create a new "no content" response.
*
* @param string $view
* @param int $status
* @param array $headers
* @return \Illuminate\Http\Response
*/
public function noContent($status = 204, array $headers = []);
/**
* Create a new response for a given view.
*
* @param string|array $view
* @param array $data
* @param int $status
* @param array $headers
@@ -26,9 +35,9 @@ interface ResponseFactory
public function view($view, $data = [], $status = 200, array $headers = []);
/**
* Return a new JSON response from the application.
* Create a new JSON response instance.
*
* @param string|array $data
* @param mixed $data
* @param int $status
* @param array $headers
* @param int $options
@@ -37,10 +46,10 @@ interface ResponseFactory
public function json($data = [], $status = 200, array $headers = [], $options = 0);
/**
* Return a new JSONP response from the application.
* Create a new JSONP response instance.
*
* @param string $callback
* @param string|array $data
* @param mixed $data
* @param int $status
* @param array $headers
* @param int $options
@@ -49,7 +58,7 @@ interface ResponseFactory
public function jsonp($callback, $data = [], $status = 200, array $headers = [], $options = 0);
/**
* Return a new streamed response from the application.
* Create a new streamed response instance.
*
* @param \Closure $callback
* @param int $status
@@ -58,17 +67,37 @@ interface ResponseFactory
*/
public function stream($callback, $status = 200, array $headers = []);
/**
* Create a new streamed response instance as a file download.
*
* @param \Closure $callback
* @param string|null $name
* @param array $headers
* @param string|null $disposition
* @return \Symfony\Component\HttpFoundation\StreamedResponse
*/
public function streamDownload($callback, $name = null, array $headers = [], $disposition = 'attachment');
/**
* Create a new file download response.
*
* @param \SplFileInfo|string $file
* @param string $name
* @param string|null $name
* @param array $headers
* @param string|null $disposition
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
*/
public function download($file, $name = null, array $headers = [], $disposition = 'attachment');
/**
* Return the raw contents of a binary file.
*
* @param \SplFileInfo|string $file
* @param array $headers
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
*/
public function file($file, array $headers = []);
/**
* Create a new redirect response to the given path.
*
@@ -84,7 +113,7 @@ interface ResponseFactory
* Create a new redirect response to a named route.
*
* @param string $route
* @param array $parameters
* @param mixed $parameters
* @param int $status
* @param array $headers
* @return \Illuminate\Http\RedirectResponse
@@ -95,7 +124,7 @@ interface ResponseFactory
* Create a new redirect response to a controller action.
*
* @param string $action
* @param array $parameters
* @param mixed $parameters
* @param int $status
* @param array $headers
* @return \Illuminate\Http\RedirectResponse

View File

@@ -11,12 +11,20 @@ interface UrlGenerator
*/
public function current();
/**
* Get the URL for the previous request.
*
* @param mixed $fallback
* @return string
*/
public function previous($fallback = false);
/**
* Generate an absolute URL to the given path.
*
* @param string $path
* @param mixed $extra
* @param bool $secure
* @param bool|null $secure
* @return string
*/
public function to($path, $extra = [], $secure = null);
@@ -25,7 +33,7 @@ interface UrlGenerator
* Generate a secure, absolute URL to the given path.
*
* @param string $path
* @param array $parameters
* @param array $parameters
* @return string
*/
public function secure($path, $parameters = []);
@@ -34,7 +42,7 @@ interface UrlGenerator
* Generate the URL to an application asset.
*
* @param string $path
* @param bool $secure
* @param bool|null $secure
* @return string
*/
public function asset($path, $secure = null);
@@ -43,7 +51,7 @@ interface UrlGenerator
* Get the URL to a named route.
*
* @param string $name
* @param mixed $parameters
* @param mixed $parameters
* @param bool $absolute
* @return string
*
@@ -54,13 +62,20 @@ interface UrlGenerator
/**
* Get the URL to a controller action.
*
* @param string $action
* @param mixed $parameters
* @param bool $absolute
* @param string|array $action
* @param mixed $parameters
* @param bool $absolute
* @return string
*/
public function action($action, $parameters = [], $absolute = true);
/**
* Get the root controller namespace.
*
* @return string
*/
public function getRootControllerNamespace();
/**
* Set the root controller namespace.
*

View File

@@ -17,4 +17,23 @@ interface UrlRoutable
* @return string
*/
public function getRouteKeyName();
/**
* Retrieve the model for a bound value.
*
* @param mixed $value
* @param string|null $field
* @return \Illuminate\Database\Eloquent\Model|null
*/
public function resolveRouteBinding($value, $field = null);
/**
* Retrieve the child model for a bound value.
*
* @param string $childType
* @param mixed $value
* @param string|null $field
* @return \Illuminate\Database\Eloquent\Model|null
*/
public function resolveChildRouteBinding($childType, $value, $field);
}

View File

@@ -0,0 +1,8 @@
<?php
namespace Illuminate\Contracts\Session\Middleware;
interface AuthenticatesSessions
{
//
}

View File

@@ -11,6 +11,14 @@ interface Session
*/
public function getName();
/**
* Set the name of the session.
*
* @param string $name
* @return void
*/
public function setName($name);
/**
* Get the current session ID.
*
@@ -36,7 +44,7 @@ interface Session
/**
* Save the session data to storage.
*
* @return bool
* @return void
*/
public function save();
@@ -56,7 +64,7 @@ interface Session
public function exists($key);
/**
* Checks if an a key is present and not null.
* Checks if a key is present and not null.
*
* @param string|array $key
* @return bool
@@ -72,11 +80,20 @@ interface Session
*/
public function get($key, $default = null);
/**
* Get the value of a given key and then forget it.
*
* @param string $key
* @param mixed $default
* @return mixed
*/
public function pull($key, $default = null);
/**
* Put a key / value pair or array of key / value pairs in the session.
*
* @param string|array $key
* @param mixed $value
* @param mixed $value
* @return void
*/
public function put($key, $value = null);
@@ -88,6 +105,13 @@ interface Session
*/
public function token();
/**
* Regenerate the CSRF token value.
*
* @return void
*/
public function regenerateToken();
/**
* Remove an item from the session, returning its value.
*
@@ -111,6 +135,21 @@ interface Session
*/
public function flush();
/**
* Flush the session data and regenerate the ID.
*
* @return bool
*/
public function invalidate();
/**
* Generate a new session identifier.
*
* @param bool $destroy
* @return bool
*/
public function regenerate($destroy = false);
/**
* Generate a new session ID for the session.
*

View File

@@ -2,12 +2,16 @@
namespace Illuminate\Contracts\Support;
/**
* @template TKey of array-key
* @template TValue
*/
interface Arrayable
{
/**
* Get the instance as an array.
*
* @return array
* @return array<TKey, TValue>
*/
public function toArray();
}

View File

@@ -0,0 +1,14 @@
<?php
namespace Illuminate\Contracts\Support;
interface CanBeEscapedWhenCastToString
{
/**
* Indicate that the object's string representation should be escaped when __toString is invoked.
*
* @param bool $escape
* @return $this
*/
public function escapeWhenCastingToString($escape = true);
}

View File

@@ -0,0 +1,13 @@
<?php
namespace Illuminate\Contracts\Support;
interface DeferrableProvider
{
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides();
}

View File

@@ -0,0 +1,13 @@
<?php
namespace Illuminate\Contracts\Support;
interface DeferringDisplayableValue
{
/**
* Resolve the displayable value that the class is deferring.
*
* @return \Illuminate\Contracts\Support\Htmlable|string
*/
public function resolveDisplayableValue();
}

View File

@@ -2,7 +2,9 @@
namespace Illuminate\Contracts\Support;
interface MessageBag extends Arrayable
use Countable;
interface MessageBag extends Arrayable, Countable
{
/**
* Get the keys present in the message bag.
@@ -39,8 +41,8 @@ interface MessageBag extends Arrayable
/**
* Get the first message from the bag for a given key.
*
* @param string $key
* @param string $format
* @param string|null $key
* @param string|null $format
* @return string
*/
public function first($key = null, $format = null);
@@ -49,7 +51,7 @@ interface MessageBag extends Arrayable
* Get all of the messages from the bag for a given key.
*
* @param string $key
* @param string $format
* @param string|null $format
* @return array
*/
public function get($key, $format = null);
@@ -57,11 +59,18 @@ interface MessageBag extends Arrayable
/**
* Get all of the messages for every key in the bag.
*
* @param string $format
* @param string|null $format
* @return array
*/
public function all($format = null);
/**
* Get the raw messages in the container.
*
* @return array
*/
public function getMessages();
/**
* Get the default message format.
*
@@ -85,9 +94,9 @@ interface MessageBag extends Arrayable
public function isEmpty();
/**
* Get the number of messages in the container.
* Determine if the message bag has any messages.
*
* @return int
* @return bool
*/
public function count();
public function isNotEmpty();
}

View File

@@ -0,0 +1,14 @@
<?php
namespace Illuminate\Contracts\Support;
interface Responsable
{
/**
* Create an HTTP response that represents the object.
*
* @param \Illuminate\Http\Request $request
* @return \Symfony\Component\HttpFoundation\Response
*/
public function toResponse($request);
}

View File

@@ -0,0 +1,11 @@
<?php
namespace Illuminate\Contracts\Support;
use ArrayAccess;
use IteratorAggregate;
interface ValidatedData extends Arrayable, ArrayAccess, IteratorAggregate
{
//
}

View File

@@ -0,0 +1,13 @@
<?php
namespace Illuminate\Contracts\Translation;
interface HasLocalePreference
{
/**
* Get the preferred locale of the entity.
*
* @return string|null
*/
public function preferredLocale();
}

View File

@@ -0,0 +1,40 @@
<?php
namespace Illuminate\Contracts\Translation;
interface Loader
{
/**
* Load the messages for the given locale.
*
* @param string $locale
* @param string $group
* @param string|null $namespace
* @return array
*/
public function load($locale, $group, $namespace = null);
/**
* Add a new namespace to the loader.
*
* @param string $namespace
* @param string $hint
* @return void
*/
public function addNamespace($namespace, $hint);
/**
* Add a new JSON path to the loader.
*
* @param string $path
* @return void
*/
public function addJsonPath($path);
/**
* Get an array of all the registered namespaces.
*
* @return array
*/
public function namespaces();
}

View File

@@ -8,22 +8,22 @@ interface Translator
* Get the translation for a given key.
*
* @param string $key
* @param array $replace
* @param string $locale
* @param array $replace
* @param string|null $locale
* @return mixed
*/
public function trans($key, array $replace = [], $locale = null);
public function get($key, array $replace = [], $locale = null);
/**
* Get a translation according to an integer value.
*
* @param string $key
* @param int|array|\Countable $number
* @param array $replace
* @param string $locale
* @param \Countable|int|array $number
* @param array $replace
* @param string|null $locale
* @return string
*/
public function transChoice($key, $number, array $replace = [], $locale = null);
public function choice($key, $number, array $replace = [], $locale = null);
/**
* Get the default locale being used.

View File

@@ -0,0 +1,14 @@
<?php
namespace Illuminate\Contracts\Validation;
interface DataAwareRule
{
/**
* Set the data under validation.
*
* @param array $data
* @return $this
*/
public function setData($data);
}

View File

@@ -20,7 +20,7 @@ interface Factory
*
* @param string $rule
* @param \Closure|string $extension
* @param string $message
* @param string|null $message
* @return void
*/
public function extend($rule, $extension, $message = null);
@@ -28,9 +28,9 @@ interface Factory
/**
* Register a custom implicit validator extension.
*
* @param string $rule
* @param string $rule
* @param \Closure|string $extension
* @param string $message
* @param string|null $message
* @return void
*/
public function extendImplicit($rule, $extension, $message = null);
@@ -38,7 +38,7 @@ interface Factory
/**
* Register a custom implicit validator message replacer.
*
* @param string $rule
* @param string $rule
* @param \Closure|string $replacer
* @return void
*/

View File

@@ -0,0 +1,8 @@
<?php
namespace Illuminate\Contracts\Validation;
interface ImplicitRule extends Rule
{
//
}

View File

@@ -0,0 +1,16 @@
<?php
namespace Illuminate\Contracts\Validation;
interface InvokableRule
{
/**
* Run the validation rule.
*
* @param string $attribute
* @param mixed $value
* @param \Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail
* @return void
*/
public function __invoke($attribute, $value, $fail);
}

View File

@@ -0,0 +1,22 @@
<?php
namespace Illuminate\Contracts\Validation;
interface Rule
{
/**
* Determine if the validation rule passes.
*
* @param string $attribute
* @param mixed $value
* @return bool
*/
public function passes($attribute, $value);
/**
* Get the validation error message.
*
* @return string|array
*/
public function message();
}

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