Total Complexity | 9 |
Total Lines | 56 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
20 | class DatamolinoClient |
||
21 | { |
||
22 | /** @var Client */ |
||
23 | private $client; |
||
24 | |||
25 | /** @var UserEndpoint */ |
||
26 | private $userEndpoint; |
||
27 | |||
28 | /** @var AgendaEndpoint */ |
||
29 | private $agendaEndpoint; |
||
30 | |||
31 | /** @var DocumentEndpoint */ |
||
32 | private $documentEndpoint; |
||
33 | |||
34 | public function __construct(?Client $client = null) |
||
35 | { |
||
36 | if (null === $client) { |
||
37 | $this->client = new Client(); |
||
38 | } else { |
||
39 | $this->client = $client; |
||
40 | } |
||
41 | } |
||
42 | |||
43 | public function user(): UserEndpoint |
||
44 | { |
||
45 | if (null === $this->userEndpoint) { |
||
46 | $this->userEndpoint = new UserEndpoint($this->getClient()); |
||
47 | } |
||
48 | |||
49 | return $this->userEndpoint; |
||
50 | } |
||
51 | |||
52 | public function agenda(): AgendaEndpoint |
||
53 | { |
||
54 | if (null === $this->agendaEndpoint) { |
||
55 | $this->agendaEndpoint = new AgendaEndpoint($this->getClient()); |
||
56 | } |
||
57 | |||
58 | return $this->agendaEndpoint; |
||
59 | } |
||
60 | |||
61 | public function document(): DocumentEndpoint |
||
62 | { |
||
63 | if (null === $this->documentEndpoint) { |
||
64 | $this->documentEndpoint = new DocumentEndpoint($this->getClient()); |
||
65 | } |
||
66 | |||
67 | return $this->documentEndpoint; |
||
68 | } |
||
69 | |||
70 | /** |
||
71 | * @return Client |
||
72 | */ |
||
73 | public function getClient(): Client |
||
76 | } |
||
77 | } |
||
78 |