PresenterContext
in package
Table of Contents
Properties
- $presenter : Presenter
- $siteBaseUrl : SiteBaseUrl|null
Methods
- __construct() : mixed
- The base URL is optional only for tests that build the context without DI; without it the request URL is kept.
- absoluteLink() : string
- Builds an absolute link for use outside a request (e-mail, notification).
- absolutize() : string
- Converts a ready absolute URL (`LinkGenerator`, `getBaseUrl()`) to the website address from settings.
- getPresenter() : Presenter
- hasPresenter() : bool
- Returns false outside a presenter run (CLI, cron); links cannot be built then.
- setPresenter() : void
Properties
$presenter
private
Presenter
$presenter
$siteBaseUrl read-only
private
SiteBaseUrl|null
$siteBaseUrl
= null
Methods
__construct()
The base URL is optional only for tests that build the context without DI; without it the request URL is kept.
public
__construct([SiteBaseUrl|null $siteBaseUrl = null ]) : mixed
Parameters
- $siteBaseUrl : SiteBaseUrl|null = null
absoluteLink()
Builds an absolute link for use outside a request (e-mail, notification).
public
absoluteLink(string $destination[, array<string, mixed> $args = [] ]) : string
It is the current presenter's link('//…') converted to the website address from settings
(SiteBaseUrl). $destination is written without the leading //
(:Front:Bazaar:Advert:detail).
Parameters
- $destination : string
- $args : array<string, mixed> = []
Return values
stringabsolutize()
Converts a ready absolute URL (`LinkGenerator`, `getBaseUrl()`) to the website address from settings.
public
absolutize(string $url) : string
Parameters
- $url : string
Return values
stringgetPresenter()
public
getPresenter() : Presenter
Return values
PresenterhasPresenter()
Returns false outside a presenter run (CLI, cron); links cannot be built then.
public
hasPresenter() : bool
Return values
boolsetPresenter()
public
setPresenter(Presenter $presenter) : void
Parameters
- $presenter : Presenter