Cgi
extends AbstractFactory
in package
implements
CgiInterface
Simple CGI implementation.
Table of Contents
Interfaces
- CgiInterface
- Describes CGI interface.
Properties
- $baseApp : string
- $baseResource : string
- $baseView : string
- $environment : string
- $splAutoload : array<string, string>
- $baseCgi : string
- $baseRoute : string
- $errorHandler : callable
- $middlewares : array<string|int, MiddlewareInterface>
- $uri : UriInterface
Methods
- __construct() : mixed
- addMiddleware() : static
- Return an instance with added middleware scenarios.
- run() : void
- Run application.
- withBaseApp() : static
- Return an instance with provided base application path.
- withBaseCgi() : static
- Return an instance with provided base cgi path.
- withBaseResource() : static
- Return an instance with provided base resource path.
- withBaseRoute() : static
- Return an instance with provided base route path.
- withBaseUrl() : static
- Return an instance with provided base url.
- withBaseView() : static
- Return an instance with provided base view path.
- withEnvironment() : static
- Return an instance with provided environment filename.
- withErrorHandler() : static
- Return an instance with provided error handler.
- withSplAutoload() : static
- Return an instance with provided SPL Autoload.
- applyResponse() : static
- errorHandlerFactory() : callable
- getDispatcher() : Dispatcher
- getRouteResponse() : ResponseInterface
Properties
$baseApp
protected
string
$baseApp
= ''
$baseResource
protected
string
$baseResource
= ''
$baseView
protected
string
$baseView
= ''
$environment
protected
string
$environment
= ''
$splAutoload
protected
array<string, string>
$splAutoload
= []
$baseCgi
private
string
$baseCgi
= ''
$baseRoute
private
string
$baseRoute
= ''
$errorHandler
private
callable
$errorHandler
= null
$middlewares
private
array<string|int, MiddlewareInterface>
$middlewares
= []
$uri
private
UriInterface
$uri
= null
Methods
__construct()
public
__construct([array<string, mixed> $config = [] ]) : mixed
Parameters
- $config : array<string, mixed> = []
-
The configuration.
addMiddleware()
Return an instance with added middleware scenarios.
public
addMiddleware(mixed $middleware) : static
Parameters
- $middleware : mixed
-
The middleware scenarios.
Tags
Return values
staticrun()
Run application.
public
abstract run([array<string, mixed> $config = [] ]) : void
Parameters
- $config : array<string, mixed> = []
-
The configuration.
Tags
withBaseApp()
Return an instance with provided base application path.
public
withBaseApp(string $path) : static
Parameters
- $path : string
-
The application path.
Tags
Return values
staticwithBaseCgi()
Return an instance with provided base cgi path.
public
withBaseCgi(string $path) : static
Parameters
- $path : string
-
The base path.
Tags
Return values
staticwithBaseResource()
Return an instance with provided base resource path.
public
withBaseResource(string $path) : static
Parameters
- $path : string
-
The base path.
Tags
Return values
staticwithBaseRoute()
Return an instance with provided base route path.
public
withBaseRoute(string $path) : static
Parameters
- $path : string
-
The base path.
Tags
Return values
staticwithBaseUrl()
Return an instance with provided base url.
public
withBaseUrl(string $url) : static
Parameters
- $url : string
-
The base url.
Tags
Return values
staticwithBaseView()
Return an instance with provided base view path.
public
withBaseView(string $path) : static
Parameters
- $path : string
-
The base path.
Tags
Return values
staticwithEnvironment()
Return an instance with provided environment filename.
public
withEnvironment(string $filename) : static
Parameters
- $filename : string
-
The environment filename.
Tags
Return values
staticwithErrorHandler()
Return an instance with provided error handler.
public
withErrorHandler(callable $errorHandler) : static
Parameters
- $errorHandler : callable
-
The error handler.
Return values
staticwithSplAutoload()
Return an instance with provided SPL Autoload.
public
withSplAutoload(string $namespace, string $path) : static
Parameters
- $namespace : string
-
The namespace.
- $path : string
-
The path.
Tags
Return values
staticapplyResponse()
private
applyResponse(ResponseInterface $response) : static
Parameters
- $response : ResponseInterface
Return values
staticerrorHandlerFactory()
private
errorHandlerFactory() : callable
Return values
callablegetDispatcher()
private
getDispatcher() : Dispatcher
Return values
DispatchergetRouteResponse()
private
getRouteResponse(array<string|int, mixed> $routeInfo, string $requestMethod, string $requestUri) : ResponseInterface
Parameters
- $routeInfo : array<string|int, mixed>
- $requestMethod : string
- $requestUri : string