Response Trait
Additional methods to make a PSR-7 Response class compliant with the framework's own ResponseInterface.
Methods | ||
---|---|---|
public
|
setStatusCode(int $code, string $reason = ''): $this
|
# |
public
|
setDate(DateTime $date): $this
|
# |
public
|
setLink(PagerInterface $pager): $this
|
# |
public
|
setContentType(string $mime, string $charset = 'UTF-8'): $this
|
# |
public
|
setJSON(array|string $body, bool $unencoded = false): $this
|
# |
public
|
getJSON(): string|null
|
# |
public
|
setXML(array|string $body): $this
|
# |
public
|
getXML(): bool|string|null
|
# |
protected
|
formatBody(array|string $body, string $format): mixed
|
# |
public
|
noCache(): $this
|
# |
public
|
setCache(array $options = []): $this
|
# |
public
|
setLastModified(DateTime|string $date): $this
|
# |
public
|
send(): $this
|
# |
public
|
sendHeaders(): $this
|
# |
public
|
sendBody(): $this
|
# |
public
|
redirect(string $uri, string $method = 'auto', int $code = null): $this
|
# |
public
|
setCookie(
array|Cookie|string $name,
string $value = '',
string $expire = '',
string $domain = '',
string $path = '/',
string $prefix = '',
bool|null $secure = null,
bool|null $httponly = null,
string|null $samesite = null,
): $this
|
# |
public
|
getCookieStore(): CookieStore
|
# |
public
|
hasCookie(string $name, ?string $value = null, string $prefix = ''): bool
|
# |
public
|
getCookie(?string $name = null, string $prefix = ''): Cookie|Cookie[]|null
|
# |
public
|
deleteCookie(string $name = '', string $domain = '', string $path = '/', string $prefix = ''): $this
|
# |
public
|
getCookies(): Cookie[]
|
# |
protected
|
sendCookies()
|
# |
public
|
download(string $filename = '', string|null $data = '', bool $setMime = false): DownloadResponse|null
|
# |
public
|
getCSP(): ContentSecurityPolicy
|
# |
Properties | |||
---|---|---|---|
protected
|
bool
|
$CSPEnabled = false
|
# |
public
|
ContentSecurityPolicy
|
$CSP
|
# |
protected
|
CookieStore
|
$cookieStore
|
# |
protected
|
string
|
$cookiePrefix = ''
|
# |
protected
|
string
|
$cookieDomain = ''
|
# |
protected
|
string
|
$cookiePath = '/'
|
# |
protected
|
bool
|
$cookieSecure = false
|
# |
protected
|
bool
|
$cookieHTTPOnly = false
|
# |
protected
|
string
|
$cookieSameSite = Cookie::SAMESITE_LAX
|
# |
protected
|
array
|
$cookies = []
|
# |
protected
|
string
|
$bodyFormat = 'html'
|
# |
public
|
array
|
$statusCodes
|
# |