Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| Navigator | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
4 | |
100.00% |
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\PdfName; |
| 9 | use Phpdftk\Pdf\Core\PdfObject; |
| 10 | use Phpdftk\Pdf\Core\PdfString; |
| 11 | use Phpdftk\Pdf\Core\PdfVersion; |
| 12 | use Phpdftk\Pdf\Core\RequiresPdfVersion; |
| 13 | |
| 14 | /** |
| 15 | * Navigator (/Type /Navigator) — ISO 32000-2 §13.2.7. |
| 16 | * |
| 17 | * Scripted presentation sequence that drives transitions between pages |
| 18 | * or slides during multimedia playback. |
| 19 | */ |
| 20 | #[RequiresPdfVersion(PdfVersion::V1_5)] |
| 21 | class Navigator extends PdfObject |
| 22 | { |
| 23 | public const PDF_TYPE = 'Navigator'; |
| 24 | |
| 25 | public ?PdfDictionary $na = null; // /NA actions map |
| 26 | public ?PdfString $nr = null; // /NR navigator name |
| 27 | public ?PdfDictionary $du = null; // /Duration dict |
| 28 | |
| 29 | public function toPdf(): string |
| 30 | { |
| 31 | $dict = new PdfDictionary(); |
| 32 | $dict->set('Type', new PdfName(self::PDF_TYPE)); |
| 33 | if ($this->na !== null) { |
| 34 | $dict->set('NA', $this->na); |
| 35 | } |
| 36 | if ($this->nr !== null) { |
| 37 | $dict->set('NR', $this->nr); |
| 38 | } |
| 39 | if ($this->du !== null) { |
| 40 | $dict->set('Duration', $this->du); |
| 41 | } |
| 42 | return $dict->toPdf(); |
| 43 | } |
| 44 | } |