Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
80.00% |
4 / 5 |
|
75.00% |
3 / 4 |
CRAP | |
0.00% |
0 / 1 |
| FeImage | |
80.00% |
4 / 5 |
|
75.00% |
3 / 4 |
4.13 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| href | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| preserveAspectRatio | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| crossOrigin | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Phpdftk\Svg\Filter; |
| 6 | |
| 7 | /** |
| 8 | * SVG 2 Filter Effects §15.9 — `<feImage href preserveAspectRatio>`. |
| 9 | * Loads an external image (or references an in-document element by |
| 10 | * fragment) and uses it as the primitive's output. The legacy |
| 11 | * `xlink:href` attribute is also recognised. |
| 12 | */ |
| 13 | final class FeImage extends FilterPrimitive |
| 14 | { |
| 15 | public function __construct() |
| 16 | { |
| 17 | parent::__construct('feImage'); |
| 18 | } |
| 19 | |
| 20 | public function href(): ?string |
| 21 | { |
| 22 | return $this->getAttribute('href') |
| 23 | ?? $this->getAttribute('xlink:href'); |
| 24 | } |
| 25 | |
| 26 | public function preserveAspectRatio(): ?string |
| 27 | { |
| 28 | return $this->getAttribute('preserveAspectRatio'); |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * `crossorigin` is the standard fetch CORS hint. For server- |
| 33 | * side print rendering the value is informational; we surface |
| 34 | * it on the typed accessor for tooling consumers. |
| 35 | */ |
| 36 | public function crossOrigin(): ?string |
| 37 | { |
| 38 | return $this->getAttribute('crossorigin'); |
| 39 | } |
| 40 | } |