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

HttpPlugHandlerFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 5 1
A fromHttpPlugClient() 0 3 1
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 CoiSA\Http\Handler\HttpPlugHandler;
18
use GuzzleHttp\ClientInterface;
19
use http\Client;
20
use Http\Client\HttpClient;
21
use Psr\Container\ContainerInterface;
22
23
/**
24
 * Class HttpPlugHandlerFactory
25
 *
26
 * @package CoiSA\Http\Client
27
 */
28
final class HttpPlugHandlerFactory
29
{
30
    /**
31
     * @param ContainerInterface $container
32
     *
33
     * @return HttpPlugHandler
34
     */
35
    public function __invoke(ContainerInterface $container): HttpPlugHandler
36
    {
37
        $client = $container->get(ClientInterface::class);
38
39
        return $this->fromHttpPlugClient($client);
40
    }
41
42
    /**
43
     * @param ClientInterface $client
44
     *
45
     * @return GuzzleHandler
46
     */
47
    public function fromHttpPlugClient(HttpClient $client): HttpPlugHandler
48
    {
49
        return new HttpPlugHandler($client);
0 ignored issues
show
Bug Best Practice introduced by
The expression return new CoiSA\Http\Ha...ttpPlugHandler($client) returns the type CoiSA\Http\Handler\HttpPlugHandler which is incompatible with the documented return type CoiSA\Http\Handler\GuzzleHandler.
Loading history...
50
    }
51
}
52