@@ -103,13 +103,15 @@ public function getURL()
103103 protected function curl ($ requestMethod , $ command , $ parameters = null , $ extraOptions = array ())
104104 {
105105 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+ );
113115 }
114116
115117 $ url = sprintf ('%s%s ' , $ this ->url , $ command );
@@ -154,9 +156,9 @@ protected function curl($requestMethod, $command, $parameters = null, $extraOpti
154156 public function __call ($ name , $ arguments )
155157 {
156158 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 '
160162 );
161163 }
162164
@@ -170,11 +172,14 @@ public function __call($name, $arguments)
170172
171173 $ methods = $ this ->methods ();
172174 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+ );
178183 }
179184
180185 $ results = $ this ->curl (
@@ -198,7 +203,8 @@ public function __call($name, $arguments)
198203 private function getRequestMethod ($ webdriverCommand )
199204 {
200205 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 ())
202208 ? WebDriverException::OBSOLETE_COMMAND : WebDriverException::UNKNOWN_COMMAND ,
203209 sprintf ('%s is not a valid WebDriver command. ' , $ webdriverCommand )
204210 );
0 commit comments