Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
15 / 15 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| PolygonAnnotation | |
100.00% |
15 / 15 |
|
100.00% |
2 / 2 |
8 | |
100.00% |
1 / 1 |
| getSubtype | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| toPdf | |
100.00% |
14 / 14 |
|
100.00% |
1 / 1 |
7 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Phpdftk\Pdf\Core\Annotation; |
| 6 | |
| 7 | use Phpdftk\Pdf\Core\PdfArray; |
| 8 | use Phpdftk\Pdf\Core\PdfName; |
| 9 | use Phpdftk\Pdf\Core\PdfReference; |
| 10 | use Phpdftk\Pdf\Core\Serializable; |
| 11 | use Phpdftk\Pdf\Core\PdfVersion; |
| 12 | use Phpdftk\Pdf\Core\RequiresPdfVersion; |
| 13 | |
| 14 | /** |
| 15 | * Polygon annotation (/Subtype /Polygon). |
| 16 | */ |
| 17 | #[RequiresPdfVersion(PdfVersion::V1_5)] |
| 18 | class PolygonAnnotation extends MarkupAnnotation |
| 19 | { |
| 20 | public ?PdfArray $vertices = null; // /Vertices |
| 21 | public ?PdfArray $le = null; // /LE - line ending styles |
| 22 | public ?PdfArray $ic = null; // /IC - interior color |
| 23 | public ?Serializable $be = null; // /BE - border effect |
| 24 | public ?PdfName $it = null; // /IT - intent |
| 25 | public ?PdfReference $measure = null; // /Measure |
| 26 | |
| 27 | public function getSubtype(): string |
| 28 | { |
| 29 | return 'Polygon'; |
| 30 | } |
| 31 | |
| 32 | public function toPdf(): string |
| 33 | { |
| 34 | $dict = $this->buildDictionary(); |
| 35 | |
| 36 | if ($this->vertices !== null) { |
| 37 | $dict->set('Vertices', $this->vertices); |
| 38 | } |
| 39 | if ($this->le !== null) { |
| 40 | $dict->set('LE', $this->le); |
| 41 | } |
| 42 | if ($this->ic !== null) { |
| 43 | $dict->set('IC', $this->ic); |
| 44 | } |
| 45 | if ($this->be !== null) { |
| 46 | $dict->set('BE', $this->be); |
| 47 | } |
| 48 | if ($this->it !== null) { |
| 49 | $dict->set('IT', $this->it); |
| 50 | } |
| 51 | if ($this->measure !== null) { |
| 52 | $dict->set('Measure', $this->measure); |
| 53 | } |
| 54 | |
| 55 | return $dict->toPdf(); |
| 56 | } |
| 57 | } |