Passed
Pull Request — master (#71)
by Matthieu
04:18
created

createAtlassianRestClient()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 8
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AtlassianConnectBundle\Service;
6
7
use GuzzleHttp\Client;
8
use GuzzleHttp\Handler\CurlHandler;
9
use GuzzleHttp\HandlerStack;
10
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
11
12
final class AtlassianRestClientFactory
13
{
14
    public static function createAtlassianRestClient(TokenStorageInterface $tokenStorage): AtlassianRestClient
15
    {
16
        $stack = new HandlerStack();
17
        $stack->setHandler(new CurlHandler());
18
19
        $stack->push(GuzzleJWTMiddleware::middleware(new Client()));
20
21
        return new AtlassianRestClient(new Client(['handler' => $stack]), $tokenStorage);
22
    }
23
}
24