Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
81.82% |
9 / 11 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| CircleAnnotation | |
81.82% |
9 / 11 |
|
50.00% |
1 / 2 |
6.22 | |
0.00% |
0 / 1 |
| getSubtype | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| toPdf | |
80.00% |
8 / 10 |
|
0.00% |
0 / 1 |
5.20 | |||
| 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\PdfReference; |
| 9 | use Phpdftk\Pdf\Core\Serializable; |
| 10 | use Phpdftk\Pdf\Core\PdfVersion; |
| 11 | use Phpdftk\Pdf\Core\RequiresPdfVersion; |
| 12 | |
| 13 | /** |
| 14 | * Circle annotation (/Subtype /Circle). |
| 15 | */ |
| 16 | #[RequiresPdfVersion(PdfVersion::V1_3)] |
| 17 | class CircleAnnotation extends MarkupAnnotation |
| 18 | { |
| 19 | public ?PdfArray $ic = null; // /IC - interior color |
| 20 | public ?Serializable $be = null; // /BE - border effect |
| 21 | public ?PdfArray $rd = null; // /RD - rectangle differences |
| 22 | public ?PdfReference $measure = null; // /Measure |
| 23 | |
| 24 | public function getSubtype(): string |
| 25 | { |
| 26 | return 'Circle'; |
| 27 | } |
| 28 | |
| 29 | public function toPdf(): string |
| 30 | { |
| 31 | $dict = $this->buildDictionary(); |
| 32 | |
| 33 | if ($this->ic !== null) { |
| 34 | $dict->set('IC', $this->ic); |
| 35 | } |
| 36 | if ($this->be !== null) { |
| 37 | $dict->set('BE', $this->be); |
| 38 | } |
| 39 | if ($this->rd !== null) { |
| 40 | $dict->set('RD', $this->rd); |
| 41 | } |
| 42 | if ($this->measure !== null) { |
| 43 | $dict->set('Measure', $this->measure); |
| 44 | } |
| 45 | |
| 46 | return $dict->toPdf(); |
| 47 | } |
| 48 | } |