1 | <?php |
||
2 | |||
3 | namespace Parroauth2\Client\Extension; |
||
4 | |||
5 | use Parroauth2\Client\ClientInterface; |
||
6 | use Parroauth2\Client\EndPoint\EndPointTransformerInterface; |
||
7 | |||
8 | /** |
||
9 | * Implements extension for EndPointTransformer |
||
10 | */ |
||
11 | abstract class AbstractEndPointTransformerExtension implements ExtensionInterface, EndPointTransformerInterface |
||
12 | { |
||
13 | /** |
||
14 | * @var ClientInterface|null |
||
15 | */ |
||
16 | private $client; |
||
17 | |||
18 | /** |
||
19 | * {@inheritdoc} |
||
20 | */ |
||
21 | 33 | final public function configure(ClientInterface $client): void |
|
22 | { |
||
23 | 33 | $extension = $this->client === null ? $this : clone $this; |
|
24 | 33 | $extension->client = $client; |
|
25 | |||
26 | 33 | $client->endPoints()->register($extension); |
|
27 | 33 | } |
|
28 | |||
29 | /** |
||
30 | * Get the configured client |
||
31 | * |
||
32 | * @return ClientInterface |
||
33 | * |
||
34 | * @psalm-mutation-free |
||
35 | * |
||
36 | * @psalm-suppress InvalidNullableReturnType |
||
37 | * @psalm-suppress NullableReturnStatement |
||
38 | */ |
||
39 | 31 | final protected function client(): ClientInterface |
|
40 | { |
||
41 | 31 | return $this->client; |
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||
42 | } |
||
43 | } |
||
44 |