Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
SelectorRendition
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
2 / 2
3
100.00% covered (success)
100.00%
1 / 1
 getRenditionSubtype
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 toPdf
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2
3declare(strict_types=1);
4
5namespace Phpdftk\Pdf\Core\Multimedia;
6
7use Phpdftk\Pdf\Core\PdfArray;
8use Phpdftk\Pdf\Core\PdfVersion;
9use Phpdftk\Pdf\Core\RequiresPdfVersion;
10
11/**
12 * Selector rendition (/Type /Rendition /S /SR) — ISO 32000-2 §13.2.3.4.
13 *
14 * Wraps an ordered array of candidate renditions; the viewer picks the
15 * first playable one.
16 */
17#[RequiresPdfVersion(PdfVersion::V1_5)]
18class SelectorRendition extends Rendition
19{
20    public ?PdfArray $r = null;   // /R  array of Rendition references
21
22    public function getRenditionSubtype(): string
23    {
24        return 'SR';
25    }
26
27    public function toPdf(): string
28    {
29        $dict = $this->baseDictionary();
30        if ($this->r !== null) {
31            $dict->set('R', $this->r);
32        }
33        return $dict->toPdf();
34    }
35}