setasign\SetaPDF2\Merger\Collection

Item Class representing a collection item.

File: /SetaPDF v2/Merger/Collection/Item.php
Old class name (alias): \SetaPDF_Merger_Collection_Item

A collection item shall contain the data described in the collection schema for a particular file or folder.

Class hierarchy

Summary

Properties

$_dictionary

The collection item dictionary.


Methods

__construct()

public Item::__construct (
?\SetaPDF_Core_Type_Dictionary $dictionary = null
)

The constructor.

Parameters
$dictionary : ?\SetaPDF_Core_Type_Dictionary
 

_createPdfValue()

private Item::_createPdfValue (
string|number $value,
string $type
): \SetaPDF_Core_Type_Numeric|\SetaPDF_Core_Type_String

Prepares a value depending on its type.

Parameters
$value : string|number
 
$type : string
 
Exceptions

Throws \setasign\SetaPDF2\NotImplementedException

getData()

public Item::getData (
void
): array

Get the data as PHP values.

Return Values

If the value is a collection subitem the value will be an array of 2 values where the first key is the value and the second the prefix.

getDictionary()

Get the dictionary.

setData()

public Item::setData (
array $data,
?\SetaPDF_Merger_Collection_Schema $schema = null
): void

Set several entries in this item.

Parameters
$data : array

The keys are the entry names.

$schema : ?\SetaPDF_Merger_Collection_Schema
 
Exceptions

Throws \setasign\SetaPDF2\NotImplementedException

setEntry()

public Item::setEntry (
string $name,
mixed $value,
null|string|\SetaPDF_Merger_Collection_Schema $type = null
): void

Set the data of an entry in this collection item.

Parameters
$name : string
 
$value : mixed

To create a subitem, pass an array of 2 values where the first value is the data and the second value is the prefix.

$type : null|string|\SetaPDF_Merger_Collection_Schema

If $type is null the type will be resolved by the PHP type. Othersie a constant value of Schema::DATA_TYPE_* have to be passed or an instance of Schema from which the type will be resolved automatically and ensured that the field exists in the schema.

Exceptions

Throws \setasign\SetaPDF2\NotImplementedException