1 | <?php |
||
30 | class BrowserMob extends Module |
||
31 | { |
||
32 | |||
33 | /** |
||
34 | * @var string[] $config |
||
35 | */ |
||
36 | protected $config = ['host', 'port', 'autostart', 'blacklist', 'whitelist', 'limits', 'timeouts', 'dns', 'retry', 'basicAuth', 'littleproxy']; |
||
37 | |||
38 | /** |
||
39 | * @var string[] $requiredFields |
||
40 | */ |
||
41 | protected $requiredFields = ['host', 'port']; |
||
42 | |||
43 | /** |
||
44 | * @var Requests $response |
||
45 | */ |
||
46 | protected $response; |
||
47 | |||
48 | /** |
||
49 | * @var PHPBrowserMobProxy_Client $bmp |
||
50 | */ |
||
51 | private $bmp; |
||
52 | |||
53 | /** |
||
54 | * @codeCoverageIgnore |
||
55 | * @ignore Codeception specific |
||
56 | */ |
||
57 | public function _initialize() |
||
75 | |||
76 | /** |
||
77 | * Verify if the BrowserMobProxy is reachable |
||
78 | * |
||
79 | * @param string $host BrowserMob Proxy host, format host:port |
||
80 | * |
||
81 | * @return boolean Returns true if proxy available, else false |
||
82 | */ |
||
83 | protected static function __pingProxy($host) |
||
93 | |||
94 | /** |
||
95 | * Set proxy capabilitites: blacklist, whitelist, limits, timeouts, dns, retry, basicAuth |
||
96 | * |
||
97 | * @uses BrowserMob::_blacklist |
||
98 | * @uses BrowserMob::_whitelist |
||
99 | * @uses BrowserMob::_limits |
||
100 | * @uses BrowserMob::_timeouts |
||
101 | * @uses BrowserMob::_remapHosts |
||
102 | * @uses BrowserMob::_retry |
||
103 | * @uses BrowserMob::_basicAuth |
||
104 | * |
||
105 | * @param mixed[] $options Array of options (see extension configuration) |
||
106 | * |
||
107 | * @return void |
||
108 | */ |
||
109 | protected function __setProxyCapabilities($options) |
||
148 | |||
149 | /** |
||
150 | * Return current proxy port opened on BrowserMobProxy |
||
151 | * |
||
152 | * @return integer Proxy port |
||
153 | */ |
||
154 | public function getProxyPort() |
||
158 | |||
159 | /** |
||
160 | * Set current proxy port to use on BrowserMobProxy |
||
161 | * |
||
162 | * @param integer $port Proxy port |
||
163 | */ |
||
164 | public function setProxyPort($port) |
||
170 | |||
171 | /** |
||
172 | * Open a new proxy on BrowserMobProxy |
||
173 | * |
||
174 | * @see BrowserMob::__setProxyCapabilities |
||
175 | * |
||
176 | * @uses BrowserMob::_open |
||
177 | * @uses BrowserMob::__setProxyCapabilities |
||
178 | * @uses BrowserMob::getProxyPort |
||
179 | * |
||
180 | * @param mixed[]|null $capabilities Array of capabilities. Use extension configuration if null |
||
181 | * |
||
182 | * @return integer Proxy port |
||
183 | */ |
||
184 | public function openProxy($capabilities = null) |
||
193 | |||
194 | /** |
||
195 | * Close the current proxy opened BrowserMobProxy |
||
196 | * Not supported by library chartjes/php-browsermob-proxy |
||
197 | * |
||
198 | * @uses BrowserMob::_close |
||
199 | * |
||
200 | * @return void |
||
201 | */ |
||
202 | public function closeProxy() |
||
206 | |||
207 | /** |
||
208 | * Start to capture the HTTP archive |
||
209 | * |
||
210 | * @uses BrowserMob::_newHar |
||
211 | * |
||
212 | * @param string|null $label Title of first HAR page |
||
213 | * |
||
214 | * @return boolean Command status |
||
215 | */ |
||
216 | public function startHar($label = '') |
||
221 | |||
222 | /** |
||
223 | * Add a new page to the HTTP archive |
||
224 | * |
||
225 | * @uses BrowserMob::_newPage |
||
226 | * |
||
227 | * @param string|null $label Title of new HAR page |
||
228 | * |
||
229 | * @return boolean Command status |
||
230 | */ |
||
231 | public function addPage($label = '') |
||
236 | |||
237 | /** |
||
238 | * Get the HTTP archive captured |
||
239 | * |
||
240 | * @return mixed[] HTTP archive |
||
241 | */ |
||
242 | public function getHar() |
||
246 | |||
247 | /** |
||
248 | * Override HTTP request headers |
||
249 | * |
||
250 | * @uses BrowserMob::_headers |
||
251 | * |
||
252 | * @param string[] $headers Array of HTTP headers |
||
253 | * |
||
254 | * @return boolean Command status |
||
255 | */ |
||
256 | public function setHeaders($headers) |
||
261 | |||
262 | /** |
||
263 | * Rewrite URLs with regex |
||
264 | * |
||
265 | * @uses BrowserMob::_rewriteUrl |
||
266 | * |
||
267 | * @param string $match Matching URL regular expression |
||
268 | * @param string $replace Replacement URL |
||
269 | * |
||
270 | * @return boolean Command status |
||
271 | */ |
||
272 | public function redirectUrl($match, $replace) |
||
277 | |||
278 | /** |
||
279 | * Run Javascript against requests before sending them |
||
280 | * |
||
281 | * @param string $script Javascript code |
||
282 | * |
||
283 | * @return boolean Command status |
||
284 | */ |
||
285 | public function filterRequest($script) |
||
290 | |||
291 | /** |
||
292 | * Run Javascript against responses received |
||
293 | * |
||
294 | * @param string $script Javascript code |
||
295 | * |
||
296 | * @return boolean Command status |
||
297 | */ |
||
298 | public function filterResponse($script) |
||
303 | |||
304 | /** |
||
305 | * Magic function that exposes BrowserMobProxy API pulic methods |
||
306 | * |
||
307 | * @ignore Exclude from documentation |
||
308 | */ |
||
309 | public function __call($name, $args) |
||
335 | |||
336 | } |
||
337 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..