HttpPlugHandlerFactory::fromHttpPlugClient()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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\HttpPlugHandler;
17
use Http\Client\HttpClient;
18
use Psr\Container\ContainerInterface;
19
20
/**
21
 * Class HttpPlugHandlerFactory
22
 *
23
 * @package CoiSA\Http\Client
24
 */
25
final class HttpPlugHandlerFactory
26
{
27
    /**
28
     * @param ContainerInterface $container
29
     *
30
     * @return HttpPlugHandler
31
     */
32 2
    public function __invoke(ContainerInterface $container): HttpPlugHandler
33
    {
34 2
        $client = $container->get(HttpClient::class);
35
36 2
        return $this->fromHttpPlugClient($client);
37
    }
38
39
    /**
40
     * @param HttpClient $client
41
     *
42
     * @return HttpPlugHandler
43
     */
44 1
    public function fromHttpPlugClient(HttpClient $client): HttpPlugHandler
45
    {
46 1
        return new HttpPlugHandler($client);
47
    }
48
}
49