AppFinder
in package
implements
MiddlewareInterface
AppFinder middleware
Purpose:
Scan through the Registry to find the correct app for the route Setup attributes to enable the app-specific router middleware
Requires Attributes:
Sets Attributes:
- app
- prefix
Table of Contents
Interfaces
- MiddlewareInterface
Properties
- $registry : Horde_Registry
- $responseFactory : ResponseFactory
- $streamFactory : StreamFactory
Methods
- __construct() : mixed
- process() : ResponseInterface
- Configure the
- _normalize() : string
- Rebuild a path string to a common form
- identifyApp() : mixed
- Identify the correct app to handle the request
- matchesAppPath() : bool
Properties
$registry
private
Horde_Registry
$registry
$responseFactory
private
ResponseFactory
$responseFactory
$streamFactory
private
StreamFactory
$streamFactory
Methods
__construct()
public
__construct(Horde_Registry $registry, ResponseFactory $responseFactory, StreamFactory $streamFactory) : mixed
Parameters
- $registry : Horde_Registry
- $responseFactory : ResponseFactory
- $streamFactory : StreamFactory
process()
Configure the
public
process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
If no found app fits, return the NotFound response.
Initialize the found app. Load the route definition file for the found app.
Initialize the routes mapper with the app's base path and match
Finally check authentication if required
Parameters
- $request : ServerRequestInterface
-
The incoming request
- $handler : RequestHandlerInterface
-
The request handler to configure
Return values
ResponseInterface —The response from
_normalize()
Rebuild a path string to a common form
protected
_normalize(string $path) : string
Remove any . and .. levels and parts made irrelevant by them
Parameters
- $path : string
-
The input path
Return values
string —The normalized path
identifyApp()
Identify the correct app to handle the request
protected
identifyApp(ServerRequestInterface $request, Horde_Registry $registry) : mixed
This needs to cover a lot of cases
- app lives below horde (pear default)
- app lives besides or independent of horde (composer default)
- app is horde
- app lives in document root (https://webmail.foo.org is imp)
- app lives below horde but document root is another app eg https://webmail.foo.org where / is imp, /horde is horde, /horde/turba is turba
Parameters
- $request : ServerRequestInterface
-
Request object
- $registry : Horde_Registry
-
The Horde Registry
matchesAppPath()
protected
matchesAppPath(string $appPath, string $requestPath) : bool
Parameters
- $appPath : string
- $requestPath : string