Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
ThreadAction
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
2 / 2
5
100.00% covered (success)
100.00%
1 / 1
 getActionType
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 toPdf
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
1 / 1
4
1<?php
2
3declare(strict_types=1);
4
5namespace Phpdftk\Pdf\Core\Action;
6
7use Phpdftk\Pdf\Core\FileSpec\FileSpec;
8use Phpdftk\Pdf\Core\PdfReference;
9use Phpdftk\Pdf\Core\PdfVersion;
10use Phpdftk\Pdf\Core\RequiresPdfVersion;
11
12/**
13 * Thread action (/S /Thread) — ISO 32000-2 §12.6.4.6.
14 * Jumps to a specific article thread bead.
15 */
16#[RequiresPdfVersion(PdfVersion::V1_1)]
17class ThreadAction extends Action
18{
19    public FileSpec|PdfReference|null $f = null;   // /F  optional remote file
20    public mixed $d = null;                        // /D  thread (indirect/name/int)
21    public mixed $b = null;                        // /B  bead (indirect/int)
22
23    public function getActionType(): string
24    {
25        return 'Thread';
26    }
27
28    public function toPdf(): string
29    {
30        $dict = $this->baseDictionary();
31        if ($this->f !== null) {
32            $dict->set('F', $this->f);
33        }
34        if ($this->d !== null) {
35            $dict->set('D', $this->d);
36        }
37        if ($this->b !== null) {
38            $dict->set('B', $this->b);
39        }
40        return $dict->toPdf();
41    }
42}