Passed
Pull Request — master (#71)
by Matthieu
05:19
created

AtlassianRestClientFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 10
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A createAtlassianRestClient() 0 8 1
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