Passed
Push — develop ( a6f0fe...5308a3 )
by Daniel
24:47 queued 09:44
created

Client::request()   A

Complexity

Conditions 4
Paths 11

Size

Total Lines 24
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 4.128

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 13
nc 11
nop 0
dl 0
loc 24
ccs 8
cts 10
cp 0.8
crap 4.128
rs 9.8333
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace InShore\Bookwhen;
6
7
use GuzzleHttp;
8
use GuzzleHttp\Client as GuzzleClient;
9
use GuzzleHttp\Psr7\Request;
10
use InShore\Bookwhen\Exceptions\ConfigurationException;
11
use InShore\Bookwhen\Exceptions\RestException;
12
use InShore\Bookwhen\Exceptions\ValidationException;
13
use InShore\Bookwhen\Interfaces\ClientInterface;
14
use InShore\Bookwhen\Validator;
15
use Monolog\Level;
16
use Monolog\Logger;
17
use Monolog\Handler\StreamHandler;
18
use Psr\Http\Message\ResponseInterface;
19
use InShore\Bookwhen\Resources\Attachments;
20
use InShore\Bookwhen\Resources\ClassPasses;
21
use InShore\Bookwhen\Resources\Events;
22
use InShore\Bookwhen\Resources\Locations;
23
use InShore\Bookwhen\Resources\Tickets;
24
25
/**
26
 * Class Client
27
 *
28
 * The main class for API consumption
29
 *
30
 * @package inshore\bookwhen
31
 * @todo comments
32
 * @todo externalise config
33
 * @todo fix token
34
 */
35
class Client implements ClientInterface
36
{
37
    /**
38
     * {@inheritDoc}
39
     * @see \InShore\Bookwhen\Interfaces\ClientInterface::__construct()
40
     * @todo sanity check the log level passed in an exception if wrong.
41
     * @todo handle guzzle error
42
     */
43
    public function __construct(private $transporter)
44
    {
45
    }
46
47
    /**
48
     *
49
     */
50
    public function attachments(): Attachments
51
    {
52
        return new Attachments($this->transporter);
53
    }
54
55
    /**
56
57
     */
58
    public function classPasses(): ClassPasses
59
    {
60
        return new ClassPasses($this->transporter);
61
    }
62
/*
63
 *
64
 */
65 12
    public function events(): Events
66
    {
67
        return new Events($this->transporter);
68
    }
69
   /**
70
71
    */
72
    public function locations(): Locations
73
    {
74
        return new Locations($this->transporter);
75
    }
76 12
/**
77 12
78 12
 */
79
    public function tickets(): Tickets
80 12
    {
81 12
        return new Tickets($this->transporter);
82
    }
83 12
}
84
85
// EOF!
86