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