Total Complexity | 6 |
Total Lines | 53 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | class Endpoint extends Psr7Message |
||
14 | { |
||
15 | use EndpointAware; |
||
16 | |||
17 | /** |
||
18 | * The HTTP client. |
||
19 | * |
||
20 | * @var Client |
||
21 | */ |
||
22 | private $client; |
||
23 | |||
24 | /** |
||
25 | * Instantiate the class. |
||
26 | * |
||
27 | * @param Client $client |
||
28 | */ |
||
29 | 12 | public function __construct(Client $client = null) |
|
30 | { |
||
31 | 12 | if ($client === null && class_exists(Client::class)) { |
|
32 | 10 | $client = new Client(); |
|
33 | } |
||
34 | |||
35 | 12 | $this->client = $client; |
|
36 | 12 | } |
|
37 | |||
38 | /** |
||
39 | * Determine whether the handler can handle the given source |
||
40 | * |
||
41 | * @param mixed $source |
||
42 | * @return bool |
||
43 | */ |
||
44 | 10 | public function handles($source): bool |
|
47 | } |
||
48 | |||
49 | /** |
||
50 | * Handle the given source |
||
51 | * |
||
52 | * @param mixed $source |
||
53 | * @param string $path |
||
54 | * @return Traversable |
||
55 | */ |
||
56 | 2 | public function handle($source, string $path): Traversable |
|
66 | } |
||
67 | } |
||
68 |