1 | <?php |
||
15 | class InputMap |
||
16 | { |
||
17 | private static $inputClasses = [ |
||
18 | 'SP\Crawler\Element\Checkbox' => 'self::input[@type="checkbox"]', |
||
19 | 'SP\Crawler\Element\Radio' => 'self::input[@type="radio"]', |
||
20 | 'SP\Crawler\Element\File' => 'self::input[@type="file"]', |
||
21 | 'SP\Crawler\Element\Input' => 'self::input', |
||
22 | 'SP\Crawler\Element\Select' => 'self::select', |
||
23 | 'SP\Crawler\Element\Textarea' => 'self::textarea', |
||
24 | 'SP\Crawler\Element\Option' => 'self::option', |
||
25 | 'SP\Crawler\Element\Anchor' => 'self::a', |
||
26 | 'SP\Crawler\Element\Submit' => 'self::*[@type="submit" and (self::input or self::button)]', |
||
27 | ]; |
||
28 | |||
29 | /** |
||
30 | * @return array |
||
31 | */ |
||
32 | public static function getInputClasses() |
||
36 | |||
37 | /** |
||
38 | * @var Reader |
||
39 | */ |
||
40 | private $reader; |
||
41 | |||
42 | /** |
||
43 | * @var SplObjectStorage |
||
44 | */ |
||
45 | private $items; |
||
46 | |||
47 | /** |
||
48 | * @param Reader $reader |
||
49 | */ |
||
50 | public function __construct(Reader $reader) |
||
55 | |||
56 | /** |
||
57 | * @return Reader |
||
58 | */ |
||
59 | public function getReader() |
||
63 | |||
64 | /** |
||
65 | * @param DOMElement $element |
||
66 | * @param string $xpath |
||
67 | * @return boolean |
||
68 | */ |
||
69 | public function inputMatches(DOMElement $element, $xpath) |
||
73 | |||
74 | /** |
||
75 | * @param DOMElement $element |
||
76 | * @throws InvalidArgumentException |
||
77 | * @return string |
||
78 | */ |
||
79 | public function getInputClass(DOMElement $element) |
||
89 | |||
90 | /** |
||
91 | * @param DOMElement $element |
||
92 | * @throws InvalidArgumentException |
||
93 | * @return Element\AbstractElement |
||
94 | */ |
||
95 | public function create(DOMElement $element) |
||
101 | |||
102 | /** |
||
103 | * @param DOMElement $element |
||
104 | * @return Element\AbstractElement |
||
105 | */ |
||
106 | public function get(DOMElement $element) |
||
114 | } |
||
115 |