Skip to content

Commit

Permalink
Merge pull request #26 from saverio/master
Browse files Browse the repository at this point in the history
Changed AbstractResponse class to leverage late static binding.
  • Loading branch information
maximebeaudoin committed Jan 28, 2016
2 parents 014db49 + 2e094b6 commit 936880f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/AbstractResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public function withError($message, $errorCode, array $headers = [])
*/
public function errorForbidden($message = 'Forbidden', array $headers = [])
{
return $this->setStatusCode(403)->withError($message, self::CODE_FORBIDDEN, $headers);
return $this->setStatusCode(403)->withError($message, static::CODE_FORBIDDEN, $headers);
}

/**
Expand All @@ -191,7 +191,7 @@ public function errorForbidden($message = 'Forbidden', array $headers = [])
*/
public function errorInternalError($message = 'Internal Error', array $headers = [])
{
return $this->setStatusCode(500)->withError($message, self::CODE_INTERNAL_ERROR, $headers);
return $this->setStatusCode(500)->withError($message, static::CODE_INTERNAL_ERROR, $headers);
}

/**
Expand All @@ -203,7 +203,7 @@ public function errorInternalError($message = 'Internal Error', array $headers =
*/
public function errorNotFound($message = 'Resource Not Found', array $headers = [])
{
return $this->setStatusCode(404)->withError($message, self::CODE_NOT_FOUND, $headers);
return $this->setStatusCode(404)->withError($message, static::CODE_NOT_FOUND, $headers);
}

/**
Expand All @@ -215,7 +215,7 @@ public function errorNotFound($message = 'Resource Not Found', array $headers =
*/
public function errorUnauthorized($message = 'Unauthorized', array $headers = [])
{
return $this->setStatusCode(401)->withError($message, self::CODE_UNAUTHORIZED, $headers);
return $this->setStatusCode(401)->withError($message, static::CODE_UNAUTHORIZED, $headers);
}

/**
Expand All @@ -227,7 +227,7 @@ public function errorUnauthorized($message = 'Unauthorized', array $headers = []
*/
public function errorWrongArgs($message = 'Wrong Arguments', array $headers = [])
{
return $this->setStatusCode(400)->withError($message, self::CODE_WRONG_ARGS, $headers);
return $this->setStatusCode(400)->withError($message, static::CODE_WRONG_ARGS, $headers);
}

/**
Expand All @@ -239,7 +239,7 @@ public function errorWrongArgs($message = 'Wrong Arguments', array $headers = []
*/
public function errorGone($message = 'Resource No Longer Available', array $headers = [])
{
return $this->setStatusCode(410)->withError($message, self::CODE_GONE, $headers);
return $this->setStatusCode(410)->withError($message, static::CODE_GONE, $headers);
}

/**
Expand All @@ -251,7 +251,7 @@ public function errorGone($message = 'Resource No Longer Available', array $head
*/
public function errorMethodNotAllowed($message = 'Method Not Allowed', array $headers = [])
{
return $this->setStatusCode(405)->withError($message, self::CODE_METHOD_NOT_ALLOWED, $headers);
return $this->setStatusCode(405)->withError($message, static::CODE_METHOD_NOT_ALLOWED, $headers);
}

/**
Expand All @@ -263,6 +263,6 @@ public function errorMethodNotAllowed($message = 'Method Not Allowed', array $he
*/
public function errorUnwillingToProcess($message = 'Server is unwilling to process the request', array $headers = [])
{
return $this->setStatusCode(431)->withError($message, self::CODE_UNWILLING_TO_PROCESS, $headers);
return $this->setStatusCode(431)->withError($message, static::CODE_UNWILLING_TO_PROCESS, $headers);
}
}

0 comments on commit 936880f

Please sign in to comment.