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

Products   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 19
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A create() 0 9 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