This commit is contained in:
2024-07-03 14:41:15 +03:00
commit ec69208f05
1892 changed files with 181728 additions and 0 deletions

View File

@ -0,0 +1,23 @@
<?php
namespace Illuminate\Contracts\Routing;
interface BindingRegistrar
{
/**
* Add a new route parameter binder.
*
* @param string $key
* @param string|callable $binder
* @return void
*/
public function bind($key, $binder);
/**
* Get the binding callback for a given binding.
*
* @param string $key
* @return \Closure
*/
public function getBindingCallback($key);
}

View File

@ -0,0 +1,105 @@
<?php
namespace Illuminate\Contracts\Routing;
interface Registrar
{
/**
* Register a new GET route with the router.
*
* @param string $uri
* @param array|string|callable $action
* @return \Illuminate\Routing\Route
*/
public function get($uri, $action);
/**
* Register a new POST route with the router.
*
* @param string $uri
* @param array|string|callable $action
* @return \Illuminate\Routing\Route
*/
public function post($uri, $action);
/**
* Register a new PUT route with the router.
*
* @param string $uri
* @param array|string|callable $action
* @return \Illuminate\Routing\Route
*/
public function put($uri, $action);
/**
* Register a new DELETE route with the router.
*
* @param string $uri
* @param array|string|callable $action
* @return \Illuminate\Routing\Route
*/
public function delete($uri, $action);
/**
* Register a new PATCH route with the router.
*
* @param string $uri
* @param array|string|callable $action
* @return \Illuminate\Routing\Route
*/
public function patch($uri, $action);
/**
* Register a new OPTIONS route with the router.
*
* @param string $uri
* @param array|string|callable $action
* @return \Illuminate\Routing\Route
*/
public function options($uri, $action);
/**
* Register a new route with the given verbs.
*
* @param array|string $methods
* @param string $uri
* @param array|string|callable $action
* @return \Illuminate\Routing\Route
*/
public function match($methods, $uri, $action);
/**
* Route a resource to a controller.
*
* @param string $name
* @param string $controller
* @param array $options
* @return \Illuminate\Routing\PendingResourceRegistration
*/
public function resource($name, $controller, array $options = []);
/**
* Create a route group with shared attributes.
*
* @param array $attributes
* @param \Closure|string $routes
* @return void
*/
public function group(array $attributes, $routes);
/**
* Substitute the route bindings onto the route.
*
* @param \Illuminate\Routing\Route $route
* @return \Illuminate\Routing\Route
*/
public function substituteBindings($route);
/**
* Substitute the implicit Eloquent model bindings for the route.
*
* @param \Illuminate\Routing\Route $route
* @return void
*/
public function substituteImplicitBindings($route);
}

View File

@ -0,0 +1,155 @@
<?php
namespace Illuminate\Contracts\Routing;
interface ResponseFactory
{
/**
* Create a new response instance.
*
* @param string $content
* @param int $status
* @param array $headers
* @return \Illuminate\Http\Response
*/
public function make($content = '', $status = 200, array $headers = []);
/**
* Create a new "no content" response.
*
* @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
* @return \Illuminate\Http\Response
*/
public function view($view, $data = [], $status = 200, array $headers = []);
/**
* Create a new JSON response instance.
*
* @param mixed $data
* @param int $status
* @param array $headers
* @param int $options
* @return \Illuminate\Http\JsonResponse
*/
public function json($data = [], $status = 200, array $headers = [], $options = 0);
/**
* Create a new JSONP response instance.
*
* @param string $callback
* @param mixed $data
* @param int $status
* @param array $headers
* @param int $options
* @return \Illuminate\Http\JsonResponse
*/
public function jsonp($callback, $data = [], $status = 200, array $headers = [], $options = 0);
/**
* Create a new streamed response instance.
*
* @param \Closure $callback
* @param int $status
* @param array $headers
* @return \Symfony\Component\HttpFoundation\StreamedResponse
*/
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|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.
*
* @param string $path
* @param int $status
* @param array $headers
* @param bool|null $secure
* @return \Illuminate\Http\RedirectResponse
*/
public function redirectTo($path, $status = 302, $headers = [], $secure = null);
/**
* Create a new redirect response to a named route.
*
* @param string $route
* @param mixed $parameters
* @param int $status
* @param array $headers
* @return \Illuminate\Http\RedirectResponse
*/
public function redirectToRoute($route, $parameters = [], $status = 302, $headers = []);
/**
* Create a new redirect response to a controller action.
*
* @param string $action
* @param mixed $parameters
* @param int $status
* @param array $headers
* @return \Illuminate\Http\RedirectResponse
*/
public function redirectToAction($action, $parameters = [], $status = 302, $headers = []);
/**
* Create a new redirect response, while putting the current URL in the session.
*
* @param string $path
* @param int $status
* @param array $headers
* @param bool|null $secure
* @return \Illuminate\Http\RedirectResponse
*/
public function redirectGuest($path, $status = 302, $headers = [], $secure = null);
/**
* Create a new redirect response to the previously intended location.
*
* @param string $default
* @param int $status
* @param array $headers
* @param bool|null $secure
* @return \Illuminate\Http\RedirectResponse
*/
public function redirectToIntended($default = '/', $status = 302, $headers = [], $secure = null);
}

View File

@ -0,0 +1,79 @@
<?php
namespace Illuminate\Contracts\Routing;
interface UrlGenerator
{
/**
* Get the current URL for the request.
*
* @return string
*/
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|null $secure
* @return string
*/
public function to($path, $extra = [], $secure = null);
/**
* Generate a secure, absolute URL to the given path.
*
* @param string $path
* @param array $parameters
* @return string
*/
public function secure($path, $parameters = []);
/**
* Generate the URL to an application asset.
*
* @param string $path
* @param bool|null $secure
* @return string
*/
public function asset($path, $secure = null);
/**
* Get the URL to a named route.
*
* @param string $name
* @param mixed $parameters
* @param bool $absolute
* @return string
*
* @throws \InvalidArgumentException
*/
public function route($name, $parameters = [], $absolute = true);
/**
* Get the URL to a controller action.
*
* @param string|array $action
* @param mixed $parameters
* @param bool $absolute
* @return string
*/
public function action($action, $parameters = [], $absolute = true);
/**
* Set the root controller namespace.
*
* @param string $rootNamespace
* @return $this
*/
public function setRootControllerNamespace($rootNamespace);
}

View File

@ -0,0 +1,39 @@
<?php
namespace Illuminate\Contracts\Routing;
interface UrlRoutable
{
/**
* Get the value of the model's route key.
*
* @return mixed
*/
public function getRouteKey();
/**
* Get the route key for the model.
*
* @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);
}