Documentation

ExternalParserLoader

Loads external parser configurations from the config file.

This class is responsible for loading and validating the external parser configurations from config/parsers.php. It provides a secure way to register additional parsers without allowing arbitrary code execution.

Tags
since
3.0.0

Table of Contents

Constants

CONFIG_FILENAME  = 'config/parsers.php'

Properties

$cachedParsers  : array<string|int, ExternalParserConfig>|null
$configPath  : string|null

Methods

__construct()  : mixed
Create a new loader.
clearCache()  : void
Clear the cached parser configurations.
getConfigPath()  : string
Get the path to the configuration file.
getExternalParsers()  : array<string|int, ExternalParserConfig>
Get all external parser configurations.
getParser()  : ExternalParserConfig|null
Get a specific parser configuration by type.
hasExternalParsers()  : bool
Check if there are any external parsers configured.
loadConfig()  : array<string|int, mixed>
Load the raw configuration array from the config file.

Constants

Properties

Methods

__construct()

Create a new loader.

public __construct([string|null $configPath = null ]) : mixed
Parameters
$configPath : string|null = null

Optional custom path to config file (for testing)

clearCache()

Clear the cached parser configurations.

public clearCache() : void

Useful for testing or when the config file has been modified.

getConfigPath()

Get the path to the configuration file.

public getConfigPath() : string
Return values
string

Absolute path to config file

getExternalParsers()

Get all external parser configurations.

public getExternalParsers() : array<string|int, ExternalParserConfig>

Returns an array of validated ExternalParserConfig objects for each parser defined in the config file. Invalid configurations are skipped with a warning logged.

Return values
array<string|int, ExternalParserConfig>

Array of parser configurations

hasExternalParsers()

Check if there are any external parsers configured.

public hasExternalParsers() : bool
Return values
bool

True if at least one external parser is configured

loadConfig()

Load the raw configuration array from the config file.

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

Parser configurations (keys and values need validation)


        
On this page

Search results