function AbstractWebDriver::__call
Magic method that maps calls to class methods to execute WebDriver commands
Parameters
string $name Method name:
array $arguments Arguments:
Return value
mixed
Throws
\WebDriver\Exception if invalid WebDriver command
2 calls to AbstractWebDriver::__call()
- Container::__call in vendor/
lullabot/ php-webdriver/ lib/ WebDriver/ Container.php - Magic method that maps calls to class methods to execute WebDriver commands
- Container::__call in vendor/
lullabot/ php-webdriver/ lib/ WebDriver/ Container.php - Magic method that maps calls to class methods to execute WebDriver commands
1 method overrides AbstractWebDriver::__call()
- Container::__call in vendor/
lullabot/ php-webdriver/ lib/ WebDriver/ Container.php - Magic method that maps calls to class methods to execute WebDriver commands
File
-
vendor/
lullabot/ php-webdriver/ lib/ WebDriver/ AbstractWebDriver.php, line 255
Class
- AbstractWebDriver
- Abstract WebDriver\AbstractWebDriver class
Namespace
WebDriverCode
public function __call($name, $arguments) {
if (count($arguments) > 1) {
throw WebDriverException::factory(WebDriverException::JSON_PARAMETERS_EXPECTED, 'Commands should have at most only one parameter, which should be the JSON Parameter object');
}
if (preg_match('/^(get|post|delete)/', $name, $matches)) {
$requestMethod = strtoupper($matches[0]);
$webdriverCommand = strtolower(substr($name, strlen($requestMethod)));
$this->getRequestMethod($webdriverCommand);
// validation
}
else {
$webdriverCommand = $name;
$requestMethod = $this->getRequestMethod($webdriverCommand);
}
$methods = $this->methods();
if (!in_array($requestMethod, (array) $methods[$webdriverCommand])) {
throw WebDriverException::factory(WebDriverException::INVALID_REQUEST, sprintf('%s is not an available http request method for the command %s.', $requestMethod, $webdriverCommand));
}
$result = $this->curl($requestMethod, '/' . $webdriverCommand, array_shift($arguments));
return $result['value'];
}