Test Failed
Push — develop ( 47e1b5...e72b23 )
by Jens
18:53 queued 15s
created

ProductByIdHeadRequest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
dl 0
loc 23
c 1
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A ofId() 0 3 1
1
<?php
2
3
namespace Commercetools\Core\Request\Products;
4
5
use Commercetools\Core\Model\Common\Context;
6
use Commercetools\Core\Model\Product\Product;
7
use Commercetools\Core\Request\AbstractByIdHeadRequest;
8
use Commercetools\Core\Request\PriceSelectTrait;
9
use Commercetools\Core\Response\ApiResponseInterface;
10
use Commercetools\Core\Model\MapperInterface;
11
12
/**
13
 * @package Commercetools\Core\Request\Products
14
 * @link https://docs.commercetools.com/api/projects/products#by-id
15
 * @method Product mapResponse(ApiResponseInterface $response)
16
 * @method Product mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null)
17
 */
18
class ProductByIdHeadRequest extends AbstractByIdHeadRequest
19
{
20
    use PriceSelectTrait;
21
    
22
    protected $resultClass = Product::class;
23
24
    /**
25
     * @param string $id
26
     * @param Context $context
27
     */
28
    public function __construct($id, Context $context = null)
29
    {
30
        parent::__construct(ProductsEndpoint::endpoint(), $id, $context);
31
    }
32
33
    /**
34
     * @param string $id
35
     * @param Context $context
36
     * @return static
37
     */
38
    public static function ofId($id, Context $context = null)
39
    {
40
        return new static($id, $context);
41
    }
42
}
43