Completed
Push — master ( 484cfe...fbe189 )
by Laurent
02:38
created

Client::thirdpartyCustomerTag()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Dolibarr\Client;
4
5
use Dolibarr\Client\HttpClient\HttpClient;
6
use Dolibarr\Client\HttpClient\HttpClientInterface;
7
use Dolibarr\Client\Service\LoginService;
8
use Dolibarr\Client\Service\ProductsService;
9
use Dolibarr\Client\Service\ProposalService;
10
use Dolibarr\Client\Service\StockMovementsService;
11
use Dolibarr\Client\Service\ThirdPartiesCustomerCategoryService;
12
use Dolibarr\Client\Service\ThirdPartiesService;
13
use Dolibarr\Client\Service\WarehousesService;
14
use JMS\Serializer\SerializerInterface;
15
16
/**
17
 * @author Laurent De Coninck <[email protected]>
18
 */
19
final class Client
20
{
21
22
    /**
23
     * @var HttpClient
24
     */
25
    private $httpClient;
26
27
    /**
28
     * @var SerializerInterface
29
     */
30
    private $serializer;
31
32
    /**
33
     * @param HttpClientInterface $httpClient
34
     * @param SerializerInterface $serializer
35
     */
36
    public function __construct(HttpClientInterface $httpClient, SerializerInterface $serializer)
37
    {
38
        $this->httpClient = $httpClient;
0 ignored issues
show
Documentation Bug introduced by
$httpClient is of type Dolibarr\Client\HttpClient\HttpClientInterface, but the property $httpClient was declared to be of type Dolibarr\Client\HttpClient\HttpClient. Are you sure that you always receive this specific sub-class here, or does it make sense to add an instanceof check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.

Either this assignment is in error or an instanceof check should be added for that assignment.

class Alien {}

class Dalek extends Alien {}

class Plot
{
    /** @var  Dalek */
    public $villain;
}

$alien = new Alien();
$plot = new Plot();
if ($alien instanceof Dalek) {
    $plot->villain = $alien;
}
Loading history...
39
        $this->serializer = $serializer;
40
    }
41
42
    /**
43
     * @return ThirdPartiesService
44
     */
45
    public function thirdparties()
46
    {
47
        return new ThirdPartiesService($this->httpClient, $this->serializer);
48
    }
49
50
    /**
51
     * @return ProposalService
52
     */
53
    public function proposals()
54
    {
55
        return new ProposalService($this->httpClient, $this->serializer);
56
    }
57
58
    /**
59
     * @return StockMovementsService
60
     */
61
    public function stockMovements()
62
    {
63
        return new StockMovementsService($this->httpClient, $this->serializer);
64
    }
65
66
    /**
67
     * @return WarehousesService
68
     */
69
    public function warehouse()
70
    {
71
        return new WarehousesService($this->httpClient, $this->serializer);
72
    }
73
74
    /**
75
     * @return ProductsService
76
     */
77
    public function products()
78
    {
79
        return new ProductsService($this->httpClient, $this->serializer);
80
    }
81
82
    public function thirdpartyCustomerTag()
83
    {
84
        return new ThirdPartiesCustomerCategoryService($this->httpClient, $this->serializer);
85
    }
86
87
    /**
88
     * @return LoginService
89
     */
90
    public function login()
91
    {
92
        return new LoginService($this->httpClient, $this->serializer);
93
    }
94
}
95