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

RequiresAuthenticator::getJWTAuthenticator()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
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