Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
CollectionItem
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 toPdf
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Phpdftk\Pdf\Core\Document;
6
7use Phpdftk\Pdf\Core\PdfDictionary;
8use Phpdftk\Pdf\Core\PdfObject;
9use Phpdftk\Pdf\Core\PdfVersion;
10use Phpdftk\Pdf\Core\RequiresPdfVersion;
11
12/**
13 * PDF Collection Item dictionary.
14 *
15 * Holds field values for a collection entry (PDF portfolio).
16 *
17 * Example:
18 *   $item = new CollectionItem();
19 *   $item->fields->set('FileName', new PdfString('report.pdf'));
20 */
21#[RequiresPdfVersion(PdfVersion::V1_7)]
22class CollectionItem extends PdfObject
23{
24    public PdfDictionary $fields;
25
26    public function __construct()
27    {
28        $this->fields = new PdfDictionary();
29    }
30
31    public function toPdf(): string
32    {
33        return $this->fields->toPdf();
34    }
35}