Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| FloatItem | |
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\HtmlToPdf\Layout; |
| 6 | |
| 7 | /** |
| 8 | * One active float inside a {@see FloatContext}. Stored as a value |
| 9 | * object so {@see FloatContext} stays free of mutation accidents. |
| 10 | */ |
| 11 | final readonly class FloatItem |
| 12 | { |
| 13 | /** |
| 14 | * @param array<string, mixed>|null $shape CSS Shapes 1 §3 exclusion |
| 15 | * shape (a kind-keyed dict: `circle` / `ellipse` / `polygon` |
| 16 | * / `path`), or null for the float's bounding rectangle. |
| 17 | */ |
| 18 | public function __construct( |
| 19 | /** `'left'` or `'right'` per CSS 2.1 §9.5. */ |
| 20 | public string $side, |
| 21 | public float $left, |
| 22 | public float $top, |
| 23 | public float $width, |
| 24 | public float $height, |
| 25 | /** |
| 26 | * CSS Shapes 1 §3 — when set, describes a per-Y exclusion |
| 27 | * shape carved out of the float's box. The default `null` |
| 28 | * means "axis-aligned rectangle of width × height" (the |
| 29 | * pre-shapes behaviour). When non-null, `FloatContext`'s |
| 30 | * leftEdgeAt / rightEdgeAt evaluate the shape at the line's |
| 31 | * Y instead of using the bounding rect. |
| 32 | * |
| 33 | * `kind: 'circle'` carries center coordinates `(cx, cy)` |
| 34 | * relative to the FloatItem's top-left, plus radius `r`. |
| 35 | */ |
| 36 | public ?array $shape = null, |
| 37 | ) {} |
| 38 | } |