Booking::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace DJStarCOM\BookingComSDK;
4
5
use DJStarCOM\BookingComSDK\HttpClient\HttpClientInterface;
6
use DJStarCOM\BookingComSDK\Models\Result;
7
use DJStarCOM\BookingComSDK\Query\Query;
8
9
/**
10
 * Class Booking
11
 * @package DJStarCOM\BookingComSDK
12
 */
13
class Booking
14
{
15
    /**
16
     * @var HttpClientInterface
17
     */
18
    private $httpClient;
19
20
    /**
21
     * Booking constructor.
22
     * @param HttpClientInterface $httpClient
23
     */
24
    public function __construct(HttpClientInterface $httpClient)
25
    {
26
        $this->httpClient = $httpClient;
27
    }
28
29
    /**
30
     * @param Query $query
31
     * @return Result
32
     * @throws Exceptions\BookingResponseException
33
     */
34
    public function query(Query $query): Result
35
    {
36
        $client = clone $this->httpClient;
37
38
        return $query->execute($client);
39
    }
40
}
41