Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
85.71% covered (warning)
85.71%
6 / 7
50.00% covered (danger)
50.00%
1 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
CaretAnnotation
85.71% covered (warning)
85.71%
6 / 7
50.00% covered (danger)
50.00%
1 / 2
4.05
0.00% covered (danger)
0.00%
0 / 1
 getSubtype
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 toPdf
83.33% covered (warning)
83.33%
5 / 6
0.00% covered (danger)
0.00%
0 / 1
3.04
1<?php
2
3declare(strict_types=1);
4
5namespace Phpdftk\Pdf\Core\Annotation;
6
7use Phpdftk\Pdf\Core\PdfArray;
8use Phpdftk\Pdf\Core\PdfName;
9use Phpdftk\Pdf\Core\PdfVersion;
10use Phpdftk\Pdf\Core\RequiresPdfVersion;
11
12/**
13 * Caret annotation (/Subtype /Caret).
14 */
15#[RequiresPdfVersion(PdfVersion::V1_5)]
16class 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}