ThirdPartiesCustomerCategoryService::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
4
namespace Dolibarr\Client\Service;
5
6
use Dolibarr\Client\Domain\Resource\ApiResource;
7
use Dolibarr\Client\Domain\Resource\ResourceId;
8
use Dolibarr\Client\Domain\Thirdparty\Thirdparty;
9
use Dolibarr\Client\Domain\Thirdparty\ThirdpartyId;
10
use Dolibarr\Client\Exception\ApiException;
11
use Dolibarr\Client\HttpClient\HttpClientInterface;
12
use JMS\Serializer\SerializerInterface;
13
14
/**
15
 * @author Laurent De Coninck <[email protected]>
16
 */
17
final class ThirdPartiesCustomerCategoryService extends AbstractService
18
{
19
    /**
20
     * @param HttpClientInterface $httpClient
21
     * @param SerializerInterface $serializerInterface
22
     */
23
    public function __construct(HttpClientInterface $httpClient, SerializerInterface $serializerInterface)
24
    {
25
        parent::__construct($httpClient, $serializerInterface, new ApiResource('thirdparties'));
26
    }
27
28
    /**
29
     * @param ResourceId $thirdpartyId
30
     * @param ResourceId $catgeory
31
     *
32
     * @throws ApiException
33
     * @throws \Exception
34
     */
35
    public function attach(ResourceId $thirdpartyId, ResourceId $catgeory)
36
    {
37
        $this->httpClient->post($this->resource->getResourceName().'/'.$thirdpartyId->getId().'/categories/'.$catgeory->getId(), $this->serialize([]));
38
    }
39
}
40