Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
85.71% covered (warning)
85.71%
6 / 7
50.00% covered (danger)
50.00%
1 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
RichMediaAnnotation
85.71% covered (warning)
85.71%
6 / 7
50.00% covered (danger)
50.00%
1 / 2
4.05
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
83.33% covered (warning)
83.33%
5 / 6
0.00% covered (danger)
0.00%
0 / 1
3.04
1<?php
2
3declare(strict_types=1);
4
5namespace Phpdftk\Pdf\Core\Annotation;
6
7use Phpdftk\Pdf\Core\PdfDictionary;
8use Phpdftk\Pdf\Core\PdfVersion;
9use Phpdftk\Pdf\Core\RequiresPdfVersion;
10
11/**
12 * RichMedia annotation (/Subtype /RichMedia).
13 */
14#[RequiresPdfVersion(PdfVersion::V2_0)]
15class RichMediaAnnotation extends Annotation
16{
17    public ?PdfDictionary $richMediaSettings = null; // /RichMediaSettings
18    public ?PdfDictionary $richMediaContent = null;  // /RichMediaContent
19
20    public function getSubtype(): string
21    {
22        return 'RichMedia';
23    }
24
25    public function toPdf(): string
26    {
27        $dict = $this->buildDictionary();
28
29        if ($this->richMediaSettings !== null) {
30            $dict->set('RichMediaSettings', $this->richMediaSettings);
31        }
32        if ($this->richMediaContent !== null) {
33            $dict->set('RichMediaContent', $this->richMediaContent);
34        }
35
36        return $dict->toPdf();
37    }
38}