|
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; |
|
|
|
|
|
|
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
|
|
|
|
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.