Code Duplication    Length = 15-19 lines in 3 locations

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

@@ 667-685 (lines=19) @@
664
     *
665
     * @link https://tech.yandex.ru/market/partner/doc/dg/reference/post-models-docpage/
666
     */
667
    public function getModels(array $modelIds, $regionId, $currency = null)
668
    {
669
        $resource = sprintf('models.%s', self::DECODE_TYPE_DEFAULT);
670
        $queryParams = $this->filterParams([
671
            'regionId' => $regionId,
672
            'currency' => $currency,
673
        ]);
674
675
        $response = $this->sendRequest('POST', $this->getServiceUrl($resource), [
676
            'query' => $queryParams,
677
            'json' => [
678
                'models' => $modelIds
679
            ],
680
        ]);
681
        $decodedResponseBody = $this->getDecodedBody($response->getBody());
682
        $marketModelsResponse = new GetMarketModelsResponse($decodedResponseBody);
683
684
        return $marketModelsResponse->getModels();
685
    }
686
687
    /**
688
     * Get model offers
@@ 698-712 (lines=15) @@
695
     *
696
     * @link https://tech.yandex.ru/market/partner/doc/dg/reference/get-models-id-offers-docpage/
697
     */
698
    public function getModelOffers($modelId, $regionId, $currency = null, $orderByPrice = null)
699
    {
700
        $resource = sprintf('models/%s/offers.%s', $modelId, self::DECODE_TYPE_DEFAULT);
701
        $queryParams = $this->filterParams([
702
            'regionId' => $regionId,
703
            'currency' => $currency,
704
            'orderByPrice' => $orderByPrice,
705
        ]);
706
707
        $response = $this->sendRequest('GET', $this->getServiceUrl($resource), ['query' => $queryParams]);
708
        $decodedResponseBody = $this->getDecodedBody($response->getBody());
709
        $marketModelsResponse = new GetMarketModelsResponse($decodedResponseBody);
710
711
        return $marketModelsResponse->getModels()->current();
712
    }
713
714
    /**
715
     * Get multiple models offers
@@ 724-742 (lines=19) @@
721
     *
722
     * @link https://tech.yandex.ru/market/partner/doc/dg/reference/post-models-offers-docpage/
723
     */
724
    public function getModelsOffers(array $modelIds, $regionId, $currency = null)
725
    {
726
        $resource = sprintf('models/offers.%s', self::DECODE_TYPE_DEFAULT);
727
        $queryParams = $this->filterParams([
728
            'regionId' => $regionId,
729
            'currency' => $currency,
730
        ]);
731
732
        $response = $this->sendRequest('POST', $this->getServiceUrl($resource), [
733
            'query' => $queryParams,
734
            'json' => [
735
                'models' => $modelIds
736
            ],
737
        ]);
738
        $decodedResponseBody = $this->getDecodedBody($response->getBody());
739
        $marketModelsResponse = new GetMarketModelsResponse($decodedResponseBody);
740
741
        return $marketModelsResponse->getModels();
742
    }
743
}
744