Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
9 / 9 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| MediaRendition | |
100.00% |
9 / 9 |
|
100.00% |
2 / 2 |
5 | |
100.00% |
1 / 1 |
| getRenditionSubtype | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| toPdf | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
4 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Phpdftk\Pdf\Core\Multimedia; |
| 6 | |
| 7 | use Phpdftk\Pdf\Core\PdfReference; |
| 8 | use Phpdftk\Pdf\Core\PdfVersion; |
| 9 | use Phpdftk\Pdf\Core\RequiresPdfVersion; |
| 10 | |
| 11 | /** |
| 12 | * Media rendition (/Type /Rendition /S /MR) — ISO 32000-2 §13.2.3.3. |
| 13 | * |
| 14 | * Refers to a single MediaClip together with playback and screen params. |
| 15 | */ |
| 16 | #[RequiresPdfVersion(PdfVersion::V1_5)] |
| 17 | class MediaRendition extends Rendition |
| 18 | { |
| 19 | public MediaClip|PdfReference|null $c = null; // /C MediaClip |
| 20 | public MediaPlayParams|PdfReference|null $p = null; // /P |
| 21 | public MediaScreenParams|PdfReference|null $sp = null; // /SP |
| 22 | |
| 23 | public function getRenditionSubtype(): string |
| 24 | { |
| 25 | return 'MR'; |
| 26 | } |
| 27 | |
| 28 | public function toPdf(): string |
| 29 | { |
| 30 | $dict = $this->baseDictionary(); |
| 31 | if ($this->c !== null) { |
| 32 | $dict->set('C', $this->c); |
| 33 | } |
| 34 | if ($this->p !== null) { |
| 35 | $dict->set('P', $this->p); |
| 36 | } |
| 37 | if ($this->sp !== null) { |
| 38 | $dict->set('SP', $this->sp); |
| 39 | } |
| 40 | return $dict->toPdf(); |
| 41 | } |
| 42 | } |