FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
php-webdriver/lib/Remote/CustomWebDriverCommand.php at main · php-webdriver/php-webdriver · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
php-webdriver
/
php-webdriver
Public
Notifications
You must be signed in to change notification settings
Fork
842
Star
5.2k
Code
Issues
21
Pull requests
9
Discussions
Actions
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
php-webdriver
/
lib
/
Remote
/
CustomWebDriverCommand.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
82 lines (70 loc) · 2.17 KB
Breadcrumbs
php-webdriver
/
lib
/
Remote
/
CustomWebDriverCommand.php
Copy path
File metadata and controls
82 lines (70 loc) · 2.17 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
namespace
Facebook
\
WebDriver
\
Remote
;
use
Facebook
\
WebDriver
\
Exception
\
Internal
\
LogicException
;
use
Facebook
\
WebDriver
\
Exception
\
WebDriverException
;
class
CustomWebDriverCommand
extends
WebDriverCommand
{
public
const
METHOD_GET
=
'
GET
'
;
public
const
METHOD_POST
=
'
POST
'
;
/** @var string */
private
$
customUrl
;
/** @var string */
private
$
customMethod
;
/**
* @param string $session_id
* @param string $url
* @param string $method
*/
public
function
__construct
(
$
session_id
,
$
url
,
$
method
,
array
$
parameters
)
{
$
this
->
setCustomRequestParameters
(
$
url
,
$
method
);
parent
::
__construct
(
$
session_id
, DriverCommand::
CUSTOM_COMMAND
,
$
parameters
);
}
/**
* @throws WebDriverException
* @return string
*/
public
function
getCustomUrl
()
{
if
(
$
this
->
customUrl
===
null
) {
throw
LogicException::
forError
(
'
URL of custom command is not set
'
);
}
return
$
this
->
customUrl
;
}
/**
* @throws WebDriverException
* @return string
*/
public
function
getCustomMethod
()
{
if
(
$
this
->
customMethod
===
null
) {
throw
LogicException::
forError
(
'
Method of custom command is not set
'
);
}
return
$
this
->
customMethod
;
}
/**
* @param string $custom_url
* @param string $custom_method
* @throws WebDriverException
*/
protected
function
setCustomRequestParameters
(
$
custom_url
,
$
custom_method
)
{
$
allowedMethods
= [
static
::
METHOD_GET
,
static
::
METHOD_POST
];
if
(!
in_array
(
$
custom_method
,
$
allowedMethods
,
true
)) {
throw
LogicException::
forError
(
sprintf
(
'
Invalid custom method "%s", must be one of [%s]
'
,
$
custom_method
,
implode
(
'
,
'
,
$
allowedMethods
)
)
);
}
$
this
->
customMethod
=
$
custom_method
;
if
(
mb_strpos
(
$
custom_url
,
'
/
'
) !==
0
) {
throw
LogicException::
forError
(
sprintf
(
'
URL of custom command has to start with / but is "%s"
'
,
$
custom_url
)
);
}
$
this
->
customUrl
=
$
custom_url
;
}
}
Back
|
FazBrowse Home
|
New Git URL