Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
7 / 7 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| ResetFormAction | |
100.00% |
7 / 7 |
|
100.00% |
2 / 2 |
4 | |
100.00% |
1 / 1 |
| getActionType | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| toPdf | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
3 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Phpdftk\Pdf\Core\Action; |
| 6 | |
| 7 | use Phpdftk\Pdf\Core\PdfArray; |
| 8 | use Phpdftk\Pdf\Core\PdfNumber; |
| 9 | use Phpdftk\Pdf\Core\PdfVersion; |
| 10 | use Phpdftk\Pdf\Core\RequiresPdfVersion; |
| 11 | |
| 12 | /** |
| 13 | * Reset-form action (/S /ResetForm) — ISO 32000-2 §12.7.5.3. |
| 14 | * Resets form field values to their defaults. |
| 15 | */ |
| 16 | #[RequiresPdfVersion(PdfVersion::V1_2)] |
| 17 | class ResetFormAction extends Action |
| 18 | { |
| 19 | public ?PdfArray $fields = null; // /Fields (default: all fields) |
| 20 | public int $flags = 0; // /Flags (bit 1 = Include/Exclude) |
| 21 | |
| 22 | public function getActionType(): string |
| 23 | { |
| 24 | return 'ResetForm'; |
| 25 | } |
| 26 | |
| 27 | public function toPdf(): string |
| 28 | { |
| 29 | $dict = $this->baseDictionary(); |
| 30 | if ($this->fields !== null) { |
| 31 | $dict->set('Fields', $this->fields); |
| 32 | } |
| 33 | if ($this->flags !== 0) { |
| 34 | $dict->set('Flags', new PdfNumber($this->flags)); |
| 35 | } |
| 36 | return $dict->toPdf(); |
| 37 | } |
| 38 | } |