Passed
Pull Request — master (#24)
by Damian
01:51
created

RequiresAuthenticator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setJWTAuthenticator() 0 4 1
A getJWTAuthenticator() 0 3 1
1
<?php declare(strict_types=1);
2
3
namespace Firesphere\GraphQLJWT\Helpers;
4
5
use Firesphere\GraphQLJWT\Authentication\JWTAuthenticator;
6
7
/**
8
 * Parent class requires a JWTAuthenticator instance to be injected
9
 */
10
trait RequiresAuthenticator
11
{
12
    /**
13
     * @var JWTAuthenticator|null
14
     */
15
    protected $jwtAuthenticator = null;
16
17
    /**
18
     * @return JWTAuthenticator|null
19
     */
20
    protected function getJWTAuthenticator(): ?JWTAuthenticator
21
    {
22
        return $this->jwtAuthenticator;
23
    }
24
25
    /**
26
     * Inject authenticator this mutation should use
27
     *
28
     * @param JWTAuthenticator $authenticator
29
     * @return $this
30
     */
31
    public function setJWTAuthenticator(JWTAuthenticator $authenticator): self
32
    {
33
        $this->jwtAuthenticator = $authenticator;
34
        return $this;
35
    }
36
}
37