Gateway::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 4
c 2
b 1
f 0
dl 0
loc 6
rs 10
cc 1
nc 1
nop 2
1
<?php
2
/**
3
 * Copyright © Thomas Klein, All rights reserved.
4
 * See LICENSE bundled with this library for license details.
5
 */
6
declare(strict_types=1);
7
8
namespace Zoho\Desk;
9
10
use Zoho\Desk\Client\ConfigProviderInterface;
11
use Zoho\Desk\Client\RequestBuilder;
12
use Zoho\Desk\Model\DataObjectFactory;
13
use Zoho\Desk\Model\OperationPool;
14
use Zoho\Desk\OAuth\Client;
15
16
/**
17
 * @api
18
 */
19
final class Gateway
20
{
21
    private DataObjectFactory $dataObjectFactory;
22
23
    private OperationPool $operationPool;
24
25
    private Client $client;
26
27
    private RequestBuilder $requestBuilder;
28
29
    public function __construct(ConfigProviderInterface $configProvider, array $registeredEntityTypes = [])
30
    {
31
        $this->dataObjectFactory = new DataObjectFactory($registeredEntityTypes);
32
        $this->client = new Client($configProvider);
33
        $this->requestBuilder = new RequestBuilder($this->client);
34
        $this->operationPool = new OperationPool($this->requestBuilder, $this->dataObjectFactory);
35
    }
36
37
    public function getDataObjectFactory(): DataObjectFactory
38
    {
39
        return $this->dataObjectFactory;
40
    }
41
42
    public function getOperationPool(): OperationPool
43
    {
44
        return $this->operationPool;
45
    }
46
47
    public function getClient(): Client
48
    {
49
        return $this->client;
50
    }
51
52
    public function getRequestBuilder(): RequestBuilder
53
    {
54
        return $this->requestBuilder;
55
    }
56
}
57