1: <?php
2: /*
3: * This class was auto-generated from the API references found at
4: * https://apireference.connect.worldline-solutions.com/
5: */
6: namespace Worldline\Connect\Sdk;
7:
8: use Worldline\Connect\Sdk\Logging\CommunicatorLogger;
9: use Worldline\Connect\Sdk\V1\V1Client;
10:
11: /**
12: * Worldline Global Collect platform client.
13: */
14: class Client extends ApiResource
15: {
16: /** @var Communicator */
17: private $communicator;
18:
19: /** @var string */
20: private $clientMetaInfo;
21:
22: /**
23: * Construct a new Worldline Global Collect platform API client.
24: *
25: * @param Communicator $communicator
26: * @param string $clientMetaInfo
27: *
28: */
29: public function __construct(Communicator $communicator, $clientMetaInfo = '')
30: {
31: parent::__construct();
32: $this->communicator = $communicator;
33: $this->setClientMetaInfo($clientMetaInfo);
34: $this->context = array();
35: }
36:
37: /**
38: * @return Communicator
39: */
40: protected function getCommunicator()
41: {
42: return $this->communicator;
43: }
44:
45: /**
46: * @param CommunicatorLogger $communicatorLogger
47: */
48: public function enableLogging(CommunicatorLogger $communicatorLogger)
49: {
50: $this->getCommunicator()->enableLogging($communicatorLogger);
51: }
52:
53: /**
54: *
55: */
56: public function disableLogging()
57: {
58: $this->getCommunicator()->disableLogging();
59: }
60:
61: /**
62: * @param string $clientMetaInfo
63: * @return $this
64: */
65: public function setClientMetaInfo($clientMetaInfo)
66: {
67: $this->clientMetaInfo = $clientMetaInfo ? base64_encode($clientMetaInfo) : '';
68: return $this;
69: }
70:
71: /**
72: * @return string
73: */
74: protected function getClientMetaInfo()
75: {
76: return $this->clientMetaInfo;
77: }
78:
79: public function v1()
80: {
81: return new V1Client($this, $this->context);
82: }
83: }
84: