@@ -103,13 +103,15 @@ public function getURL()
103
103
protected function curl ($ requestMethod , $ command , $ parameters = null , $ extraOptions = array ())
104
104
{
105
105
if ($ parameters && is_array ($ parameters ) && $ requestMethod !== 'POST ' ) {
106
- throw WebDriverException::factory (WebDriverException::NO_PARAMETERS_EXPECTED , sprintf (
107
- 'The http request method called for %s is %s but it has to be POST ' .
108
- ' if you want to pass the JSON parameters %s ' ,
109
- $ command ,
110
- $ requestMethod ,
111
- json_encode ($ parameters )
112
- ));
106
+ throw WebDriverException::factory (
107
+ WebDriverException::NO_PARAMETERS_EXPECTED ,
108
+ sprintf (
109
+ 'The http request method called for %s is %s but it has to be POST if you want to pass the JSON parameters %s ' ,
110
+ $ command ,
111
+ $ requestMethod ,
112
+ json_encode ($ parameters )
113
+ )
114
+ );
113
115
}
114
116
115
117
$ url = sprintf ('%s%s ' , $ this ->url , $ command );
@@ -154,9 +156,9 @@ protected function curl($requestMethod, $command, $parameters = null, $extraOpti
154
156
public function __call ($ name , $ arguments )
155
157
{
156
158
if (count ($ arguments ) > 1 ) {
157
- throw WebDriverException::factory (WebDriverException:: JSON_PARAMETERS_EXPECTED ,
158
- ' Commands should have at most only one parameter, ' .
159
- ' which should be the JSON Parameter object '
159
+ throw WebDriverException::factory (
160
+ WebDriverException:: JSON_PARAMETERS_EXPECTED ,
161
+ 'Commands should have at most only one parameter, which should be the JSON Parameter object '
160
162
);
161
163
}
162
164
@@ -170,11 +172,14 @@ public function __call($name, $arguments)
170
172
171
173
$ methods = $ this ->methods ();
172
174
if (!in_array ($ requestMethod , (array ) $ methods [$ webdriverCommand ])) {
173
- throw WebDriverException::factory (WebDriverException::INVALID_REQUEST , sprintf (
174
- '%s is not an available http request method for the command %s. ' ,
175
- $ requestMethod ,
176
- $ webdriverCommand
177
- ));
175
+ throw WebDriverException::factory (
176
+ WebDriverException::INVALID_REQUEST ,
177
+ sprintf (
178
+ '%s is not an available http request method for the command %s. ' ,
179
+ $ requestMethod ,
180
+ $ webdriverCommand
181
+ )
182
+ );
178
183
}
179
184
180
185
$ results = $ this ->curl (
@@ -198,7 +203,8 @@ public function __call($name, $arguments)
198
203
private function getRequestMethod ($ webdriverCommand )
199
204
{
200
205
if (!array_key_exists ($ webdriverCommand , $ this ->methods ())) {
201
- throw WebDriverException::factory (array_key_exists ($ webdriverCommand , $ this ->obsoleteMethods ())
206
+ throw WebDriverException::factory (
207
+ array_key_exists ($ webdriverCommand , $ this ->obsoleteMethods ())
202
208
? WebDriverException::OBSOLETE_COMMAND : WebDriverException::UNKNOWN_COMMAND ,
203
209
sprintf ('%s is not a valid WebDriver command. ' , $ webdriverCommand )
204
210
);
0 commit comments