SetaPDF_Merger_Collection_Folder Class representing a folder in a PDF Collection/Portfolio/Package.

File: /SetaPDF v2/Merger/Collection/Folder.php

Class hierarchy

Summary

Properties

$_collection

protected SetaPDF_Merger_Collection SetaPDF_Merger_Collection_Folder::$_collection

The collection instance.

$_dictionary

protected SetaPDF_Core_Type_Dictionary SetaPDF_Merger_Collection_Folder::$_dictionary

The folder dictionary.

$_indirectObject

protected null|SetaPDF_Core_Type_IndirectObject SetaPDF_Merger_Collection_Folder::$_indirectObject

The indirect object for this folder.


Methods

__construct()

The constructor.

Parameters
$collection : SetaPDF_Merger_Collection
 
$indirectObjectOrName : string|SetaPDF_Core_Type_IndirectObjectInterface

A folder name or an indirect object/reference to a dictionary representing a folder.

_getFiles()

protected SetaPDF_Merger_Collection_Folder::_getFiles (
void
): array

Get all file specifications defined for this folder.

addFile()

public SetaPDF_Merger_Collection_Folder::addFile (
SetaPDF_Core_Reader_ReaderInterface|string $pathOrReader, string $filename [, null|string $description = null [, array $fileStreamParams = array ( ) [, null|string $mimeType = null [, null|array|SetaPDF_Merger_Collection_Item $collectionItem = null ]]]]
): string

Add a file to this folder.

Parameters
$pathOrReader : SetaPDF_Core_Reader_ReaderInterface|string

A reader instance or a path to a file.

$filename : string

The filename in UTF-8 encoding.

$description : null|string

The description of the file.

$fileStreamParams : array

See SetaPDF_Core_EmbeddedFileStream::setParams() method.

$mimeType : null|string

The subtype of the embedded file. Shall conform to the MIME media type names defined in Internet RFC 2046

$collectionItem : null|array|SetaPDF_Merger_Collection_Item

The data described by the collection schema.

Return Values

The name that was used to register the file specification in the embedded files name tree.

addFolder()

public SetaPDF_Merger_Collection_Folder::addFolder (
string $name [, null|string $description = null [, DateTime|null $creationDate = null [, DateTime|null $modificationDate = null [, null|array|SetaPDF_Merger_Collection_Item $collectionItem = null ]]]]
): SetaPDF_Merger_Collection_Folder

Add a subfolder to this folder.

Parameters
$name : string

The folder name.

$description : null|string

The description of the folder.

$creationDate : DateTime|null

If null "now" will be used.

$modificationDate : DateTime|null

If null "now" will be used.

$collectionItem : null|array|SetaPDF_Merger_Collection_Item

The data described by the collection schema.

delete()

public SetaPDF_Merger_Collection_Folder::delete (
[ bool $recursive = true [, bool $removeEmbeddedFiles = true ]]
): void

Delete this folder, subfolders and files.

Parameters
$recursive : bool

Whether folders should be delete folders recursively or not.

$removeEmbeddedFiles : bool

Whether file specifications in this folder should be deleted or not.

deleteFile()

public SetaPDF_Merger_Collection_Folder::deleteFile (
string $fileName
): bool

Delete a file within this folder.

Parameters
$fileName : string

The file name (in PDFDoc or UTF-16BE encoding) needs to be prefixed with the folder id.

getChilds()

Get files and folders in this folder.

getCollection()

Get the collection instance.

getCollectionItem()

Get the collection item data.

The data described by the collection schema.

getCreationDate()

Get the date the folder was first created.

getDescription()

public SetaPDF_Merger_Collection_Folder::getDescription (
[ string $encoding = 'UTF-8' ]
): null|string

Get the descriptive text associated with the file specification.

Parameters
$encoding : string
 

getDictionary()

Get the dictionary for this folder.

getFile()

Get a file in this folder by its name in the embedded files name tree.

Parameters
$name : string
 

getFiles()

Get all files in this folder.

Return Values

The keys are the names with which the files are registered in the embedded files name tree.

getId()

public SetaPDF_Merger_Collection_Folder::getId (
void
): integer

Get and/or create the folder id.

Exceptions

Throws SetaPDF_Merger_Exception

getIndirectObject()

Get the indirect reference for this folder.

getModificationDate()

Get the date of the most recent change to immediate child files or folders of this folder.

getName()

public SetaPDF_Merger_Collection_Folder::getName (
void
): string

Get the folder name.

Return Values

The folder name in UTF-8 encoding.

getParent()

Get an folder instance of the parent folder.

getSubfolder()

Get a folder by its name in UTF-8 encoding.

Parameters
$name : string
 

getSubfolders()

Get all subfolders of this folder.

hasSubfolders()

Checks whether this folder has subfolders or not.

setCollectionItem()

Set the collection item data.

The data described by the collection schema.

Parameters
$item : SetaPDF_Merger_Collection_Item|null
 

setCreationDate()

Set the date the folder was first created.

Parameters
$creationDate : DateTime|null
 

setDescription()

public SetaPDF_Merger_Collection_Folder::setDescription (
string|null $desc [, string $encoding = 'UTF-8' ]
): SetaPDF_Merger_Collection_Folder

Set the descriptive text associated with the file specification.

Parameters
$desc : string|null
 
$encoding : string
 

setModificationDate()

Set the date of the most recent change to immediate child files or folders of this folder.

Parameters
$creationDate : DateTime|null
 

setName()

Set the folder name.

Parameters
$name : string

The folder name in UTF-8 encoding.