Passed
Push — master ( ed94ae...15a67e )
by Ludwig
02:43
created

DatamolinoClient   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 50
rs 10
c 0
b 0
f 0
wmc 8

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getClient() 0 3 1
A __construct() 0 3 1
A user() 0 7 2
A document() 0 7 2
A agenda() 0 7 2
1
<?php
2
3
/*
4
 * This file is part of datamolino client.
5
 *
6
 * (c) 2018 cwd.at GmbH <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Cwd\Datamolino;
15
16
use Cwd\Datamolino\Endpoints\AgendaEndpoint;
17
use Cwd\Datamolino\Endpoints\DocumentEndpoint;
18
use Cwd\Datamolino\Endpoints\UserEndpoint;
19
20
class DatamolinoClient
21
{
22
    /** @var Client */
23
    private $client;
24
25
    /** @var UserEndpoint */
26
    private $userEndpoint;
27
    /** @var AgendaEndpoint */
28
    private $agendaEndpoint;
29
    /** @var DocumentEndpoint */
30
    private $documentEndpoint;
31
32
    public function __construct()
33
    {
34
        $this->client = new Client();
35
    }
36
37
    public function user(): UserEndpoint
38
    {
39
        if (null === $this->userEndpoint) {
40
            $this->userEndpoint = new UserEndpoint($this->getClient());
41
        }
42
43
        return $this->userEndpoint;
44
    }
45
46
    public function agenda(): AgendaEndpoint
47
    {
48
        if (null === $this->agendaEndpoint) {
49
            $this->agendaEndpoint = new AgendaEndpoint($this->getClient());
50
        }
51
52
        return $this->agendaEndpoint;
53
    }
54
55
    public function document(): DocumentEndpoint
56
    {
57
        if (null === $this->documentEndpoint) {
58
            $this->documentEndpoint = new DocumentEndpoint($this->getClient());
59
        }
60
61
        return $this->documentEndpoint;
62
    }
63
64
    /**
65
     * @return Client
66
     */
67
    public function getClient(): Client
68
    {
69
        return $this->client;
70
    }
71
}
72