Completed
Push — master ( ab94e9...fa2f9e )
by Gabriel
02:21
created

Products::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Waredesk;
4
5
use Waredesk\Mappers\ProductMapper;
6
use Waredesk\Models\Product;
7
8
class Products
9
{
10
    private $requestHandler;
11
12 5
    public function __construct(RequestHandler $requestHandler)
13
    {
14 5
        $this->requestHandler = $requestHandler;
15 5
    }
16
17 1
    public function create(Product $product): Product
18
    {
19 1
        $response = $this->requestHandler->post(
20 1
            '/v1/products',
21
            $product
22
        );
23 1
        $product = (new ProductMapper())->map($product, $response);
24 1
        return $product;
25
    }
26
}
27