Code Duplication    Length = 11-16 lines in 3 locations

src/Endpoint/Product.php 1 location

@@ 232-246 (lines=15) @@
229
     * @param \DateTimeInterface $dateEnd
230
     * @return array
231
     */
232
    public function getProductsInModifiedInterval(int $siteId, \DateTimeInterface $dateStart, \DateTimeInterface $dateEnd) : array
233
    {
234
        Assert::that($siteId)->greaterThan(0, 'The $siteId has to be positive');
235
        Assert::that($dateStart)->lessThan($dateEnd, '$dateStart has to be before $dateEnd');
236
237
        return (array)$this->master->doRequest(
238
            'GET',
239
            sprintf(
240
                '/admin/WEBAPI/Endpoints/v1_0/ProductService/{KEY}/GetByModifiedInterval/%d?start=%s&end=%s',
241
                $siteId,
242
                $dateStart->format('Y-m-d\TH:i:s'),
243
                $dateEnd->format('Y-m-d\TH:i:s')
244
            )
245
        );
246
    }
247
}
248

src/Endpoint/ProductData.php 2 locations

@@ 330-340 (lines=11) @@
327
     * @param KeyValueCollection $keyValueCollection
328
     * @return array
329
     */
330
    public function patchProduct(string $productNumber, KeyValueCollection $keyValueCollection) : array
331
    {
332
        Assert::that($productNumber)->minLength(1, 'The length of $productNumber has to be > 0');
333
        Assert::that($keyValueCollection->count())->greaterThan(0);
334
335
        return (array)$this->master->doRequest(
336
            'PATCH',
337
            sprintf('/admin/WEBAPI/Endpoints/v1_0/ProductDataService/{KEY}/%s', rawurlencode($productNumber)),
338
            $keyValueCollection->get()
339
        );
340
    }
341
342
    /**
343
     * @param string $productNumber
@@ 394-409 (lines=16) @@
391
     * @param KeyValueCollection $keyValueCollection
392
     * @return array
393
     */
394
    public function patchProductSettings(int $siteId, string $productNumber, KeyValueCollection $keyValueCollection) : array
395
    {
396
        Assert::that($siteId)->greaterThan(0, 'The $siteId has to be positive');
397
        Assert::that($productNumber)->minLength(1, 'The length of $productNumber has to be > 0');
398
        Assert::that($keyValueCollection->count())->greaterThan(0);
399
400
        return (array)$this->master->doRequest(
401
            'PATCH',
402
            sprintf(
403
                '/admin/WEBAPI/Endpoints/v1_0/ProductDataService/{KEY}/%d/Products/%s/Settings',
404
                $siteId,
405
                rawurlencode($productNumber)
406
            ),
407
            $keyValueCollection->get()
408
        );
409
    }
410
}
411