Properties

$namespace

$namespace : string

Namespace of the tag

Type

string

$name

$name : string

Name of the tag

Type

string

$value

$value : string

Value of the tag

Type

string

$compound

$compound : boolean

Whether this is a compound tag

Type

boolean

$sanitizers

$sanitizers : array<mixed,\BWP_Sitemaps_Sitemap_Sanitizer>

Sanitizers to apply on this tag's value

This is mostly relevant with a single tag because a compound tag does not actually have any value.

Type

array<mixed,\BWP_Sitemaps_Sitemap_Sanitizer>

$template

$template : string

Template to be used when rendering this tag

Type

string

$indent_level

$indent_level : integer

Level of indentation used when rendering this tag

Type

integer

Methods

create_single_tag()

create_single_tag(string  $name, string  $value = null,   $sanitizers = null) 

Create a single tag

Parameters

string $name
string $value

default to null

$sanitizers

create_compound_tag()

create_compound_tag(string  $name) 

Create a compound tag

Parameters

string $name

set_value()

set_value(string  $value) 

Set value for this tag

Parameters

string $value

add_sanitizer()

add_sanitizer(\BWP_Sitemaps_Sitemap_Sanitizer  $sanitizer) 

Add a sanitizer to apply upon this tag's value when set (if not existed)

Parameters

set_template()

set_template(string  $template) 

Set template for this tag

Parameters

string $template

is_compound()

is_compound() : boolean

Check whether this tag is a compound tag

Returns

boolean

get_name()

get_name() : string

Get tag name, with namespace

Returns

string

get_value()

get_value() : string

Get tag value

Returns

string

get_sanitizers()

get_sanitizers() 

Get registered sanitizers

get_template()

get_template() : string

Get template, with indentation properly prepended

Indentation should be prepended to both the opening tag and the closing tag.

Returns

string

get_indentation()

get_indentation() : string

Get indentation for this tag

Each parent corresponds to one level of indentation

Returns

string

get_xml()

get_xml() : string

Get XML representation of this tag

Returns

string

add_tag()

add_tag(\BWP_Sitemaps_Sitemap_Tag  $tag) : $this

Add child tag

Both single tags and compound tags can be added, to allow a nested structure.

Parameters

\BWP_Sitemaps_Sitemap_Tag $tag

the child tag to add

Throws

\LogicException

if child tag already has a parent

Returns

$this

add_tags()

add_tags(array  $tags) : $this

Add multiple tags at once

Parameters

array $tags

Returns

$this

get_tags()

get_tags() : array<mixed,\BWP_Sitemaps_Sitemap_Tag>

Get all child tags

Returns

array<mixed,\BWP_Sitemaps_Sitemap_Tag>

__construct()

__construct(  $name) 

Parameters

$name