Api   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 4
dl 0
loc 29
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A send() 0 10 2
1
<?php
2
3
namespace Franjid\ApiWrapperBundle\Api;
4
5
use GuzzleHttp\ClientInterface;
6
use GuzzleHttp\Exception\RequestException;
7
8
class Api implements ApiInterface
9
{
10
    /** @var ClientInterface $client */
11
    protected $client;
12
13
    /**
14
     * ApiAbstract constructor.
15
     *
16
     * @param ClientInterface $client
17
     */
18 2
    public function __construct(ClientInterface $client)
19
    {
20 2
        $this->client = $client;
21 2
    }
22
23
    /**
24
     * {@inheritdoc}
25
     */
26 2
    public function send(ApiRequestInterface $apiRequest)
27
    {
28
        try {
29 2
            return new ApiResponse(
30 2
                $this->client->send($apiRequest->getRequest(), $apiRequest->getOptions())
31 1
            );
32 1
        } catch (RequestException $exception) {
33 1
            throw new ApiException($exception);
34
        }
35
    }
36
}
37