class Repository

Properties

protected BBCodeMonkey $bbcodeMonkey
protected DOMDocument $dom
protected DOMXPath $xpath

Methods

__construct(mixed $value, BBCodeMonkey $bbcodeMonkey)

Constructor

array
get(string $name, array $vars = [])

Get a BBCode and its associated tag from this repository

void
addRules(DOMElement $node, Tag $tag)

Add rules to given tag based on given definition

createRepositoryException(string $filepath)

Create an exception for a bad repository file path

loadRepository(string $filepath)

Load a repository file into a DOMDocument

void
replaceVars(DOMElement $node, array $vars)

Replace var elements in given definition

Details

at line 40
__construct(mixed $value, BBCodeMonkey $bbcodeMonkey)

Constructor

Parameters

mixed $value

Either a DOMDocument or the path to a repository's XML file

BBCodeMonkey $bbcodeMonkey

Instance of BBCodeMonkey used to parse definitions

at line 54
array get(string $name, array $vars = [])

Get a BBCode and its associated tag from this repository

Parameters

string $name

Name of the entry in the repository

array $vars

Replacement variables

Return Value

array

Array with three elements: "bbcode", "name" and "tag"

at line 94
protected void addRules(DOMElement $node, Tag $tag)

Add rules to given tag based on given definition

Parameters

DOMElement $node
Tag $tag

Return Value

void

at line 115
protected InvalidArgumentException createRepositoryException(string $filepath)

Create an exception for a bad repository file path

Parameters

string $filepath

Return Value

InvalidArgumentException

at line 126
protected DOMDocument loadRepository(string $filepath)

Load a repository file into a DOMDocument

Parameters

string $filepath

Return Value

DOMDocument

at line 150
protected void replaceVars(DOMElement $node, array $vars)

Replace var elements in given definition

Parameters

DOMElement $node
array $vars

Return Value

void