Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
11 / 11 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| MediaClipSection | |
100.00% |
11 / 11 |
|
100.00% |
3 / 3 |
6 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getMediaClipSubtype | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| toPdf | |
100.00% |
9 / 9 |
|
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\PdfDictionary; |
| 8 | use Phpdftk\Pdf\Core\PdfReference; |
| 9 | use Phpdftk\Pdf\Core\PdfString; |
| 10 | use Phpdftk\Pdf\Core\PdfVersion; |
| 11 | use Phpdftk\Pdf\Core\RequiresPdfVersion; |
| 12 | |
| 13 | /** |
| 14 | * Media clip section (/Type /MediaClip /S /MCS) — ISO 32000-2 §13.2.4.3. |
| 15 | * |
| 16 | * Defines a temporal slice of another MediaClip. |
| 17 | */ |
| 18 | #[RequiresPdfVersion(PdfVersion::V1_5)] |
| 19 | class MediaClipSection extends MediaClip |
| 20 | { |
| 21 | public MediaClip|PdfReference $d; // /D parent clip |
| 22 | public ?PdfString $alt = null; // /Alt |
| 23 | public ?PdfDictionary $mh = null; // /MH |
| 24 | public ?PdfDictionary $be = null; // /BE |
| 25 | |
| 26 | public function __construct(MediaClip|PdfReference $d) |
| 27 | { |
| 28 | $this->d = $d; |
| 29 | } |
| 30 | |
| 31 | public function getMediaClipSubtype(): string |
| 32 | { |
| 33 | return 'MCS'; |
| 34 | } |
| 35 | |
| 36 | public function toPdf(): string |
| 37 | { |
| 38 | $dict = $this->baseDictionary(); |
| 39 | $dict->set('D', $this->d); |
| 40 | if ($this->alt !== null) { |
| 41 | $dict->set('Alt', $this->alt); |
| 42 | } |
| 43 | if ($this->mh !== null) { |
| 44 | $dict->set('MH', $this->mh); |
| 45 | } |
| 46 | if ($this->be !== null) { |
| 47 | $dict->set('BE', $this->be); |
| 48 | } |
| 49 | return $dict->toPdf(); |
| 50 | } |
| 51 | } |