ControllerMethodReader
in package
FinalYes
Reads a controller and returns a list of auto route listing.
Tags
Table of Contents
Properties
- $httpMethods : array<string|int, mixed>
- $namespace : string
- $translateURIDashes : bool
- $translateUriToCamelCase : bool
Methods
- __construct() : mixed
- read() : array<int, array<string, array<string|int, mixed>|string>>
- Returns found route info in the controller.
- convertClassNameToUri() : string
- convertMethodNameToUri() : string
- getParameters() : array<string|int, mixed>
- getRouteForDefaultController() : array<int, array<string|int, mixed>>
- Gets a route for the default controller.
- translateToUri() : string
Properties
$httpMethods read-only
private
array<string|int, mixed>
$httpMethods
$namespace read-only
private
string
$namespace
$translateURIDashes read-only
private
bool
$translateURIDashes
$translateUriToCamelCase read-only
private
bool
$translateUriToCamelCase
Methods
__construct()
public
__construct(string $namespace, array<int, string> $httpMethods) : mixed
Parameters
- $namespace : string
-
the default namespace
- $httpMethods : array<int, string>
read()
Returns found route info in the controller.
public
read(class-string $class[, string $defaultController = 'Home' ][, string $defaultMethod = 'index' ]) : array<int, array<string, array<string|int, mixed>|string>>
Parameters
- $class : class-string
- $defaultController : string = 'Home'
- $defaultMethod : string = 'index'
Return values
array<int, array<string, array<string|int, mixed>|string>>convertClassNameToUri()
private
convertClassNameToUri(class-string $classname) : string
Parameters
- $classname : class-string
Return values
string —URI path part from the folder(s) and controller
convertMethodNameToUri()
private
convertMethodNameToUri(string $httpVerb, string $methodName) : string
Parameters
- $httpVerb : string
- $methodName : string
Return values
string —URI path part from the method
getParameters()
private
getParameters(ReflectionMethod $method) : array<string|int, mixed>
Parameters
- $method : ReflectionMethod
Return values
array<string|int, mixed>getRouteForDefaultController()
Gets a route for the default controller.
private
getRouteForDefaultController(string $classShortname, string $defaultController, string $uriByClass, string $classname, string $methodName, string $httpVerb, ReflectionMethod $method) : array<int, array<string|int, mixed>>
Parameters
- $classShortname : string
- $defaultController : string
- $uriByClass : string
- $classname : string
- $methodName : string
- $httpVerb : string
- $method : ReflectionMethod
Return values
array<int, array<string|int, mixed>>translateToUri()
private
translateToUri(string $string) : string
Parameters
- $string : string
-
classname or method name