mirror of
https://github.com/flarum/framework.git
synced 2024-12-02 15:03:44 +08:00
Use a constant instead of a property
This commit is contained in:
parent
825997c857
commit
09f98a5cbb
|
@ -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)) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user