/
WebDriverCommand.php
60 lines (53 loc) · 1.37 KB
/
WebDriverCommand.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
namespace Facebook\WebDriver\Remote;
class WebDriverCommand
{
/** @var string|null */
protected $sessionID;
/** @var string */
protected $name;
/** @var array */
protected $parameters;
/**
* @param string $session_id
* @param string $name Constant from DriverCommand
* @param array $parameters
* @todo In 2.0 force parameters to be an array, then remove is_array() checks in HttpCommandExecutor
* @todo In 2.0 make constructor private. Use by default static `::create()` with sessionID type string.
*/
public function __construct($session_id, $name, $parameters)
{
$this->sessionID = $session_id;
$this->name = $name;
$this->parameters = $parameters;
}
/**
* @return self
*/
public static function newSession(array $parameters)
{
// TODO: In 2.0 call empty constructor and assign properties directly.
return new self(null, DriverCommand::NEW_SESSION, $parameters);
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @return string|null Could be null for newSession command
*/
public function getSessionID()
{
return $this->sessionID;
}
/**
* @return array
*/
public function getParameters()
{
return $this->parameters;
}
}