Use a constant instead of a property

This commit is contained in:
Toby Zerner 2017-10-05 12:25:30 +10:30
parent 825997c857
commit 09f98a5cbb

View File

@ -20,10 +20,7 @@ use Zend\Stratigility\MiddlewareInterface;
class AuthenticateWithHeader implements MiddlewareInterface
{
/**
* @var string
*/
protected $prefix = 'Token ';
const TOKEN_PREFIX = 'Token ';
/**
* {@inheritdoc}
@ -34,8 +31,8 @@ class AuthenticateWithHeader implements MiddlewareInterface
$parts = explode(';', $headerLine);
if (isset($parts[0]) && starts_with($parts[0], $this->prefix)) {
$id = substr($parts[0], strlen($this->prefix));
if (isset($parts[0]) && starts_with($parts[0], self::TOKEN_PREFIX)) {
$id = substr($parts[0], strlen(self::TOKEN_PREFIX));
if (isset($parts[1])) {
if (ApiKey::find($id)) {