| Total Complexity | 3 |
| Total Lines | 41 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 5 | class MicrodataDOMDocument extends \DOMDocument |
||
| 6 | { |
||
| 7 | /** @var \DOMXPath */ |
||
| 8 | public $xpath; |
||
| 9 | |||
| 10 | /** |
||
| 11 | * Get top-level items of the document |
||
| 12 | * |
||
| 13 | * @see https://www.w3.org/TR/2018/WD-microdata-20180426/#dfn-top-level-microdata-item |
||
| 14 | * |
||
| 15 | * @return \DOMNodeList List of top level items as elements |
||
| 16 | */ |
||
| 17 | 39 | public function getItems() : \DOMNodeList |
|
| 18 | { |
||
| 19 | 39 | return $this->xpath->query('//*[@itemscope and not(@itemprop)]'); |
|
| 20 | } |
||
| 21 | |||
| 22 | /** |
||
| 23 | * {@inheritdoc} |
||
| 24 | * Also assigns $xpath with DOMXPath of freshly loaded DOMDocument |
||
| 25 | */ |
||
| 26 | 42 | public function loadHTML($source, $options = 0) |
|
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * {@inheritdoc} |
||
| 37 | * Also assigns $xpath with DOMXPath of freshly loaded DOMDocument |
||
| 38 | */ |
||
| 39 | 3 | public function loadHTMLFile($filename, $options = 0) |
|
| 48 |