TemplateGuesser
in package
The TemplateGuesser class handles the guessing of template name based on controller.
Tags
Table of Contents
- $controllerPatterns : array<string|int, string>
- $kernel : KernelInterface
- __construct() : mixed
- guessTemplateName() : string
- Guesses and returns the template name to render based on the controller and action names.
- getBundleForClass() : string|null
- Returns the bundle name in which the given class name is located.
- getRealClass() : string
Properties
$controllerPatterns
private
array<string|int, string>
$controllerPatterns
$kernel
private
KernelInterface
$kernel
Methods
__construct()
public
__construct(KernelInterface $kernel[, array<string|int, string> $controllerPatterns = [] ]) : mixed
Parameters
- $kernel : KernelInterface
- $controllerPatterns : array<string|int, string> = []
-
Regexps extracting the controller name from its FQN
Return values
mixed —guessTemplateName()
Guesses and returns the template name to render based on the controller and action names.
public
guessTemplateName(callable $controller, Request $request) : string
Parameters
- $controller : callable
-
An array storing the controller object and action method
- $request : Request
Tags
Return values
string —The template name
getBundleForClass()
Returns the bundle name in which the given class name is located.
private
getBundleForClass(string $class) : string|null
Parameters
- $class : string
-
A fully qualified controller class name
Return values
string|null —$bundle A bundle name
getRealClass()
private
static getRealClass(string $class) : string
Parameters
- $class : string