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
ScreenAnnotation
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\PdfReference;
8use Phpdftk\Pdf\Core\PdfString;
9use Phpdftk\Pdf\Core\Serializable;
10use Phpdftk\Pdf\Core\PdfVersion;
11use Phpdftk\Pdf\Core\RequiresPdfVersion;
12
13/**
14 * Screen annotation (/Subtype /Screen).
15 */
16#[RequiresPdfVersion(PdfVersion::V1_5)]
17class ScreenAnnotation extends Annotation
18{
19    public ?PdfString $t = null;       // /T - title
20    public ?Serializable $mk = null;   // /MK - appearance characteristics
21    public ?PdfReference $a = null;    // /A - action
22    public ?PdfReference $aa = null;   // /AA - additional actions
23
24    public function getSubtype(): string
25    {
26        return 'Screen';
27    }
28
29    public function toPdf(): string
30    {
31        $dict = $this->buildDictionary();
32
33        if ($this->t !== null) {
34            $dict->set('T', $this->t);
35        }
36        if ($this->mk !== null) {
37            $dict->set('MK', $this->mk);
38        }
39        if ($this->a !== null) {
40            $dict->set('A', $this->a);
41        }
42        if ($this->aa !== null) {
43            $dict->set('AA', $this->aa);
44        }
45
46        return $dict->toPdf();
47    }
48}