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\ContactService; |
8
|
|
|
use Dolibarr\Client\Service\LoginService; |
9
|
|
|
use Dolibarr\Client\Service\ProductsService; |
10
|
|
|
use Dolibarr\Client\Service\ProposalService; |
11
|
|
|
use Dolibarr\Client\Service\StockMovementsService; |
12
|
|
|
use Dolibarr\Client\Service\ThirdPartiesCustomerCategoryService; |
13
|
|
|
use Dolibarr\Client\Service\ThirdPartiesService; |
14
|
|
|
use Dolibarr\Client\Service\WarehousesService; |
15
|
|
|
use JMS\Serializer\SerializerInterface; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @author Laurent De Coninck <[email protected]> |
19
|
|
|
*/ |
20
|
|
|
final class Client |
21
|
|
|
{ |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @var HttpClient |
25
|
|
|
*/ |
26
|
|
|
private $httpClient; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var SerializerInterface |
30
|
|
|
*/ |
31
|
|
|
private $serializer; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @param HttpClientInterface $httpClient |
35
|
|
|
* @param SerializerInterface $serializer |
36
|
|
|
*/ |
37
|
|
|
public function __construct(HttpClientInterface $httpClient, SerializerInterface $serializer) |
38
|
|
|
{ |
39
|
|
|
$this->httpClient = $httpClient; |
|
|
|
|
40
|
|
|
$this->serializer = $serializer; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @return ThirdPartiesService |
45
|
|
|
*/ |
46
|
|
|
public function thirdparties() |
47
|
|
|
{ |
48
|
|
|
return new ThirdPartiesService($this->httpClient, $this->serializer); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @return ProposalService |
53
|
|
|
*/ |
54
|
|
|
public function proposals() |
55
|
|
|
{ |
56
|
|
|
return new ProposalService($this->httpClient, $this->serializer); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @return StockMovementsService |
61
|
|
|
*/ |
62
|
|
|
public function stockMovements() |
63
|
|
|
{ |
64
|
|
|
return new StockMovementsService($this->httpClient, $this->serializer); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @return WarehousesService |
69
|
|
|
*/ |
70
|
|
|
public function warehouse() |
71
|
|
|
{ |
72
|
|
|
return new WarehousesService($this->httpClient, $this->serializer); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @return ProductsService |
77
|
|
|
*/ |
78
|
|
|
public function products() |
79
|
|
|
{ |
80
|
|
|
return new ProductsService($this->httpClient, $this->serializer); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
public function thirdpartyCustomerTag() |
84
|
|
|
{ |
85
|
|
|
return new ThirdPartiesCustomerCategoryService($this->httpClient, $this->serializer); |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @return LoginService |
90
|
|
|
*/ |
91
|
|
|
public function login() |
92
|
|
|
{ |
93
|
|
|
return new LoginService($this->httpClient, $this->serializer); |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @return ContactService |
98
|
|
|
*/ |
99
|
|
|
public function contact() |
100
|
|
|
{ |
101
|
|
|
return new ContactService($this->httpClient, $this->serializer); |
102
|
|
|
} |
103
|
|
|
} |
104
|
|
|
|
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.