Code Duplication    Length = 11-13 lines in 5 locations

src/Yandex/Market/Partner/PartnerClient.php 5 locations

@@ 272-284 (lines=13) @@
269
     *
270
     * @return Models\Balance
271
     */
272
    public function getBalance()
273
    {
274
        $resource = 'campaigns/' . $this->campaignId . '/balance.json';
275
276
        $response = $this->sendRequest('GET', $this->getServiceUrl($resource));
277
278
        $decodedResponseBody = $this->getDecodedBody($response->getBody());
279
280
        $getBalanceResponse = new Models\GetBalanceResponse($decodedResponseBody);
281
        return $getBalanceResponse->getBalance();
282
    }
283
284
    /**
285
     * Get User Campaigns
286
     *
287
     * Returns the user to the list of campaigns Yandex.market.
@@ 295-305 (lines=11) @@
292
     *
293
     * @return Models\Campaigns
294
     */
295
    public function getCampaigns()
296
    {
297
        $resource = 'campaigns.json';
298
299
        $response = $this->sendRequest('GET', $this->getServiceUrl($resource));
300
301
        $decodedResponseBody = $this->getDecodedBody($response->getBody());
302
303
        $getCampaignsResponse = new Models\GetCampaignsResponse($decodedResponseBody);
304
        return $getCampaignsResponse->getCampaigns();
305
    }
306
    
307
    /**
308
     * Get User Campaigns by Login
@@ 314-324 (lines=11) @@
311
     *
312
     * @return Models\Campaigns
313
     */
314
    public function getCampaignsByLogin($login)
315
    {
316
        $resource = 'campaigns/by_login/' . $login . '.json';
317
318
        $response = $this->sendRequest('GET', $this->getServiceUrl($resource));
319
320
        $decodedResponseBody = $this->getDecodedBody($response->getBody());
321
322
        $getCampaignsResponse = new Models\GetCampaignsResponse($decodedResponseBody);
323
        return $getCampaignsResponse->getCampaigns();
324
    }
325
326
    /**
327
     * Get outlets by campaign id
@@ 423-433 (lines=11) @@
420
     *
421
     * @link http://api.yandex.ru/market/partner/doc/dg/reference/get-campaigns-id-orders-id.xml
422
     */
423
    public function getOrder($orderId)
424
    {
425
        $resource = 'campaigns/' . $this->campaignId . '/orders/' . $orderId . '.json';
426
427
        $response = $this->sendRequest('GET', $this->getServiceUrl($resource));
428
429
        $decodedResponseBody = $this->getDecodedBody($response->getBody());
430
431
        $getOrderResponse = new Models\GetOrderResponse($decodedResponseBody);
432
        return $getOrderResponse->getOrder();
433
    }
434
435
    /**
436
     * Get Region
@@ 442-452 (lines=11) @@
439
     *
440
     * @link https://tech.yandex.ru/market/partner/doc/dg/reference/get-campaigns-id-region-docpage/
441
     */
442
    public function getRegion()
443
    {
444
        $resource = 'campaigns/' . $this->campaignId . '/region.json';
445
446
        $response = $this->sendRequest('GET', $this->getServiceUrl($resource));
447
448
        $decodedResponseBody = $this->getDecodedBody($response->getBody());
449
450
        $getRegionResponse = new Models\GetRegionResponse($decodedResponseBody);
451
        return $getRegionResponse->getRegion();
452
    }
453
454
    /**
455
     * @param $method [main | main-daily | main-weekly | main-monthly]