Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
PopupAnnotation
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
2 / 2
4
100.00% covered (success)
100.00%
1 / 1
 getSubtype
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 toPdf
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
3
1<?php
2
3declare(strict_types=1);
4
5namespace Phpdftk\Pdf\Core\Annotation;
6
7use Phpdftk\Pdf\Core\PdfBoolean;
8use Phpdftk\Pdf\Core\PdfReference;
9use Phpdftk\Pdf\Core\PdfVersion;
10use Phpdftk\Pdf\Core\RequiresPdfVersion;
11
12/**
13 * Popup annotation (/Subtype /Popup).
14 * Displays the pop-up window for a parent annotation's text.
15 */
16#[RequiresPdfVersion(PdfVersion::V1_3)]
17class PopupAnnotation extends Annotation
18{
19    public ?PdfReference $parent = null; // /Parent
20    public ?bool $open = null;           // /Open
21
22    public function getSubtype(): string
23    {
24        return 'Popup';
25    }
26
27    public function toPdf(): string
28    {
29        $dict = $this->buildDictionary();
30
31        if ($this->parent !== null) {
32            $dict->set('Parent', $this->parent);
33        }
34        if ($this->open !== null) {
35            $dict->set('Open', new PdfBoolean($this->open));
36        }
37
38        return $dict->toPdf();
39    }
40}