1 | <?php |
||
14 | class Driver_Selenium_Connection |
||
15 | { |
||
16 | /** |
||
17 | * The current selenium session id |
||
18 | * @var string |
||
19 | */ |
||
20 | protected $_session_id; |
||
21 | |||
22 | /** |
||
23 | * The selenium server url |
||
24 | * @var string |
||
25 | */ |
||
26 | protected $_server = 'http://localhost:4444/wd/hub/'; |
||
27 | |||
28 | 13 | public function server($server = NULL) |
|
29 | { |
||
30 | 13 | if ($server !== NULL) |
|
31 | 13 | { |
|
32 | 1 | $this->_server = $server; |
|
33 | 1 | return $this; |
|
34 | } |
||
35 | 13 | return $this->_server; |
|
36 | } |
||
37 | |||
38 | 2 | public function __construct($server = NULL) |
|
39 | { |
||
40 | if ($server) |
||
41 | 2 | { |
|
42 | 1 | $this->server($server); |
|
43 | 1 | } |
|
44 | 2 | } |
|
45 | |||
46 | /** |
||
47 | * Start a new selenium session, based on passed desired capabilities. |
||
48 | * Reuses the session if possible |
||
49 | * |
||
50 | * @param array $desiredCapabilities |
||
51 | */ |
||
52 | 2 | public function start(array $desiredCapabilities = NULL) |
|
53 | { |
||
54 | 2 | if ( ! ($this->_session_id = $this->reuse_session())) |
|
55 | 2 | { |
|
56 | 1 | $this->_session_id = $this->new_session($desiredCapabilities); |
|
|
|||
57 | 1 | } |
|
58 | |||
59 | 2 | $this->_server .= "session/{$this->_session_id}/"; |
|
60 | 2 | } |
|
61 | |||
62 | /** |
||
63 | * Check if a session has been started |
||
64 | * @return boolean |
||
65 | */ |
||
66 | 2 | public function is_started() |
|
70 | |||
71 | /** |
||
72 | * Try to reuse an existing selenium session, return the reused id |
||
73 | * @return string |
||
74 | */ |
||
75 | 2 | public function reuse_session() |
|
95 | |||
96 | /** |
||
97 | * Initiate a new session, based on the desired capabilities |
||
98 | * @param array $desiredCapabilities |
||
99 | * @return new session |
||
100 | */ |
||
101 | 1 | public function new_session(array $desiredCapabilities = NULL) |
|
111 | |||
112 | /** |
||
113 | * Perform a get request to the selenium server |
||
114 | * @param string $command |
||
115 | * @return mixed |
||
116 | */ |
||
117 | 12 | public function get($command) |
|
118 | { |
||
119 | 12 | return $this->call($command); |
|
120 | } |
||
121 | |||
122 | /** |
||
123 | * Perform a post request to the selenium server |
||
124 | * @param string $command |
||
125 | * @param array $params |
||
126 | * @return mixed |
||
127 | */ |
||
128 | 10 | public function post($command, array $params) |
|
139 | |||
140 | /** |
||
141 | * Perform a delete request to the selenium server |
||
142 | * @param string $command |
||
143 | * @return mixed |
||
144 | */ |
||
145 | 1 | public function delete($command) |
|
152 | |||
153 | /** |
||
154 | * Perform a request to the selenium server, using curl |
||
155 | * @param string $command |
||
156 | * @param array $options curl options |
||
157 | * @return mixed |
||
158 | */ |
||
159 | 13 | public function call($command, array $options = array()) |
|
191 | } |
||
192 |
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..