ELP Parser API

ELPParser
in package
implements JsonSerializable

Parser for eXeLearning project files.

Supported project formats:

  • Legacy .elp packages based on contentv3.xml from eXeLearning 2.x.
  • Modern .elp/.elpx packages based on content.xml (ODE 2.0) from eXeLearning 3+.
Tags
category

Parser

author

INTEF cedec@educacion.gob.es

license

MIT https://opensource.org/licenses/MIT

link
https://github.com/exelearning/elp-parser

Table of Contents

Interfaces

JsonSerializable

Constants

DETAILED_SCHEMA_VERSION  : mixed = '1.0'

Properties

$archiveEntries  : array<int, string>
$assets  : array<int, string>
$assetsDetailed  : array<int, array<string, mixed>>
$author  : string
$contentFile  : string
$contentFormat  : string
$contentSchemaVersion  : string|null
$description  : string
$exeVersion  : string|null
$filePath  : string
$hasRootDtd  : bool
$language  : string
$learningResourceType  : string
$legacyData  : array<string, mixed>
$license  : string
$odeProperties  : array<string, string>
$odeResources  : array<string, string>
$pages  : array<int, array<string, mixed>>
$resourceLayout  : string
$resourceProfile  : string
$sourceExtension  : string
$strings  : array<int, string>
$title  : string
$userPreferences  : array<string, string>
$version  : int
$versionInfo  : array<string, mixed>
$archiveLimits  : ArchiveLimits
$archiveReader  : ArchiveReader
$assetExtractor  : AssetReferenceExtractor
$availableIdeviceTypesCache  : array<int, string>|null
$blocksById  : array<string, array<string, mixed>>
$blocksCache  : array<int, array<string, mixed>>|null
$brokenInternalLinksCache  : array<int, array<string, mixed>>|null
$brokenReferencesCache  : array<int, array<string, mixed>>|null
$idevicesById  : array<string, array<string, mixed>>
$idevicesCache  : array<int, array<string, mixed>>|null
$internalLinksCache  : array<int, array<string, mixed>>|null
$internalReferenceExtractor  : InternalReferenceExtractor
$options  : ParserOptions
$orphanAssetsCache  : array<int, string>|null
$ownedTemporaryFile  : string|null
$packageManifestCache  : array<string, mixed>|null
$pagesById  : array<string, array<string, mixed>>
$pageTreeCache  : array<int, array<string, mixed>>|null
$usedIdeviceTypesCache  : array<int, string>|null

Methods

__construct()  : mixed
Create a new parser instance.
__destruct()  : mixed
Remove any temporary project file owned by this parser instance.
copyEntryToStream()  : int
Copy one package entry to a writable PHP stream.
diff()  : array<string, mixed>
Compare this project with another parsed project.
exportDetailedJson()  : string
Export the detailed parsed representation as JSON.
exportJson()  : string
Export parsed data as JSON string or file.
extract()  : void
Extract the project contents to a directory.
extractEntry()  : void
Extract one package entry to an explicit filesystem path.
fromContents()  : self
Create a parser from in-memory project bytes.
fromFile()  : self
Create a parser from a file path.
fromStream()  : self
Create a parser from a readable PHP stream resource.
getApplicationVersion()  : string|null
Get the raw eXeLearning application version declared by the package.
getArchiveEntries()  : array<int, string>
Get archive entry names.
getArchiveEntryFingerprint()  : string
Get a fingerprint of one archive entry without loading it into memory.
getArchiveFingerprint()  : string
Get an exact fingerprint of the archive bytes.
getAssets()  : array<int, string>
Get referenced asset paths.
getAssetsDetailed()  : array<int, array<string, mixed>>
Get detailed asset information.
getAudioFiles()  : array<int, string>
Get audio asset paths.
getAuthor()  : string
Get the project author.
getAvailableIdeviceTypes()  : array<int, string>
Get iDevice runtime directories available in the package.
getBlockById()  : array<string, mixed>|null
Get a block by its identifier.
getBlocks()  : array<int, array<string, mixed>>
Get all blocks across all pages.
getBrokenInternalLinks()  : array<int, array<string, mixed>>
Get internal page references whose target does not exist.
getBrokenReferences()  : array<int, array<string, mixed>>
Get unresolved asset references with their page and iDevice origins.
getContentFile()  : string
Get the XML entry name used by the package.
getContentFingerprint()  : string
Get a deterministic normalized logical-content fingerprint.
getContentFormat()  : string
Get the detected content format identifier.
getContentSchemaVersion()  : string|null
Get the ODE schema version when available.
getDescription()  : string
Get the project description.
getDetailedJsonSchema()  : string
Read the bundled detailed JSON Schema.
getDetailedJsonSchemaPath()  : string
Get the bundled detailed JSON Schema path.
getDetailedSchemaVersion()  : string
Get the version of the detailed JSON contract.
getDocuments()  : array<int, string>
Get document asset paths.
getEntryContents()  : string
Read one package entry into memory.
getExeVersion()  : string|null
Get the raw eXeLearning version string when available.
getFormatFamily()  : string
Get the broad project format family.
getFormatVersion()  : string|null
Get the internal format version independently from the application version.
getHiddenIdevices()  : array<int, array<string, mixed>>
Get hidden iDevices.
getIdeviceById()  : array<string, mixed>|null
Get an iDevice by its identifier.
getIdevices()  : array<int, array<string, mixed>>
Get all iDevices across all pages.
getImages()  : array<int, string>
Get image asset paths.
getInternalLinks()  : array<int, array<string, mixed>>
Get internal exe-node page references with their origins.
getLanguage()  : string
Get the project language.
getLearningResourceType()  : string
Get the learning resource type.
getLicense()  : string
Get the project license.
getMetadata()  : array<string, mixed>
Get normalized metadata information.
getMissingAssets()  : array<int, string>
Get unique unresolved asset reference strings.
getMissingIdeviceRuntimes()  : array<int, string>
Get used iDevice types without a matching packaged runtime directory.
getOdeProperties()  : array<string, string>
Get modern ODE properties.
getOdeResources()  : array<string, string>
Get modern ODE resources.
getOptions()  : ParserOptions
Get the normalized parser options for this instance.
getOrphanAssets()  : array<int, string>
Get archive assets that are not referenced in parsed content.
getPackageManifest()  : array<string, mixed>
Build a categorized manifest of package entries.
getPackageProfile()  : string
Get a compatibility profile for the parsed package.
getPageById()  : array<string, mixed>|null
Get a page by its identifier.
getPages()  : array<int, array<string, mixed>>
Get parsed page information.
getPageTextById()  : array<string, mixed>|null
Get grouped text content for a single page by its ID.
getPageTexts()  : array<int, array<string, mixed>>
Get grouped text content for each page.
getPageTree()  : array<int, array<string, mixed>>
Get pages as a nested tree while preserving the flat getPages() API.
getProject()  : Project
Get a typed project model without replacing the existing array APIs.
getProjectId()  : string|null
Get the stable ODE project identifier.
getProjectVersionId()  : string|null
Get the ODE project-version identifier.
getResourceLayout()  : string
Return the detected resource layout family.
getResourceProfile()  : string
Get the detected modern resource storage profile.
getSourceExtension()  : string
Get the source project extension.
getStrings()  : array<int, string>
Get all extracted strings.
getTeacherOnlyIdevices()  : array<int, array<string, mixed>>
Get iDevices marked as teacher-only.
getTitle()  : string
Get the project title.
getUsedIdeviceTypes()  : array<int, string>
Get the iDevice types used by parsed content.
getUserPreferences()  : array<string, string>
Get modern ODE user preferences.
getVersion()  : int
Get the detected eXeLearning major version.
getVersionInfo()  : array<string, mixed>
Get version detection details and signals.
getVideoFiles()  : array<int, string>
Get video asset paths.
getVisiblePages()  : array<int, array<string, mixed>>
Get only visible pages.
getVisiblePageTexts()  : array<int, array<string, mixed>>
Get grouped text content for visible pages only.
hasEntry()  : bool
Determine whether a package entry exists.
hasRootDtd()  : bool
Return whether the package contains a root content.dtd entry.
hasSameContentAs()  : bool
Determine whether another parsed project has the same normalized content.
identify()  : string
Identify the package compatibility profile.
inspect()  : array<string, mixed>
Inspect core project metadata without fully normalizing page content.
inspectContents()  : array<string, mixed>
Inspect in-memory project bytes without full normalization.
inspectStream()  : array<string, mixed>
Inspect a project from a readable stream without full normalization.
isLegacyFormat()  : bool
Determine whether the project uses the legacy contentv3 format.
isLikelyVersion4Package()  : bool
Heuristically identify likely eXeLearning 4-style packages.
jsonSerialize()  : mixed
Return the JSON-serializable representation.
probe()  : array<string, mixed>
Alias for lightweight project inspection.
supports()  : bool
Determine whether a file is a supported eXeLearning project package.
toArray()  : array<string, mixed>
Convert parser data to a compact array.
toDetailedArray()  : array<string|int, mixed>
validate()  : array{valid: bool, errors: array>, warnings: array>}
Validate project structure and package consistency.
validatePackage()  : array{valid: bool, errors: array>, warnings: array>}
Validate project structure and package consistency.
validateResult()  : ValidationResult
Validate project structure using typed diagnostics.
validateSchema()  : array{valid: bool, errors: array>}
Validate project XML against a caller-supplied trusted local schema.
buildLegacyMetadata()  : array<int, array<string, mixed>>
Build normalized legacy metadata output.
buildModernMetadata()  : array<int, array<string, mixed>>
Build normalized modern metadata output.
filterAssetPathsByType()  : array<int, string>
Filter asset paths by logical type.
parse()  : void
Detect the project format and parse its contents.
buildIndexes()  : void
Build immutable lookup indexes and aggregate caches.
buildPageTreeNode()  : array<string, mixed>
Build one page-tree node and guard against malformed cycles.
detectResourceLayout()  : string
Detect the archive resource layout family.
detectResourceProfile()  : string
Detect the resource layout profile used by modern packages.
hydrateCommonData()  : void
Hydrate common parser fields from a format-specific parser result.
normalizeOptions()  : ParserOptions
Normalize legacy ArchiveLimits and modern ParserOptions arguments.
versionSignals()  : array<string, mixed>
Return signals used by version detection.

Constants

DETAILED_SCHEMA_VERSION

public mixed DETAILED_SCHEMA_VERSION = '1.0'

Properties

$archiveEntries

protected array<int, string> $archiveEntries = []

$assets

protected array<int, string> $assets = []

$assetsDetailed

protected array<int, array<string, mixed>> $assetsDetailed = []

$contentFile

protected string $contentFile = ''

$contentFormat

protected string $contentFormat = ''

$contentSchemaVersion

protected string|null $contentSchemaVersion = null

$description

protected string $description = ''

$exeVersion

protected string|null $exeVersion = null

$hasRootDtd

protected bool $hasRootDtd = false

$learningResourceType

protected string $learningResourceType = ''

$legacyData

protected array<string, mixed> $legacyData = []

$odeProperties

protected array<string, string> $odeProperties = []

$odeResources

protected array<string, string> $odeResources = []

$pages

protected array<int, array<string, mixed>> $pages = []

$resourceLayout

protected string $resourceLayout = 'none'

$resourceProfile

protected string $resourceProfile = 'none'

$sourceExtension

protected string $sourceExtension = ''

$strings

protected array<int, string> $strings = []

$userPreferences

protected array<string, string> $userPreferences = []

$versionInfo

protected array<string, mixed> $versionInfo = []

$availableIdeviceTypesCache

private array<int, string>|null $availableIdeviceTypesCache = null

$blocksById

private array<string, array<string, mixed>> $blocksById = []

$blocksCache

private array<int, array<string, mixed>>|null $blocksCache = null

$brokenInternalLinksCache

private array<int, array<string, mixed>>|null $brokenInternalLinksCache = null

$brokenReferencesCache

private array<int, array<string, mixed>>|null $brokenReferencesCache = null

$idevicesById

private array<string, array<string, mixed>> $idevicesById = []

$idevicesCache

private array<int, array<string, mixed>>|null $idevicesCache = null

$internalLinksCache

private array<int, array<string, mixed>>|null $internalLinksCache = null

$orphanAssetsCache

private array<int, string>|null $orphanAssetsCache = null

$ownedTemporaryFile

private string|null $ownedTemporaryFile = null

$packageManifestCache

private array<string, mixed>|null $packageManifestCache = null

$pagesById

private array<string, array<string, mixed>> $pagesById = []

$pageTreeCache

private array<int, array<string, mixed>>|null $pageTreeCache = null

$usedIdeviceTypesCache

private array<int, string>|null $usedIdeviceTypesCache = null

Methods

__construct()

Create a new parser instance.

public __construct(string $filePath[, ArchiveLimits|ParserOptions|null $options = null ]) : mixed

ArchiveLimits remains accepted as the second argument for backward compatibility. ParserOptions is the preferred extensible configuration.

Parameters
$filePath : string

Project file path.

$options : ArchiveLimits|ParserOptions|null = null

Parser options or legacy limits.

__destruct()

Remove any temporary project file owned by this parser instance.

public __destruct() : mixed

copyEntryToStream()

Copy one package entry to a writable PHP stream.

public copyEntryToStream(string $entryName, resource $output[, int|null $maxBytes = null ]) : int
Parameters
$entryName : string

Entry name.

$output : resource

Writable stream.

$maxBytes : int|null = null

Optional byte limit.

Return values
int

Number of bytes written.

diff()

Compare this project with another parsed project.

public diff(ELPParser $other[, string $algorithm = 'sha256' ]) : array<string, mixed>
Parameters
$other : ELPParser

Project to compare.

$algorithm : string = 'sha256'

Hash algorithm.

Return values
array<string, mixed>

exportDetailedJson()

Export the detailed parsed representation as JSON.

public exportDetailedJson([string|null $destinationPath = null ]) : string
Parameters
$destinationPath : string|null = null

Optional destination path.

Return values
string

exportJson()

Export parsed data as JSON string or file.

public exportJson([string|null $destinationPath = null ]) : string
Parameters
$destinationPath : string|null = null

Optional destination path.

Return values
string

extract()

Extract the project contents to a directory.

public extract(string $destinationPath) : void
Parameters
$destinationPath : string

Destination directory.

extractEntry()

Extract one package entry to an explicit filesystem path.

public extractEntry(string $entryName, string $destinationPath[, int|null $maxBytes = null ]) : void
Parameters
$entryName : string

Entry name.

$destinationPath : string

Destination file path.

$maxBytes : int|null = null

Optional byte limit.

fromContents()

Create a parser from in-memory project bytes.

public static fromContents(string $contents[, string $extension = 'elpx' ][, ArchiveLimits|ParserOptions|null $options = null ]) : self
Parameters
$contents : string

Project bytes.

$extension : string = 'elpx'

Source extension used for format heuristics.

$options : ArchiveLimits|ParserOptions|null = null
Return values
self

fromStream()

Create a parser from a readable PHP stream resource.

public static fromStream(mixed $stream[, string $extension = 'elpx' ][, ArchiveLimits|ParserOptions|null $options = null ]) : self
Parameters
$stream : mixed

Readable stream resource.

$extension : string = 'elpx'

Source extension used for format heuristics.

$options : ArchiveLimits|ParserOptions|null = null
Return values
self

getApplicationVersion()

Get the raw eXeLearning application version declared by the package.

public getApplicationVersion() : string|null
Return values
string|null

getArchiveEntries()

Get archive entry names.

public getArchiveEntries() : array<int, string>
Return values
array<int, string>

getArchiveEntryFingerprint()

Get a fingerprint of one archive entry without loading it into memory.

public getArchiveEntryFingerprint(string $entryName[, string $algorithm = 'sha256' ]) : string
Parameters
$entryName : string

Entry path.

$algorithm : string = 'sha256'

Hash algorithm.

Return values
string

getArchiveFingerprint()

Get an exact fingerprint of the archive bytes.

public getArchiveFingerprint([string $algorithm = 'sha256' ]) : string
Parameters
$algorithm : string = 'sha256'

Hash algorithm.

Return values
string

getAssets()

Get referenced asset paths.

public getAssets() : array<int, string>
Return values
array<int, string>

getAssetsDetailed()

Get detailed asset information.

public getAssetsDetailed() : array<int, array<string, mixed>>
Return values
array<int, array<string, mixed>>

getAudioFiles()

Get audio asset paths.

public getAudioFiles() : array<int, string>
Return values
array<int, string>

getAuthor()

Get the project author.

public getAuthor() : string
Return values
string

getAvailableIdeviceTypes()

Get iDevice runtime directories available in the package.

public getAvailableIdeviceTypes() : array<int, string>
Return values
array<int, string>

getBlockById()

Get a block by its identifier.

public getBlockById(string $blockId) : array<string, mixed>|null
Parameters
$blockId : string

Block identifier.

Return values
array<string, mixed>|null

getBlocks()

Get all blocks across all pages.

public getBlocks() : array<int, array<string, mixed>>
Return values
array<int, array<string, mixed>>

Get internal page references whose target does not exist.

public getBrokenInternalLinks() : array<int, array<string, mixed>>
Return values
array<int, array<string, mixed>>

getBrokenReferences()

Get unresolved asset references with their page and iDevice origins.

public getBrokenReferences() : array<int, array<string, mixed>>
Return values
array<int, array<string, mixed>>

getContentFile()

Get the XML entry name used by the package.

public getContentFile() : string
Return values
string

getContentFingerprint()

Get a deterministic normalized logical-content fingerprint.

public getContentFingerprint([string $algorithm = 'sha256' ]) : string
Parameters
$algorithm : string = 'sha256'

Hash algorithm.

Return values
string

getContentFormat()

Get the detected content format identifier.

public getContentFormat() : string
Return values
string

getContentSchemaVersion()

Get the ODE schema version when available.

public getContentSchemaVersion() : string|null
Return values
string|null

getDescription()

Get the project description.

public getDescription() : string
Return values
string

getDetailedJsonSchema()

Read the bundled detailed JSON Schema.

public static getDetailedJsonSchema() : string
Return values
string

getDetailedJsonSchemaPath()

Get the bundled detailed JSON Schema path.

public static getDetailedJsonSchemaPath() : string
Return values
string

getDetailedSchemaVersion()

Get the version of the detailed JSON contract.

public static getDetailedSchemaVersion() : string
Return values
string

getDocuments()

Get document asset paths.

public getDocuments() : array<int, string>
Return values
array<int, string>

getEntryContents()

Read one package entry into memory.

public getEntryContents(string $entryName[, int|null $maxBytes = null ]) : string
Parameters
$entryName : string

Entry name.

$maxBytes : int|null = null

Optional byte limit.

Return values
string

getExeVersion()

Get the raw eXeLearning version string when available.

public getExeVersion() : string|null
Return values
string|null

getFormatFamily()

Get the broad project format family.

public getFormatFamily() : string
Return values
string

getFormatVersion()

Get the internal format version independently from the application version.

public getFormatVersion() : string|null
Return values
string|null

getHiddenIdevices()

Get hidden iDevices.

public getHiddenIdevices() : array<int, array<string, mixed>>
Return values
array<int, array<string, mixed>>

getIdeviceById()

Get an iDevice by its identifier.

public getIdeviceById(string $ideviceId) : array<string, mixed>|null
Parameters
$ideviceId : string

iDevice identifier.

Return values
array<string, mixed>|null

getIdevices()

Get all iDevices across all pages.

public getIdevices() : array<int, array<string, mixed>>
Return values
array<int, array<string, mixed>>

getImages()

Get image asset paths.

public getImages() : array<int, string>
Return values
array<int, string>

Get internal exe-node page references with their origins.

public getInternalLinks() : array<int, array<string, mixed>>
Return values
array<int, array<string, mixed>>

getLanguage()

Get the project language.

public getLanguage() : string
Return values
string

getLearningResourceType()

Get the learning resource type.

public getLearningResourceType() : string
Return values
string

getLicense()

Get the project license.

public getLicense() : string
Return values
string

getMetadata()

Get normalized metadata information.

public getMetadata() : array<string, mixed>
Return values
array<string, mixed>

getMissingAssets()

Get unique unresolved asset reference strings.

public getMissingAssets() : array<int, string>
Return values
array<int, string>

getMissingIdeviceRuntimes()

Get used iDevice types without a matching packaged runtime directory.

public getMissingIdeviceRuntimes() : array<int, string>
Return values
array<int, string>

getOdeProperties()

Get modern ODE properties.

public getOdeProperties() : array<string, string>
Return values
array<string, string>

getOdeResources()

Get modern ODE resources.

public getOdeResources() : array<string, string>
Return values
array<string, string>

getOrphanAssets()

Get archive assets that are not referenced in parsed content.

public getOrphanAssets() : array<int, string>
Return values
array<int, string>

getPackageManifest()

Build a categorized manifest of package entries.

public getPackageManifest() : array<string, mixed>
Return values
array<string, mixed>

getPackageProfile()

Get a compatibility profile for the parsed package.

public getPackageProfile() : string
Return values
string

getPageById()

Get a page by its identifier.

public getPageById(string $pageId) : array<string, mixed>|null
Parameters
$pageId : string

Page identifier.

Return values
array<string, mixed>|null

getPages()

Get parsed page information.

public getPages() : array<int, array<string, mixed>>
Return values
array<int, array<string, mixed>>

getPageTextById()

Get grouped text content for a single page by its ID.

public getPageTextById(string $pageId) : array<string, mixed>|null
Parameters
$pageId : string

Page identifier.

Return values
array<string, mixed>|null

getPageTexts()

Get grouped text content for each page.

public getPageTexts() : array<int, array<string, mixed>>
Return values
array<int, array<string, mixed>>

getPageTree()

Get pages as a nested tree while preserving the flat getPages() API.

public getPageTree() : array<int, array<string, mixed>>
Return values
array<int, array<string, mixed>>

getProject()

Get a typed project model without replacing the existing array APIs.

public getProject() : Project
Return values
Project

getProjectId()

Get the stable ODE project identifier.

public getProjectId() : string|null
Return values
string|null

getProjectVersionId()

Get the ODE project-version identifier.

public getProjectVersionId() : string|null
Return values
string|null

getResourceLayout()

Return the detected resource layout family.

public getResourceLayout() : string
Return values
string

getResourceProfile()

Get the detected modern resource storage profile.

public getResourceProfile() : string
Return values
string

getSourceExtension()

Get the source project extension.

public getSourceExtension() : string
Return values
string

getStrings()

Get all extracted strings.

public getStrings() : array<int, string>
Return values
array<int, string>

getTeacherOnlyIdevices()

Get iDevices marked as teacher-only.

public getTeacherOnlyIdevices() : array<int, array<string, mixed>>
Return values
array<int, array<string, mixed>>

getTitle()

Get the project title.

public getTitle() : string
Return values
string

getUsedIdeviceTypes()

Get the iDevice types used by parsed content.

public getUsedIdeviceTypes() : array<int, string>
Return values
array<int, string>

getUserPreferences()

Get modern ODE user preferences.

public getUserPreferences() : array<string, string>
Return values
array<string, string>

getVersion()

Get the detected eXeLearning major version.

public getVersion() : int
Return values
int

getVersionInfo()

Get version detection details and signals.

public getVersionInfo() : array<string, mixed>
Return values
array<string, mixed>

getVideoFiles()

Get video asset paths.

public getVideoFiles() : array<int, string>
Return values
array<int, string>

getVisiblePages()

Get only visible pages.

public getVisiblePages() : array<int, array<string, mixed>>
Return values
array<int, array<string, mixed>>

getVisiblePageTexts()

Get grouped text content for visible pages only.

public getVisiblePageTexts() : array<int, array<string, mixed>>
Return values
array<int, array<string, mixed>>

hasEntry()

Determine whether a package entry exists.

public hasEntry(string $entryName) : bool
Parameters
$entryName : string

Entry name.

Return values
bool

hasRootDtd()

Return whether the package contains a root content.dtd entry.

public hasRootDtd() : bool
Return values
bool

hasSameContentAs()

Determine whether another parsed project has the same normalized content.

public hasSameContentAs(ELPParser $other[, string $algorithm = 'sha256' ]) : bool
Parameters
$other : ELPParser

Project to compare.

$algorithm : string = 'sha256'

Hash algorithm.

Return values
bool

identify()

Identify the package compatibility profile.

public static identify(string $filePath[, ArchiveLimits|ParserOptions|null $options = null ]) : string
Parameters
$filePath : string

Project file path.

$options : ArchiveLimits|ParserOptions|null = null

Parser options or legacy limits.

Return values
string

inspect()

Inspect core project metadata without fully normalizing page content.

public static inspect(string $filePath[, ArchiveLimits|ParserOptions|null $options = null ]) : array<string, mixed>
Parameters
$filePath : string

Project file path.

$options : ArchiveLimits|ParserOptions|null = null
Return values
array<string, mixed>

inspectContents()

Inspect in-memory project bytes without full normalization.

public static inspectContents(string $contents[, string $extension = 'elpx' ][, ArchiveLimits|ParserOptions|null $options = null ]) : array<string, mixed>
Parameters
$contents : string

Project bytes.

$extension : string = 'elpx'

Source extension used for format heuristics.

$options : ArchiveLimits|ParserOptions|null = null
Return values
array<string, mixed>

inspectStream()

Inspect a project from a readable stream without full normalization.

public static inspectStream(mixed $stream[, string $extension = 'elpx' ][, ArchiveLimits|ParserOptions|null $options = null ]) : array<string, mixed>
Parameters
$stream : mixed

Readable stream resource.

$extension : string = 'elpx'

Source extension used for format heuristics.

$options : ArchiveLimits|ParserOptions|null = null
Return values
array<string, mixed>

isLegacyFormat()

Determine whether the project uses the legacy contentv3 format.

public isLegacyFormat() : bool
Return values
bool

isLikelyVersion4Package()

Heuristically identify likely eXeLearning 4-style packages.

public isLikelyVersion4Package() : bool
Return values
bool

jsonSerialize()

Return the JSON-serializable representation.

public jsonSerialize() : mixed

probe()

Alias for lightweight project inspection.

public static probe(string $filePath[, ArchiveLimits|ParserOptions|null $options = null ]) : array<string, mixed>
Parameters
$filePath : string

Project file path.

$options : ArchiveLimits|ParserOptions|null = null

Parser options or legacy limits.

Return values
array<string, mixed>

supports()

Determine whether a file is a supported eXeLearning project package.

public static supports(string $filePath[, ArchiveLimits|ParserOptions|null $options = null ]) : bool
Parameters
$filePath : string

Project file path.

$options : ArchiveLimits|ParserOptions|null = null

Parser options or legacy limits.

Return values
bool

toArray()

Convert parser data to a compact array.

public toArray() : array<string, mixed>
Return values
array<string, mixed>

toDetailedArray()

public toDetailedArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

validate()

Validate project structure and package consistency.

public validate() : array{valid: bool, errors: array>, warnings: array>}
Return values
array{valid: bool, errors: array>, warnings: array>}

validatePackage()

Validate project structure and package consistency.

public validatePackage() : array{valid: bool, errors: array>, warnings: array>}
Return values
array{valid: bool, errors: array>, warnings: array>}

validateResult()

Validate project structure using typed diagnostics.

public validateResult() : ValidationResult

The existing validate() and validatePackage() array APIs remain unchanged for backward compatibility.

Return values
ValidationResult

validateSchema()

Validate project XML against a caller-supplied trusted local schema.

public validateSchema(string $schemaPath[, string $type = SchemaValidator::TYPE_XSD ]) : array{valid: bool, errors: array>}
Parameters
$schemaPath : string

Trusted local XSD or DTD path.

$type : string = SchemaValidator::TYPE_XSD

Schema type, xsd or dtd.

Return values
array{valid: bool, errors: array>}

buildLegacyMetadata()

Build normalized legacy metadata output.

protected buildLegacyMetadata() : array<int, array<string, mixed>>
Return values
array<int, array<string, mixed>>

buildModernMetadata()

Build normalized modern metadata output.

protected buildModernMetadata() : array<int, array<string, mixed>>
Return values
array<int, array<string, mixed>>

filterAssetPathsByType()

Filter asset paths by logical type.

protected filterAssetPathsByType(string $type) : array<int, string>
Parameters
$type : string

Asset type.

Return values
array<int, string>

parse()

Detect the project format and parse its contents.

protected parse() : void

buildIndexes()

Build immutable lookup indexes and aggregate caches.

private buildIndexes() : void

buildPageTreeNode()

Build one page-tree node and guard against malformed cycles.

private buildPageTreeNode(string $pageId, array<string, array<string, mixed>> $pagesById, array<string, array<int, string>> $childrenByParent, array<string, bool> $ancestors) : array<string, mixed>
Parameters
$pageId : string

Page identifier.

$pagesById : array<string, array<string, mixed>>

Pages indexed by ID.

$childrenByParent : array<string, array<int, string>>

Child IDs by parent ID.

$ancestors : array<string, bool>

Current ancestor set.

Return values
array<string, mixed>

detectResourceLayout()

Detect the archive resource layout family.

private detectResourceLayout(array<int, string> $entries) : string
Parameters
$entries : array<int, string>

Archive entry names.

Return values
string

detectResourceProfile()

Detect the resource layout profile used by modern packages.

private detectResourceProfile(array<int, string> $entries) : string

eXeLearning 3 commonly stored assets in per-asset ODE-ID directories, while eXeLearning 4 stores assets directly under content/resources/ and preserves user-created folders.

Parameters
$entries : array<int, string>

Archive entry names.

Return values
string

hydrateCommonData()

Hydrate common parser fields from a format-specific parser result.

private hydrateCommonData(array<string, mixed> $parsed) : void
Parameters
$parsed : array<string, mixed>

Parsed data.

versionSignals()

Return signals used by version detection.

private versionSignals() : array<string, mixed>
Return values
array<string, mixed>
On this page

Search results