Option
extends Child
in package
Form select option element class
Tags
Table of Contents
Properties
- $attributes : array<string|int, mixed>
- Child element attributes
- $cData : bool
- Child element node value CDATA flag
- $childNodes : array<string|int, mixed>
- Object child nodes
- $childrenFirst : bool
- Flag to render children before node value or not
- $indent : string|null
- Indentation for formatting purposes
- $nodeName : string|null
- Child element node name
- $nodeValue : string|null
- Child element node value
- $output : string|null
- Child output
- $parent : AbstractNode|null
- Parent node
- $preserveWhiteSpace : bool
- Flag to preserve whitespace
Methods
- __construct() : mixed
- Constructor
- __toString() : string
- Render Dom child object to string
- addChild() : AbstractNode
- Add a child to the object
- addChildren() : AbstractNode
- Add children to the object
- addNodeValue() : Child
- Add to the child node value
- create() : Child
- Static factory method to create a child object
- deselect() : Option
- Deselect the option value
- getAttribute() : string|null
- Get the attribute of the child object
- getAttributes() : array<string|int, mixed>
- Get the attributes of the child object
- getChild() : Child|null
- Get the child nodes of the object
- getChildNodes() : array<string|int, mixed>
- Get the child nodes of the object (alias)
- getChildren() : array<string|int, mixed>
- Get the child nodes of the object
- getIndent() : string
- Return the indent
- getNodeContent() : string
- Return the child node content, including tags, etc
- getNodeName() : string|null
- Return the child node name
- getNodeValue() : string|null
- Return the child node value
- getParent() : AbstractNode|null
- Return the parent node
- getTextContent() : string
- Return the child node content, including tags, etc
- getValue() : string|null
- Get the option value
- hasAttribute() : bool
- Determine if the child object has an attribute
- hasAttributes() : bool
- Determine if the child object has attributes
- hasChildNodes() : bool
- Get whether or not the child object has children (alias)
- hasChildren() : bool
- Get whether or not the child object has children
- isCData() : bool
- Determine if the child node value is CDATA
- isChildrenFirst() : bool
- Determine if child nodes render first, before the node value
- isSelected() : bool
- Determine if the option value is selected
- parseFile() : Child
- Static method to parse an XML/HTML string from a file
- parseString() : Child|array<string|int, mixed>
- Static method to parse an XML/HTML string
- preserveWhiteSpace() : Child
- Set whether to preserve whitespace
- removeAttribute() : Child
- Remove an attribute from the child element object
- removeChild() : void
- Remove all child nodes from the object
- removeChildren() : void
- Remove all child nodes from the object
- render() : string|null
- Render the child and its child nodes.
- select() : Option
- Select the option value
- setAsCData() : Child
- Set the child node value as CDATA
- setAttribute() : Child
- Set an attribute for the child element object
- setAttributes() : Child
- Set an attribute or attributes for the child element object
- setChildrenFirst() : Child
- Set whether child nodes render first, before the node value
- setIndent() : AbstractNode
- Set the indent
- setNodeName() : Child
- Set the child node name
- setNodeValue() : Child
- Set the child node value
- setParent() : AbstractNode
- Set the parent node
- setValue() : Option
- Set the option value
Properties
$attributes
Child element attributes
protected
array<string|int, mixed>
$attributes
= []
$cData
Child element node value CDATA flag
protected
bool
$cData
= false
$childNodes
Object child nodes
protected
array<string|int, mixed>
$childNodes
= []
$childrenFirst
Flag to render children before node value or not
protected
bool
$childrenFirst
= false
$indent
Indentation for formatting purposes
protected
string|null
$indent
= null
$nodeName
Child element node name
protected
string|null
$nodeName
= null
$nodeValue
Child element node value
protected
string|null
$nodeValue
= null
$output
Child output
protected
string|null
$output
= null
$parent
Parent node
protected
AbstractNode|null
$parent
= null
$preserveWhiteSpace
Flag to preserve whitespace
protected
bool
$preserveWhiteSpace
= true
Methods
__construct()
Constructor
public
__construct(string $value, string $nodeValue[, array<string|int, mixed> $options = [] ]) : mixed
Instantiate the option element object
Parameters
- $value : string
- $nodeValue : string
- $options : array<string|int, mixed> = []
__toString()
Render Dom child object to string
public
__toString() : string
Return values
stringaddChild()
Add a child to the object
public
addChild(Child $c) : AbstractNode
Parameters
- $c : Child
Tags
Return values
AbstractNodeaddChildren()
Add children to the object
public
addChildren(mixed $children) : AbstractNode
Parameters
- $children : mixed
Tags
Return values
AbstractNodeaddNodeValue()
Add to the child node value
public
addNodeValue(string $value) : Child
Parameters
- $value : string
Return values
Childcreate()
Static factory method to create a child object
public
static create(string $name[, string|null $value = null ][, array<string|int, mixed> $options = [] ]) : Child
Parameters
- $name : string
- $value : string|null = null
- $options : array<string|int, mixed> = []
Return values
Childdeselect()
Deselect the option value
public
deselect() : Option
Return values
OptiongetAttribute()
Get the attribute of the child object
public
getAttribute(string $name) : string|null
Parameters
- $name : string
Return values
string|nullgetAttributes()
Get the attributes of the child object
public
getAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>getChild()
Get the child nodes of the object
public
getChild(int $i) : Child|null
Parameters
- $i : int
Return values
Child|nullgetChildNodes()
Get the child nodes of the object (alias)
public
getChildNodes() : array<string|int, mixed>
Return values
array<string|int, mixed>getChildren()
Get the child nodes of the object
public
getChildren() : array<string|int, mixed>
Return values
array<string|int, mixed>getIndent()
Return the indent
public
getIndent() : string
Return values
stringgetNodeContent()
Return the child node content, including tags, etc
public
getNodeContent([bool $ignoreWhiteSpace = false ]) : string
Parameters
- $ignoreWhiteSpace : bool = false
Return values
stringgetNodeName()
Return the child node name
public
getNodeName() : string|null
Return values
string|nullgetNodeValue()
Return the child node value
public
getNodeValue() : string|null
Return values
string|nullgetParent()
Return the parent node
public
getParent() : AbstractNode|null
Return values
AbstractNode|nullgetTextContent()
Return the child node content, including tags, etc
public
getTextContent([bool $ignoreWhiteSpace = false ]) : string
Parameters
- $ignoreWhiteSpace : bool = false
Return values
stringgetValue()
Get the option value
public
getValue() : string|null
Return values
string|nullhasAttribute()
Determine if the child object has an attribute
public
hasAttribute(string $name) : bool
Parameters
- $name : string
Return values
boolhasAttributes()
Determine if the child object has attributes
public
hasAttributes() : bool
Return values
boolhasChildNodes()
Get whether or not the child object has children (alias)
public
hasChildNodes() : bool
Return values
boolhasChildren()
Get whether or not the child object has children
public
hasChildren() : bool
Return values
boolisCData()
Determine if the child node value is CDATA
public
isCData() : bool
Return values
boolisChildrenFirst()
Determine if child nodes render first, before the node value
public
isChildrenFirst() : bool
Return values
boolisSelected()
Determine if the option value is selected
public
isSelected() : bool
Return values
boolparseFile()
Static method to parse an XML/HTML string from a file
public
static parseFile(string $file) : Child
Parameters
- $file : string
Tags
Return values
ChildparseString()
Static method to parse an XML/HTML string
public
static parseString(string $string) : Child|array<string|int, mixed>
Parameters
- $string : string
Return values
Child|array<string|int, mixed>preserveWhiteSpace()
Set whether to preserve whitespace
public
preserveWhiteSpace([bool $preserve = true ]) : Child
Parameters
- $preserve : bool = true
Return values
ChildremoveAttribute()
Remove an attribute from the child element object
public
removeAttribute(string $name) : Child
Parameters
- $name : string
Return values
ChildremoveChild()
Remove all child nodes from the object
public
removeChild(int $i) : void
Parameters
- $i : int
removeChildren()
Remove all child nodes from the object
public
removeChildren() : void
render()
Render the child and its child nodes.
public
render([int $depth = 0 ][, string|null $indent = null ][, bool $inner = false ]) : string|null
Parameters
- $depth : int = 0
- $indent : string|null = null
- $inner : bool = false
Return values
string|nullselect()
Select the option value
public
select() : Option
Return values
OptionsetAsCData()
Set the child node value as CDATA
public
setAsCData([bool $cData = true ]) : Child
Parameters
- $cData : bool = true
Return values
ChildsetAttribute()
Set an attribute for the child element object
public
setAttribute(string $name[, mixed $value = null ]) : Child
Parameters
- $name : string
- $value : mixed = null
Return values
ChildsetAttributes()
Set an attribute or attributes for the child element object
public
setAttributes(array<string|int, mixed> $attributes) : Child
Parameters
- $attributes : array<string|int, mixed>
Return values
ChildsetChildrenFirst()
Set whether child nodes render first, before the node value
public
setChildrenFirst([bool $first = true ]) : Child
Parameters
- $first : bool = true
Return values
ChildsetIndent()
Set the indent
public
setIndent(string $indent) : AbstractNode
Parameters
- $indent : string
Return values
AbstractNodesetNodeName()
Set the child node name
public
setNodeName(string $name) : Child
Parameters
- $name : string
Return values
ChildsetNodeValue()
Set the child node value
public
setNodeValue(string $value) : Child
Parameters
- $value : string
Return values
ChildsetParent()
Set the parent node
public
setParent(AbstractNode $parent) : AbstractNode
Parameters
- $parent : AbstractNode
Return values
AbstractNodesetValue()
Set the option value
public
setValue(mixed $value) : Option
Parameters
- $value : mixed