Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
85.71% |
6 / 7 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| CaretAnnotation | |
85.71% |
6 / 7 |
|
50.00% |
1 / 2 |
4.05 | |
0.00% |
0 / 1 |
| getSubtype | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| toPdf | |
83.33% |
5 / 6 |
|
0.00% |
0 / 1 |
3.04 | |||
| 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\PdfVersion; |
| 10 | use Phpdftk\Pdf\Core\RequiresPdfVersion; |
| 11 | |
| 12 | /** |
| 13 | * Caret annotation (/Subtype /Caret). |
| 14 | */ |
| 15 | #[RequiresPdfVersion(PdfVersion::V1_5)] |
| 16 | class CaretAnnotation extends MarkupAnnotation |
| 17 | { |
| 18 | public ?PdfArray $rd = null; // /RD - rectangle differences |
| 19 | public ?PdfName $sy = null; // /Sy - symbol (None or P) |
| 20 | |
| 21 | public function getSubtype(): string |
| 22 | { |
| 23 | return 'Caret'; |
| 24 | } |
| 25 | |
| 26 | public function toPdf(): string |
| 27 | { |
| 28 | $dict = $this->buildDictionary(); |
| 29 | |
| 30 | if ($this->rd !== null) { |
| 31 | $dict->set('RD', $this->rd); |
| 32 | } |
| 33 | if ($this->sy !== null) { |
| 34 | $dict->set('Sy', $this->sy); |
| 35 | } |
| 36 | |
| 37 | return $dict->toPdf(); |
| 38 | } |
| 39 | } |