Test Failed
Push — master ( a6c6b3...3c4c8a )
by Felipe
06:56 queued 04:26
created

GuzzleHandlerFactory::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * This file is part of coisa/http.
5
 *
6
 * (c) Felipe Sayão Lobato Abreu <[email protected]>
7
 *
8
 * This source file is subject to the license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
declare(strict_types=1);
13
14
namespace CoiSA\Http\Client;
15
16
use CoiSA\Http\Handler\GuzzleHandler;
17
use GuzzleHttp\ClientInterface;
18
use Psr\Container\ContainerInterface;
19
20
/**
21
 * Class GuzzleHandlerFactory
22
 *
23
 * @package CoiSA\Http\Client
24
 */
25
final class GuzzleHandlerFactory
26
{
27
    /**
28
     * @param ContainerInterface $container
29
     *
30
     * @return GuzzleHandler
31
     */
32
    public function __invoke(ContainerInterface $container): GuzzleHandler
33
    {
34
        $client = $container->get(ClientInterface::class);
35
36
        return $this->fromGuzzleClient($client);
37
    }
38
39
    /**
40
     * @param ClientInterface $client
41
     *
42
     * @return GuzzleHandler
43
     */
44
    public function fromGuzzleClient(ClientInterface $client): GuzzleHandler
45
    {
46
        return new GuzzleHandler($client);
47
    }
48
}
49