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
MovieAction
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
 getActionType
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\Action;
6
7use Phpdftk\Pdf\Core\PdfName;
8use Phpdftk\Pdf\Core\PdfReference;
9use Phpdftk\Pdf\Core\PdfString;
10use Phpdftk\Pdf\Core\DeprecatedPdfFeature;
11use Phpdftk\Pdf\Core\PdfVersion;
12use Phpdftk\Pdf\Core\RequiresPdfVersion;
13
14/**
15 * Movie action (/S /Movie) — ISO 32000-2 §12.6.4.9 (deprecated in 2.0 in
16 * favor of RichMedia, but still part of the spec).
17 */
18#[RequiresPdfVersion(PdfVersion::V1_2)]
19#[DeprecatedPdfFeature(since: '2.0', replacement: 'RichMediaExecuteAction', removedIn: '2.0')]
20class MovieAction extends Action
21{
22    public ?PdfReference $annotation = null;   // /Annotation
23    public ?PdfString $t = null;               // /T  - movie title
24    public ?PdfName $operation = null;         // /Operation Play|Stop|Pause|Resume
25
26    public function getActionType(): string
27    {
28        return 'Movie';
29    }
30
31    public function toPdf(): string
32    {
33        $dict = $this->baseDictionary();
34        if ($this->annotation !== null) {
35            $dict->set('Annotation', $this->annotation);
36        }
37        if ($this->t !== null) {
38            $dict->set('T', $this->t);
39        }
40        if ($this->operation !== null) {
41            $dict->set('Operation', $this->operation);
42        }
43        return $dict->toPdf();
44    }
45}