Get the text for a given status code.
public getReasonPhrase ( string $statusCode ) : string | ||
$statusCode | string | http status code |
return | string | Returns text for the given status code |
/** * Sends fail response * @param $data * @author Oluwarotimi Akintewe <*****@*****.**> * @author Adegoke Obasa <*****@*****.**> * @param int $httpStatusCode * @return array */ public function sendFailResponse($data, $httpStatusCode = 500) { \Yii::$app->response->format = Response::FORMAT_JSON; \Yii::$app->response->setStatusCode($httpStatusCode, $this->httpStatuses->getReasonPhrase($httpStatusCode)); return ['status' => 'fail', 'data' => $data]; }