mirror of
https://github.com/flarum/framework.git
synced 2024-12-04 08:13:39 +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
|
class AuthenticateWithHeader implements MiddlewareInterface
|
||||||
{
|
{
|
||||||
/**
|
const TOKEN_PREFIX = 'Token ';
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $prefix = 'Token ';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
|
@ -34,8 +31,8 @@ class AuthenticateWithHeader implements MiddlewareInterface
|
||||||
|
|
||||||
$parts = explode(';', $headerLine);
|
$parts = explode(';', $headerLine);
|
||||||
|
|
||||||
if (isset($parts[0]) && starts_with($parts[0], $this->prefix)) {
|
if (isset($parts[0]) && starts_with($parts[0], self::TOKEN_PREFIX)) {
|
||||||
$id = substr($parts[0], strlen($this->prefix));
|
$id = substr($parts[0], strlen(self::TOKEN_PREFIX));
|
||||||
|
|
||||||
if (isset($parts[1])) {
|
if (isset($parts[1])) {
|
||||||
if (ApiKey::find($id)) {
|
if (ApiKey::find($id)) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user