Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 5 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| ExtLinkExtractor | |
0.00% |
0 / 5 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
| getXPath | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| perform | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Flow\Parsoid\Extractor; |
| 4 | |
| 5 | use DOMElement; |
| 6 | use Flow\Model\Reference; |
| 7 | use Flow\Parsoid\Extractor; |
| 8 | use Flow\Parsoid\ReferenceFactory; |
| 9 | |
| 10 | /** |
| 11 | * Finds and creates References for external links in parsoid HTML |
| 12 | */ |
| 13 | class ExtLinkExtractor implements Extractor { |
| 14 | /** |
| 15 | * @inheritDoc |
| 16 | */ |
| 17 | public function getXPath() { |
| 18 | return '//a[contains(concat(" ",normalize-space(@rel)," ")," mw:ExtLink ")]'; |
| 19 | } |
| 20 | |
| 21 | /** |
| 22 | * @inheritDoc |
| 23 | */ |
| 24 | public function perform( ReferenceFactory $factory, DOMElement $element ) { |
| 25 | return $factory->createUrlReference( |
| 26 | Reference::TYPE_LINK, |
| 27 | urldecode( $element->getAttribute( 'href' ) ) |
| 28 | ); |
| 29 | } |
| 30 | } |