class AbstractStorage
WebDriver\AbstractStorage class
@package WebDriver
@method mixed getKey($key) Get key/value pair. @method void deleteKey($key) Delete a specific key. @method integer size() Get the number of items in the storage.
Hierarchy
- class \WebDriver\AbstractWebDriver
- class \WebDriver\Storage\AbstractStorage extends \WebDriver\AbstractWebDriver
Expanded class hierarchy of AbstractStorage
File
-
vendor/
lullabot/ php-webdriver/ lib/ WebDriver/ Storage/ AbstractStorage.php, line 26
Namespace
WebDriver\StorageView source
abstract class AbstractStorage extends AbstractWebDriver {
/**
* {@inheritdoc}
*/
protected function methods() {
return array(
'key' => array(
'GET',
'DELETE',
),
'size' => array(
'GET',
),
);
}
/**
* Get all keys from storage or a specific key/value pair
*
* @return mixed
*/
public function get() {
// get all keys
if (func_num_args() === 0) {
$result = $this->curl('GET', '');
return $result['value'];
}
// get key/value pair
if (func_num_args() === 1) {
return $this->getKey(func_get_arg(0));
}
throw WebDriverException::factory(WebDriverException::UNEXPECTED_PARAMETERS);
}
/**
* Set specific key/value pair
*
* @return \WebDriver\Storage\AbstractStorage
*
* @throw \WebDriver\Exception\UnexpectedParameters if unexpected parameters
*/
public function set() {
if (func_num_args() === 1 && is_array($arg = func_get_arg(0))) {
$this->curl('POST', '', $arg);
return $this;
}
if (func_num_args() === 2) {
$arg = array(
'key' => func_get_arg(0),
'value' => func_get_arg(1),
);
$this->curl('POST', '', $arg);
return $this;
}
throw WebDriverException::factory(WebDriverException::UNEXPECTED_PARAMETERS);
}
/**
* Delete storage or a specific key
*
* @return \WebDriver\Storage\AbstractStorage
*
* @throw \WebDriver\Exception\UnexpectedParameters if unexpected parameters
*/
public function delete() {
// delete storage
if (func_num_args() === 0) {
$this->curl('DELETE', '');
return $this;
}
// delete key from storage
if (func_num_args() === 1) {
$this->deleteKey(func_get_arg(0));
return $this;
}
throw WebDriverException::factory(WebDriverException::UNEXPECTED_PARAMETERS);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
AbstractStorage::delete | public | function | Delete storage or a specific key | ||
AbstractStorage::get | public | function | Get all keys from storage or a specific key/value pair | ||
AbstractStorage::methods | protected | function | Return array of supported method names and corresponding HTTP request methods | Overrides AbstractWebDriver::methods | |
AbstractStorage::set | public | function | Set specific key/value pair | ||
AbstractWebDriver::$curlService | private | property | Curl service | ||
AbstractWebDriver::$transientOptions | private | property | Transient options | ||
AbstractWebDriver::$url | protected | property | URL | ||
AbstractWebDriver::assertSerializable | private | function | Sanity check | ||
AbstractWebDriver::curl | protected | function | Curl request to webdriver server. | ||
AbstractWebDriver::getCurlService | public | function | Get curl service | ||
AbstractWebDriver::getRequestMethod | private | function | Get default HTTP request method for a given WebDriver command | ||
AbstractWebDriver::getTransientOptions | public | function | |||
AbstractWebDriver::getURL | public | function | Returns URL to Selenium server | ||
AbstractWebDriver::obsoleteMethods | protected | function | Return array of obsolete method names and corresponding HTTP request methods | 4 | |
AbstractWebDriver::offsetGet | private | function | Extract value from result | ||
AbstractWebDriver::setCurlService | public | function | Set curl service | ||
AbstractWebDriver::setTransientOptions | public | function | Set transient options | ||
AbstractWebDriver::__call | public | function | Magic method that maps calls to class methods to execute WebDriver commands | 1 | |
AbstractWebDriver::__construct | public | function | Constructor | 3 | |
AbstractWebDriver::__toString | public | function | Magic method which returns URL to Selenium server |