\Piko\Module

Module is the base class for classes containing module logic.

Properties summary

Name Description
public $controllerMap Mapping from controller ID to controller class.
public $controllerNamespace Base name space of module's controllers. Default t…
public $id The module identifier.
public $layout The name of the module's layout file or false
to d…  
public $layoutPath The layout directory of the module.
public $modules Sub modules configuration
protected $application  
private $basePath The root directory of the module.

Inherited Properties

Name Description
protected $eventDispatcher  
protected $listenerProvider  

Methods summary

Name Description
public __construct Constructor
public getApplication  
public getBasePath Returns the root directory of the module.
public getModule Get a sub module of this module
public handle {@inheritDoc}
public setApplication  
protected createController Create a controller

Inherited Methods

Name Description
public on Registers an event listener.
public trigger Trigger an event that may be listen by event liste…

Properties

public $controllerMap : string[]

Mapping from controller ID to controller class.

public $controllerNamespace : string

Base name space of module’s controllers. Default to {baseModuleNameSpace}\controllers

public $id : string

The module identifier.

public $layout : string|false

The name of the module’s layout file or false to deactivate the layout rendering

public $layoutPath : string|null

The layout directory of the module.

public $modules : (\Piko\Module|class-string|array<class-string,mixed>)[]

Sub modules configuration

protected $application : \Piko\ModularApplication

private $basePath : string

The root directory of the module.


Methods

public __construct(): mixed

public  __construct(array&lt;string,mixed&gt;  $config = []): mixed

Parameters

$config (default: []):

Return:

mixed


public getApplication(): \Piko\ModularApplication

public  getApplication(): \Piko\ModularApplication

Return:

\Piko\ModularApplication


public getBasePath(): string

public  getBasePath(): string

Returns the root directory of the module.

Return:

string the root directory of the module.


public getModule(): \Piko\Module

public  getModule(string  $moduleId): \Piko\Module

Get a sub module of this module

Parameters

$moduleId : The module identifier

throws \RuntimeExceptionIf module not found

Return:

\Piko\Module


public handle(): \Psr\Http\Message\ResponseInterface

public  handle(\Psr\Http\Message\ServerRequestInterface  $request): \Psr\Http\Message\ResponseInterface

{@inheritDoc}

Parameters

$request :

see \Psr\Http\Server\RequestHandlerInterface::handle()

Return:

\Psr\Http\Message\ResponseInterface


public setApplication(): void

public  setApplication(\Piko\ModularApplication  $app): void

Parameters

$app :


protected createController(): \Piko\Controller

protected  createController(string  $controllerId): \Piko\Controller

Create a controller

Parameters

$controllerId : A controller ID

Return:

\Piko\Controller