Test Failed
Pull Request — master (#80)
by Maximo
05:58
created

Request   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 26
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getBearerTokenFromHeader() 0 3 1
A ignoreJwt() 0 3 3
A isEmptyBearerToken() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gewaer\Http;
6
7
use Phalcon\Http\Request as PhRequest;
8
9
class Request extends PhRequest
10
{
11
    /**
12
    * @return string
13
    */
14 66
    public function getBearerTokenFromHeader(): string
15
    {
16 66
        return str_replace('Bearer ', '', $this->getHeader('Authorization'));
17
    }
18
19
    /**
20
     * @return bool
21
     */
22 66
    public function isEmptyBearerToken(): bool
23
    {
24 66
        return true === empty($this->getBearerTokenFromHeader());
25
    }
26
27
    /**
28
     * Did we specify we dont need to validate JWT Token on this section?
29
     *
30
     * @return bool
31
     */
32 69
    public function ignoreJwt() : bool
33
    {
34 69
        return ('//v1/auth' === $this->getURI() || '/v1/auth' === $this->getURI() || '/v1/users' === $this->getURI());
35
    }
36
}
37