Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
81.82% covered (warning)
81.82%
9 / 11
50.00% covered (danger)
50.00%
1 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
TrapNetAnnotation
81.82% covered (warning)
81.82%
9 / 11
50.00% covered (danger)
50.00%
1 / 2
6.22
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
80.00% covered (warning)
80.00%
8 / 10
0.00% covered (danger)
0.00%
0 / 1
5.20
1<?php
2
3declare(strict_types=1);
4
5namespace Phpdftk\Pdf\Core\Annotation;
6
7use Phpdftk\Pdf\Core\PdfArray;
8use Phpdftk\Pdf\Core\PdfNumber;
9use Phpdftk\Pdf\Core\PdfString;
10use Phpdftk\Pdf\Core\PdfVersion;
11use Phpdftk\Pdf\Core\RequiresPdfVersion;
12
13/**
14 * TrapNet annotation (/Subtype /TrapNet).
15 */
16#[RequiresPdfVersion(PdfVersion::V1_3)]
17class TrapNetAnnotation extends Annotation
18{
19    public ?PdfString $lastModified = null;  // /LastModified
20    public ?PdfNumber $version = null;       // /Version
21    public ?PdfArray $annotStates = null;    // /AnnotStates
22    public ?PdfArray $fontFauxing = null;    // /FontFauxing
23
24    public function getSubtype(): string
25    {
26        return 'TrapNet';
27    }
28
29    public function toPdf(): string
30    {
31        $dict = $this->buildDictionary();
32
33        if ($this->lastModified !== null) {
34            $dict->set('LastModified', $this->lastModified);
35        }
36        if ($this->version !== null) {
37            $dict->set('Version', $this->version);
38        }
39        if ($this->annotStates !== null) {
40            $dict->set('AnnotStates', $this->annotStates);
41        }
42        if ($this->fontFauxing !== null) {
43            $dict->set('FontFauxing', $this->fontFauxing);
44        }
45
46        return $dict->toPdf();
47    }
48}