Exemple #1
0
function serve405ErrorPage(Response $response)
{
    $response->setStatus(404);
    return new TextBody('Method not allowed for route.');
}
Exemple #2
0
/**
 * @param Body $body
 * @param Request $request
 * @param Response $response
 * @param HeadersSet $headerSet
 * @return int
 * @throws TierException
 */
function sendBodyResponse(Body $body, Request $request, Response $response, HeadersSet $headerSet)
{
    $headerSet = $headerSet->getAllHeaders();
    foreach ($headerSet as $field => $values) {
        foreach ($values as $value) {
            $response->setHeader($field, $value);
        }
    }
    $response->setBody($body);
    \Tier\sendResponse($request, $response);
    return \Tier\TierApp::PROCESS_END;
}