Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| ForeignElement | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Phpdftk\Svg; |
| 6 | |
| 7 | /** |
| 8 | * An element from a namespace other than SVG that appeared inside an |
| 9 | * SVG document — an XHTML `<div>`, a `<h:link rel="help">`, an RDF |
| 10 | * node in `<metadata>`. |
| 11 | * |
| 12 | * SVG 2 §5.7 (Foreign namespaces and private data): such an element |
| 13 | * and its DESCENDANTS are not rendered. Keeping them as a distinct |
| 14 | * type rather than a `GenericElement` is what lets the painter skip |
| 15 | * the whole subtree — without it, an `<svg>` nested inside an XHTML |
| 16 | * wrapper reached the painter through the generic |
| 17 | * "recurse into children" arm and painted. |
| 18 | * |
| 19 | * (Content inside `<foreignObject>` is the documented exception and is |
| 20 | * modelled by {@see ForeignObject}, not by this class.) |
| 21 | */ |
| 22 | final class ForeignElement extends Element |
| 23 | { |
| 24 | public function __construct(string $localName, public readonly ?string $namespaceUri = null) |
| 25 | { |
| 26 | parent::__construct($localName); |
| 27 | } |
| 28 | } |