Oihana PHP System

PrepareLang uses trait:short

Table of Contents

Constants

LANGUAGES  = 'languages'
Key used to initialize languages in an array or container.

Properties

$languages  : array<string|int, string>
Array of valid language codes supported by the controller.

Methods

initializeLanguages()  : static
Initialize the internal `$languages` property from an array or a PSR-11 container.
prepareLang()  : string|null

Constants

LANGUAGES

Key used to initialize languages in an array or container.

public mixed LANGUAGES = 'languages'

Properties

$languages

Array of valid language codes supported by the controller.

public array<string|int, string> $languages = []

Methods

initializeLanguages()

Initialize the internal `$languages` property from an array or a PSR-11 container.

public initializeLanguages([array<string|int, mixed> $init = [] ][, ContainerInterface|null $container = null ]) : static

This method first checks the provided $init array for a key 'languages'. If not found, it optionally checks a PSR-11 container for fallback configuration.

Parameters
$init : array<string|int, mixed> = []

Optional array with key 'languages' containing supported language codes.

$container : ContainerInterface|null = null

Optional PSR-11 container for fallback configuration.

Tags
throws
ContainerExceptionInterface

If the container fails to retrieve the languages.

throws
NotFoundExceptionInterface

If the requested languages key is not found in the container.

Return values
static

Returns the current instance for method chaining.

prepareLang()

protected prepareLang(ServerRequestInterface|null $request[, array<string|int, mixed> $args = [] ][, array<string|int, mixed>|null &$params = null ]) : string|null
Parameters
$request : ServerRequestInterface|null
$args : array<string|int, mixed> = []
$params : array<string|int, mixed>|null = null
Return values
string|null

        
On this page

Search results