PHP Класс HtmlObject\Traits\Tag

Наследование: extends HtmlObject\Traits\TreeObject
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$config The base configuration inherited by classes.

Защищенные свойства (Protected)

Свойство Тип Описание
$attributes The object's attribute.
$element The element name.
$injectedProperties A list of class properties to be added to attributes.
$isOpened Whether the current tag is opened or not.
$isSelfClosing Whether the element is self closing.
$value The object's value.

Открытые методы

Метод Описание
__call ( string $method, array $parameters ) Dynamically set attributes.
__get ( string $item ) : mixed Get an attribute or a child.
__set ( string $attribute, string $value ) Dynamically set an attribute.
__toString ( ) : string | null Render on string conversion.
addClass ( string $class ) Add one or more classes to the current field.
close ( ) : string | null Close the Tag.
getAttribute ( string $attribute ) : mixed Get an attribute.
getAttributes ( ) : array Get all attributes.
getContent ( ) : string Returns the Tag's content.
getValue ( ) : string | null Get the value.
isOpened ( ) : boolean Check if the tag is opened.
open ( ) : string | null Opens the Tag.
openOn ( $onChildren ) : string Open the tag tree on a particular child.
removeAttribute ( string $attribute ) Remove an attribute.
removeClass ( string $classes ) Remove one or more classes to the current field.
render ( ) : string | null Default rendering method.
replaceAttributes ( array $attributes ) Replace all attributes with the provided array.
setAttribute ( string $attribute, string | null $value = null ) Set an attribute.
setAttributes ( array $attributes ) Set a bunch of parameters at once.
setElement ( string $element ) Changes the Tag's element.
setValue ( string $value ) Change the object's value.
wrapValue ( string $tag ) Wrap the value in a tag.
wrapWith ( string | HtmlObject\Element $element, $name = null ) : HtmlObject\Element Wrap the Element in another element.

Защищенные методы

Метод Описание
getTagCloser ( ) : string Get the preferred way to close a tag.
injectProperties ( ) : array Return an array of protected properties to bind as attributes.
renderChildren ( ) : string Get all the children as a string.
setTag ( string $element, string | null $value = null, array $attributes = [] ) Set up a new tag.

Описание методов

__call() публичный метод

Dynamically set attributes.
public __call ( string $method, array $parameters )
$method string An attribute
$parameters array Its value(s)

__get() публичный метод

Get an attribute or a child.
public __get ( string $item ) : mixed
$item string The desired child/attribute
Результат mixed

__set() публичный метод

Dynamically set an attribute.
public __set ( string $attribute, string $value )
$attribute string The attribute
$value string Its value

__toString() публичный метод

Render on string conversion.
public __toString ( ) : string | null
Результат string | null

addClass() публичный метод

Add one or more classes to the current field.
public addClass ( string $class )
$class string The class(es) to add

close() публичный метод

Close the Tag.
public close ( ) : string | null
Результат string | null

getAttribute() публичный метод

Get an attribute.
public getAttribute ( string $attribute ) : mixed
$attribute string
Результат mixed

getAttributes() публичный метод

Get all attributes.
public getAttributes ( ) : array
Результат array

getContent() публичный метод

Returns the Tag's content.
public getContent ( ) : string
Результат string

getTagCloser() защищенный метод

Get the preferred way to close a tag.
protected getTagCloser ( ) : string
Результат string

getValue() публичный метод

Get the value.
public getValue ( ) : string | null
Результат string | null

injectProperties() защищенный метод

Return an array of protected properties to bind as attributes.
protected injectProperties ( ) : array
Результат array

isOpened() публичный метод

Check if the tag is opened.
public isOpened ( ) : boolean
Результат boolean

open() публичный метод

Opens the Tag.
public open ( ) : string | null
Результат string | null

openOn() публичный метод

Open the tag tree on a particular child.
public openOn ( $onChildren ) : string
Результат string

removeAttribute() публичный метод

Remove an attribute.
public removeAttribute ( string $attribute )
$attribute string

removeClass() публичный метод

Remove one or more classes to the current field.
public removeClass ( string $classes )
$classes string The class(es) to remove

render() публичный метод

Default rendering method.
public render ( ) : string | null
Результат string | null

renderChildren() защищенный метод

Get all the children as a string.
protected renderChildren ( ) : string
Результат string

replaceAttributes() публичный метод

Replace all attributes with the provided array.
public replaceAttributes ( array $attributes )
$attributes array The attributes to replace with

setAttribute() публичный метод

Set an attribute.
public setAttribute ( string $attribute, string | null $value = null )
$attribute string An attribute
$value string | null Its value

setAttributes() публичный метод

Set a bunch of parameters at once.
public setAttributes ( array $attributes )
$attributes array The attributes to add to the existing ones

setElement() публичный метод

Changes the Tag's element.
public setElement ( string $element )
$element string

setTag() защищенный метод

Set up a new tag.
protected setTag ( string $element, string | null $value = null, array $attributes = [] )
$element string Its element
$value string | null Its value
$attributes array Its attributes

setValue() публичный метод

Change the object's value.
public setValue ( string $value )
$value string

wrapValue() публичный метод

Wrap the value in a tag.
public wrapValue ( string $tag )
$tag string The tag

wrapWith() публичный метод

Wrap the Element in another element.
public wrapWith ( string | HtmlObject\Element $element, $name = null ) : HtmlObject\Element
$element string | HtmlObject\Element The element's tag
Результат HtmlObject\Element

Описание свойств

$attributes защищенное свойство

The object's attribute.
protected $attributes

$config публичное статическое свойство

The base configuration inherited by classes.
public static $config

$element защищенное свойство

The element name.
protected $element

$injectedProperties защищенное свойство

A list of class properties to be added to attributes.
protected $injectedProperties

$isOpened защищенное свойство

Whether the current tag is opened or not.
protected $isOpened

$isSelfClosing защищенное свойство

Whether the element is self closing.
protected $isSelfClosing

$value защищенное свойство

The object's value.
protected $value