Detailed Description
Response holds the response values that are used as output from Controller instances.
It is typically instantiated by the ActionMapper instance and filled during Controller execution.
Definition at line 20 of file Response.php.
Public Member Functions | |
setRequest (Request $request) | |
getRequest () | |
setCacheId ($cacheId) | |
getCacheId () | |
setCacheLifetime ($seconds) | |
getCacheLifetime () | |
isCached () | |
getCacheDate () | |
setStatus ($status) | |
getStatus () | |
setFile ($filename, $isDownload, $content='', $type='') | |
getFile () | |
setDocument (ResponseDocument $document) | |
getDocument () | |
Member Function Documentation
◆ setRequest()
setRequest | ( | Request | $request | ) |
Set the Request instance belonging to the response and vice versa.
- Parameters
-
$request Request
Implemented in DefaultResponse.
◆ getRequest()
getRequest | ( | ) |
◆ setCacheId()
setCacheId | ( | $cacheId | ) |
Set a string value that uniquely identifies the request data resulting in the current response.
If this value is not null, it will be used to compare two requests and return cached responses based on the result. Set a value of null to prevent caching.
- Parameters
-
$cacheId
Implemented in DefaultResponse.
◆ getCacheId()
getCacheId | ( | ) |
◆ setCacheLifetime()
setCacheLifetime | ( | $seconds | ) |
Set the lifetime of a cached response.
After this time previously cached response is dicarded. Set a value of -1 for an infinite lifetime.
- Parameters
-
$seconds
Implemented in DefaultResponse.
◆ getCacheLifetime()
getCacheLifetime | ( | ) |
Get the lifetime of a cached response.
A value of null means an infinite lifetime.
- Returns
- Integer
Implemented in DefaultResponse.
◆ isCached()
isCached | ( | ) |
Check if the response is cached.
Controllers may use the result to determine if the controller logic must be executed or not.
- Returns
- Boolean
Implemented in DefaultResponse.
◆ getCacheDate()
getCacheDate | ( | ) |
Get the caching date, if the response is cached.
- Returns
- DateTime or null, if not cached
Implemented in DefaultResponse.
◆ setStatus()
setStatus | ( | $status | ) |
Set the response HTTP status code.
- Parameters
-
$status The HTTP status code
Implemented in DefaultResponse.
◆ getStatus()
getStatus | ( | ) |
◆ setFile()
setFile | ( | $filename, | |
$isDownload, | |||
$content = '' , |
|||
$type = '' |
|||
) |
Set a file as response.
- Deprecated:
- Use setDocument() instead
- Parameters
-
$filename The name of the file, must be a real file, if no content is provided $isDownload Boolean, indicating whether the file should be return as download or not $content File content, if in-memory only (optional) $type File mime type, if in-memory only (optional)
Implemented in DefaultResponse.
◆ getFile()
getFile | ( | ) |
Get the file download.
- Deprecated:
- Use getDocument() instead
- Returns
- Array with keys 'isDownload', 'filename', 'content' and 'type' or null
Implemented in DefaultResponse.
◆ setDocument()
setDocument | ( | ResponseDocument | $document | ) |
Set a response document.
- Parameters
-
$document The ResponseDocument instance
Implemented in DefaultResponse.
◆ getDocument()
getDocument | ( | ) |