EmptyNode::getText()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
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
    public function __construct(CrawlerInterface $crawler, AbstractQuery $query = null)
21
    {
22
        $this->query = $query;
23
24
        parent::__construct($crawler, null);
25
    }
26
27
    /**
28
     * @param  AbstractQuery $query
29
     * @return array
30
     */
31 1
    public function queryIds(AbstractQuery $query)
32
    {
33 1
        return [];
34 1
    }
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
    public function setValue($value)
76
    {
77
        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
    public function setFile($file)
85
    {
86
        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
    public function click()
117
    {
118
        throw new DomainException(sprintf('Cannot click, element not found: %s', $this->query));
119
    }
120
121
    /**
122
     * @throws DomainException
123
     */
124
    public function select()
125
    {
126
        throw new DomainException(sprintf('Cannot select, element not found: %s', $this->query));
127
    }
128
}
129