Total Complexity | 6 |
Total Lines | 73 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
18 | class BaseIMCloud |
||
19 | { |
||
20 | /** |
||
21 | * @var Application |
||
22 | */ |
||
23 | protected $app; |
||
24 | |||
25 | /** |
||
26 | * AbstractTimSDKAPI constructor. |
||
27 | * @param ServiceContainer $app |
||
28 | */ |
||
29 | public function __construct(ServiceContainer $app) |
||
30 | { |
||
31 | $this->app = $app; |
||
|
|||
32 | |||
33 | $this->initialize(); |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * Init |
||
38 | */ |
||
39 | public function initialize() |
||
40 | { |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * POST request. |
||
45 | * |
||
46 | * @param $uri |
||
47 | * @param array $data |
||
48 | * @param array $options |
||
49 | * @return ResponseBag |
||
50 | */ |
||
51 | public function httpPost($uri, $data = [], $options = []) |
||
52 | { |
||
53 | return $this->request($uri, 'POST', array_merge($options, [ |
||
54 | 'form_params' => $data |
||
55 | ])); |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * JSON request. |
||
60 | * |
||
61 | * @param $uri |
||
62 | * @param array $data |
||
63 | * @param array $options |
||
64 | * @return ResponseBag |
||
65 | * @throws Exceptions\JsonParseException |
||
66 | */ |
||
67 | public function httpPostJson($uri, $data = [], $options = []) |
||
71 | ])); |
||
72 | } |
||
73 | |||
74 | /** |
||
75 | * @param string $method |
||
76 | * @param string $uri |
||
77 | * @param array $options |
||
78 | * @return ResponseBag |
||
79 | */ |
||
80 | public function request($uri, $method = 'GET', $options = []) |
||
94 |
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.