1 | <?php |
||
30 | class Request |
||
31 | { |
||
32 | const REQUEST_TIMEOUT = 15.0; |
||
33 | |||
34 | /** |
||
35 | * If true, SSL does not have to be verified |
||
36 | * |
||
37 | * @var boolean |
||
38 | */ |
||
39 | protected $insecure = false; |
||
40 | |||
41 | /** |
||
42 | * The base URL of the Magento application |
||
43 | * |
||
44 | * @var string |
||
45 | */ |
||
46 | protected $url; |
||
47 | |||
48 | /** |
||
49 | * Client cache |
||
50 | * |
||
51 | * @var GuzzleHttp\Client |
||
52 | */ |
||
53 | protected $client; |
||
54 | |||
55 | /** |
||
56 | * Initialize request object |
||
57 | * |
||
58 | * @param string $baseUri |
||
59 | * @param boolean $verify |
||
60 | */ |
||
61 | public function __construct($baseUri = false, $verify = true) |
||
73 | |||
74 | /** |
||
75 | * Get the base url of this request |
||
76 | * |
||
77 | * @return string |
||
78 | */ |
||
79 | public function getUrl() |
||
83 | |||
84 | /** |
||
85 | * Get a path |
||
86 | * |
||
87 | * @param string|boolean $path |
||
88 | * @param array $params |
||
89 | * |
||
90 | * @return GuzzleHttp\Psr7\Response |
||
91 | */ |
||
92 | public function get($path = false, array $params = []) |
||
96 | |||
97 | /** |
||
98 | * Get many paths asyncronously |
||
99 | * |
||
100 | * @param string[] $paths |
||
101 | * @param array $params |
||
102 | * |
||
103 | * @return GuzzleHttp\Psr7\Response[] |
||
104 | */ |
||
105 | public function getMany($paths, array $params = []) |
||
113 | |||
114 | /** |
||
115 | * Post to a path |
||
116 | * |
||
117 | * @param string $path |
||
118 | * @param array $params |
||
119 | * |
||
120 | * @return GuzzleHttp\Psr7\Response |
||
121 | */ |
||
122 | public function post($path, array $params = []) |
||
126 | |||
127 | /** |
||
128 | * Manipulate header data into a parsable format |
||
129 | * |
||
130 | * @param string $rawData |
||
131 | * |
||
132 | * @return array |
||
133 | */ |
||
134 | public function parseHeader($rawData) |
||
147 | |||
148 | /** |
||
149 | * Parse out the count from the response |
||
150 | * |
||
151 | * @param string $response |
||
152 | * @param string $pattern |
||
153 | * @param boolean $returnAll |
||
154 | * |
||
155 | * @return string|array|boolean |
||
156 | */ |
||
157 | public function findMatchInResponse($response, $pattern, $returnAll = false) |
||
169 | } |
||
170 |
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 mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountId
that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theid
property of an instance of theAccount
class. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.