Code Duplication    Length = 22-23 lines in 2 locations

src/Yandex/Common/AbstractServiceClient.php 1 location

@@ 248-270 (lines=23) @@
245
    /**
246
     * @return ClientInterface
247
     */
248
    protected function getClient()
249
    {
250
        if (is_null($this->client)) {
251
            $defaultOptions = [
252
                'base_uri' => $this->getServiceUrl(),
253
                'headers' => [
254
                    'Authorization' => 'OAuth ' . $this->getAccessToken(),
255
                    'Host' => $this->getServiceDomain(),
256
                    'User-Agent' => $this->getUserAgent(),
257
                    'Accept' => '*/*'
258
                ]
259
            ];
260
            if ($this->getProxy()) {
261
                $defaultOptions['proxy'] = $this->getProxy();
262
            }
263
            if ($this->getDebug()) {
264
                $defaultOptions['debug'] = $this->getDebug();
265
            }
266
            $this->client = new Client($defaultOptions);
267
        }
268
269
        return $this->client;
270
    }
271
272
    /**
273
     * Sends a request

src/Yandex/Market/Content/ContentClient.php 1 location

@@ 82-103 (lines=22) @@
79
    /**
80
     * @return ClientInterface
81
     */
82
    protected function getClient()
83
    {
84
        if (is_null($this->client)) {
85
            $defaultOptions = [
86
                'base_uri' => $this->getServiceUrl(),
87
                'headers' => [
88
                    'Host' => $this->getServiceDomain(),
89
                    'Accept' => '*/*',
90
                    'Authorization' => $this->getAccessToken(),
91
                ]
92
            ];
93
            if ($this->getProxy()) {
94
                $defaultOptions['proxy'] = $this->getProxy();
95
            }
96
            if ($this->getDebug()) {
97
                $defaultOptions['debug'] = $this->getDebug();
98
            }
99
            $this->client = new Client($defaultOptions);
100
        }
101
102
        return $this->client;
103
    }
104
105
    /**
106
     * Sends a request