class bbcode_merger

Properties

protected Configurator $configurator

Methods

__construct(factory $factory)

No description

array
merge_bbcodes(array $without, array $with)

Merge two BBCode definitions

array
create_bbcode(array $definition)

Create a custom BBCode for inspection

string
indent_template(string $template)

Indent given template for readability

bool
is_content_bbcode(array $without, array $with)

Test whether the two definitions form a "content"-style BBCode

bool
is_optional_bbcode(array $without, array $with)

Test whether the two definitions form BBCode with an optional attribute

array
merge_content_bbcode(array $without, array $with)

Merge the two BBCode definitions of a "content"-style BBCode

array
merge_optional_bbcode(array $without, array $with)

Merge the two BBCode definitions of a BBCode with an optional argument

string
normalize_template(string $template)

Normalize a template

Details

at line 30
__construct(factory $factory)

No description

Parameters

factory $factory

at line 47
array merge_bbcodes(array $without, array $with)

Merge two BBCode definitions

All of the arrays contain a "usage" element and a "template" element

Parameters

array $without

BBCode definition without an attribute

array $with

BBCode definition with an attribute

Return Value

array

Merged definition

Exceptions

InvalidArgumentException

if a definition cannot be interpreted

RuntimeException

if something unexpected occurs

at line 73
protected array create_bbcode(array $definition)

Create a custom BBCode for inspection

Parameters

array $definition

Original BBCode definition

Return Value

array

Updated definition containing a BBCode object and a Tag

at line 92
protected string indent_template(string $template)

Indent given template for readability

Parameters

string $template

Return Value

string

at line 117
protected bool is_content_bbcode(array $without, array $with)

Test whether the two definitions form a "content"-style BBCode

Such BBCodes include the [url] BBCode, which uses its text content as attribute if none is provided

Parameters

array $without

BBCode definition without an attribute

array $with

BBCode definition with an attribute

Return Value

bool

at line 132
protected bool is_optional_bbcode(array $without, array $with)

Test whether the two definitions form BBCode with an optional attribute

Parameters

array $without

BBCode definition without an attribute

array $with

BBCode definition with an attribute

Return Value

bool

at line 148
protected array merge_content_bbcode(array $without, array $with)

Merge the two BBCode definitions of a "content"-style BBCode

Parameters

array $without

BBCode definition without an attribute

array $with

BBCode definition with an attribute

Return Value

array

Merged definition

at line 169
protected array merge_optional_bbcode(array $without, array $with)

Merge the two BBCode definitions of a BBCode with an optional argument

Such BBCodes include the [quote] BBCode, which takes an optional argument but otherwise does not behave differently

Parameters

array $without

BBCode definition without an attribute

array $with

BBCode definition with an attribute

Return Value

array

Merged definition

at line 186
protected string normalize_template(string $template)

Normalize a template

Parameters

string $template

Return Value

string