PHP Class PHPHtmlParser\Dom\Tag

Mostrar archivo Open project: paquettg/php-html-parser Class Usage Examples

Protected Properties

Property Type Description
$attr array The attributes of the tag.
$encode mixed .. encode the tags
$name string The name of the tag.
$noise Tag noise
$selfClosing boolean Is this tag self closing.

Public Methods

Method Description
__construct ( $name ) Sets up the tag with a name.
__get ( string $key ) : mixed Magic method to get any of the attributes.
__set ( string $key, mixed $value ) Magic method to set any attribute.
getAttribute ( string $key ) : mixed Returns an attribute by the key
getAttributes ( ) : array Returns all attributes of this tag.
isSelfClosing ( ) : boolean Checks if the tag is self closing.
makeClosingTag ( ) : string Generates the closing tag for this object.
makeOpeningTag ( ) : string Generates the opening tag for this object.
name ( ) : string Returns the name of this tag.
noise ( $noise ) Sets the noise for this tag (if any)
removeAllAttributes ( ) : void Removes all attributes on this tag.
removeAttribute ( $key ) : void Removes an attribute from this tag.
selfClosing ( ) Sets the tag to be self closing.
setAttribute ( string $key, string | array $value ) Set an attribute for this tag.
setAttributes ( array $attr ) Sets the attributes for this tag
setEncoding ( stringEncode\Encode $encode ) Sets the encoding type to be used.

Method Details

__construct() public method

Sets up the tag with a name.
public __construct ( $name )
$name

__get() public method

Magic method to get any of the attributes.
public __get ( string $key ) : mixed
$key string
return mixed

__set() public method

Magic method to set any attribute.
public __set ( string $key, mixed $value )
$key string
$value mixed

getAttribute() public method

Returns an attribute by the key
public getAttribute ( string $key ) : mixed
$key string
return mixed

getAttributes() public method

Returns all attributes of this tag.
public getAttributes ( ) : array
return array

isSelfClosing() public method

Checks if the tag is self closing.
public isSelfClosing ( ) : boolean
return boolean

makeClosingTag() public method

Generates the closing tag for this object.
public makeClosingTag ( ) : string
return string

makeOpeningTag() public method

Generates the opening tag for this object.
public makeOpeningTag ( ) : string
return string

name() public method

Returns the name of this tag.
public name ( ) : string
return string

noise() public method

Sets the noise for this tag (if any)
public noise ( $noise )
$noise

removeAllAttributes() public method

Removes all attributes on this tag.
public removeAllAttributes ( ) : void
return void

removeAttribute() public method

Removes an attribute from this tag.
public removeAttribute ( $key ) : void
$key
return void

selfClosing() public method

Sets the tag to be self closing.
public selfClosing ( )

setAttribute() public method

Set an attribute for this tag.
public setAttribute ( string $key, string | array $value )
$key string
$value string | array

setAttributes() public method

Sets the attributes for this tag
public setAttributes ( array $attr )
$attr array

setEncoding() public method

Sets the encoding type to be used.
public setEncoding ( stringEncode\Encode $encode )
$encode stringEncode\Encode

Property Details

$attr protected_oe property

The attributes of the tag.
protected array $attr
return array

$encode protected_oe property

.. encode the tags
protected mixed $encode
return mixed

$name protected_oe property

The name of the tag.
protected string $name
return string

$noise protected_oe property

Tag noise
protected $noise

$selfClosing protected_oe property

Is this tag self closing.
protected bool $selfClosing
return boolean