Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
88.89% covered (warning)
88.89%
8 / 9
50.00% covered (danger)
50.00%
1 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
MovieAnnotation
88.89% covered (warning)
88.89%
8 / 9
50.00% covered (danger)
50.00%
1 / 2
5.03
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
87.50% covered (warning)
87.50%
7 / 8
0.00% covered (danger)
0.00%
0 / 1
4.03
1<?php
2
3declare(strict_types=1);
4
5namespace Phpdftk\Pdf\Core\Annotation;
6
7use Phpdftk\Pdf\Core\PdfDictionary;
8use Phpdftk\Pdf\Core\PdfReference;
9use Phpdftk\Pdf\Core\PdfString;
10use Phpdftk\Pdf\Core\PdfVersion;
11use Phpdftk\Pdf\Core\RequiresPdfVersion;
12use Phpdftk\Pdf\Core\DeprecatedPdfFeature;
13
14/**
15 * Movie annotation (/Subtype /Movie).
16 */
17#[RequiresPdfVersion(PdfVersion::V1_4)]
18#[DeprecatedPdfFeature(since: '2.0', replacement: 'ScreenAnnotation', removedIn: '2.0')]
19class MovieAnnotation extends Annotation
20{
21    public ?PdfString $t = null;          // /T - title
22    public ?PdfReference $movie = null;   // /Movie - movie dict
23    public ?PdfDictionary $a = null;      // /A - activation dict
24
25    public function getSubtype(): string
26    {
27        return 'Movie';
28    }
29
30    public function toPdf(): string
31    {
32        $dict = $this->buildDictionary();
33
34        if ($this->t !== null) {
35            $dict->set('T', $this->t);
36        }
37        if ($this->movie !== null) {
38            $dict->set('Movie', $this->movie);
39        }
40        if ($this->a !== null) {
41            $dict->set('A', $this->a);
42        }
43
44        return $dict->toPdf();
45    }
46}