Passed
Pull Request — master (#8)
by Thomas
01:44
created

Gateway::getServiceFactory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
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
use Zoho\Desk\Service\ServiceFactory;
16
17
/**
18
 * @api
19
 */
20
final class Gateway
21
{
22
    private Client $client;
23
24
    private RequestBuilder $requestBuilder;
25
26
    private DataObjectFactory $dataObjectFactory;
27
28
    private OperationPool $operationPool;
29
30
    private ServiceFactory $serviceFactory;
31
32
    public function __construct(ConfigProviderInterface $configProvider, array $registeredEntityTypes = [])
33
    {
34
        $this->client = new Client($configProvider);
35
        $this->requestBuilder = new RequestBuilder($this->client);
36
        $this->dataObjectFactory = new DataObjectFactory($registeredEntityTypes);
37
        $this->operationPool = new OperationPool($this->requestBuilder, $this->dataObjectFactory);
0 ignored issues
show
Deprecated Code introduced by
The class Zoho\Desk\Model\OperationPool has been deprecated. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

37
        $this->operationPool = /** @scrutinizer ignore-deprecated */ new OperationPool($this->requestBuilder, $this->dataObjectFactory);
Loading history...
38
        $this->serviceFactory = new ServiceFactory($this->requestBuilder, $this->dataObjectFactory);
39
    }
40
41
    public function getDataObjectFactory(): DataObjectFactory
42
    {
43
        return $this->dataObjectFactory;
44
    }
45
46
    /**
47
     * @deprecated
48
     * @see Gateway::getServiceFactory
49
     */
50
    public function getOperationPool(): OperationPool
51
    {
52
        return $this->operationPool;
53
    }
54
55
    public function getServiceFactory(): ServiceFactory
56
    {
57
        return $this->serviceFactory;
58
    }
59
60
    public function getClient(): Client
61
    {
62
        return $this->client;
63
    }
64
65
    public function getRequestBuilder(): RequestBuilder
66
    {
67
        return $this->requestBuilder;
68
    }
69
}
70