|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace SP\Spiderling; |
|
4
|
|
|
|
|
5
|
|
|
use SP\Spiderling\Query\AbstractQuery; |
|
6
|
|
|
use DomainException; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* @author Ivan Kerin <[email protected]> |
|
10
|
|
|
* @copyright 2015, Clippings Ltd. |
|
11
|
|
|
* @license http://spdx.org/licenses/BSD-3-Clause |
|
12
|
|
|
*/ |
|
13
|
|
|
class EmptyNode extends Node |
|
14
|
|
|
{ |
|
15
|
|
|
private $query; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* @param CrawlerInterface $crawler |
|
19
|
|
|
*/ |
|
20
|
1 |
|
public function __construct(CrawlerInterface $crawler, AbstractQuery $query = null) |
|
21
|
|
|
{ |
|
22
|
1 |
|
$this->query = $query; |
|
23
|
|
|
|
|
24
|
1 |
|
parent::__construct($crawler, null); |
|
25
|
1 |
|
} |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @param AbstractQuery $query |
|
29
|
|
|
* @return array |
|
30
|
|
|
*/ |
|
31
|
1 |
|
public function queryIds(AbstractQuery $query) |
|
32
|
|
|
{ |
|
33
|
1 |
|
return []; |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
// Accessors |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @param string $name |
|
40
|
|
|
* @return null |
|
41
|
|
|
*/ |
|
42
|
1 |
|
public function getAttribute($name) |
|
43
|
|
|
{ |
|
44
|
1 |
|
return null; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @return null |
|
49
|
|
|
*/ |
|
50
|
1 |
|
public function getText() |
|
51
|
|
|
{ |
|
52
|
1 |
|
return null; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* @return null |
|
57
|
|
|
*/ |
|
58
|
1 |
|
public function getHtml() |
|
59
|
|
|
{ |
|
60
|
1 |
|
return null; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* @return null |
|
65
|
|
|
*/ |
|
66
|
1 |
|
public function getValue() |
|
67
|
|
|
{ |
|
68
|
1 |
|
return null; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* @param string $value |
|
73
|
|
|
* @throws DomainException |
|
74
|
|
|
*/ |
|
75
|
1 |
|
public function setValue($value) |
|
76
|
|
|
{ |
|
77
|
1 |
|
throw new DomainException(sprintf('Cannot set value, element not found: %s', $this->query)); |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* @param string $file |
|
82
|
|
|
* @throws DomainException |
|
83
|
|
|
*/ |
|
84
|
1 |
|
public function setFile($file) |
|
85
|
|
|
{ |
|
86
|
1 |
|
throw new DomainException(sprintf('Cannot set file, element not found: %s', $this->query)); |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* @return boolean |
|
91
|
|
|
*/ |
|
92
|
1 |
|
public function isVisible() |
|
93
|
|
|
{ |
|
94
|
1 |
|
return false; |
|
95
|
|
|
} |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* @return boolean |
|
99
|
|
|
*/ |
|
100
|
1 |
|
public function isSelected() |
|
101
|
|
|
{ |
|
102
|
1 |
|
return false; |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
/** |
|
106
|
|
|
* @return boolean |
|
107
|
|
|
*/ |
|
108
|
1 |
|
public function isChecked() |
|
109
|
|
|
{ |
|
110
|
1 |
|
return false; |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
/** |
|
114
|
|
|
* @throws DomainException |
|
115
|
|
|
*/ |
|
116
|
1 |
|
public function click() |
|
117
|
|
|
{ |
|
118
|
1 |
|
throw new DomainException(sprintf('Cannot click, element not found: %s', $this->query)); |
|
119
|
|
|
} |
|
120
|
|
|
|
|
121
|
|
|
/** |
|
122
|
|
|
* @throws DomainException |
|
123
|
|
|
*/ |
|
124
|
1 |
|
public function select() |
|
125
|
|
|
{ |
|
126
|
1 |
|
throw new DomainException(sprintf('Cannot select, element not found: %s', $this->query)); |
|
127
|
|
|
} |
|
128
|
|
|
} |
|
129
|
|
|
|