Skip to content

Item

An item of the EPUB manifest.

  • Full name: \SebLucas\EPubMeta\Data\Item

Constants

Constant Visibility Type Value
XHTML public 'application/xhtml+xml'

Properties

id

protected string $id

href

protected string $href

mediaType

protected string $mediaType

dataCallable

protected callable|null $dataCallable

data

protected string $data

size

protected int $size

Methods

__construct

public __construct(string $id, string $href, callable $dataCallable, int $size, string|null $mediaType = null): mixed

Parameters:

Parameter Type Description
$id string This Item’s identifier.
$href string The path to the corresponding file.
$dataCallable callable A callable to get data from the referenced file.
$size int The size of the referenced file.
$mediaType string|null The media type of the corresponding file. If omitted XHTML is assumed.

getId

public getId(): string

getHref

public getHref(): string

getMediaType

public getMediaType(): string

getContents

Extract (a part of) the contents from the referenced XML file.

public getContents(string|null $fragmentBegin = null, string|null $fragmentEnd = null, bool $keepMarkup = false): string

Parameters:

Parameter Type Description
$fragmentBegin string|null ID of the element where to start reading the contents.
$fragmentEnd string|null ID of the element where to stop reading the contents.
$keepMarkup bool Whether to keep the XHTML markup rather than extracted plain text.

Return Value:

The contents of that fragment.

Throws:


getData

Get the file data.

public getData(): string

Return Value:

The binary data of the corresponding file.


getSize

Get the size of the corresponding file.

public getSize(): int


Automatically generated on 2025-03-18