Documentation

Option extends Child
in package

Form select option element class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://www.popphp.org/license New BSD License

version
4.0.0

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

$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
string

addNodeValue()

Add to the child node value

public addNodeValue(string $value) : Child
Parameters
$value : string
Return values
Child

create()

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
Child

getAttribute()

Get the attribute of the child object

public getAttribute(string $name) : string|null
Parameters
$name : string
Return values
string|null

getAttributes()

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|null

getChildNodes()

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
string

getNodeContent()

Return the child node content, including tags, etc

public getNodeContent([bool $ignoreWhiteSpace = false ]) : string
Parameters
$ignoreWhiteSpace : bool = false
Return values
string

getNodeName()

Return the child node name

public getNodeName() : string|null
Return values
string|null

getNodeValue()

Return the child node value

public getNodeValue() : string|null
Return values
string|null

getTextContent()

Return the child node content, including tags, etc

public getTextContent([bool $ignoreWhiteSpace = false ]) : string
Parameters
$ignoreWhiteSpace : bool = false
Return values
string

getValue()

Get the option value

public getValue() : string|null
Return values
string|null

hasAttribute()

Determine if the child object has an attribute

public hasAttribute(string $name) : bool
Parameters
$name : string
Return values
bool

hasAttributes()

Determine if the child object has attributes

public hasAttributes() : bool
Return values
bool

hasChildNodes()

Get whether or not the child object has children (alias)

public hasChildNodes() : bool
Return values
bool

hasChildren()

Get whether or not the child object has children

public hasChildren() : bool
Return values
bool

isCData()

Determine if the child node value is CDATA

public isCData() : bool
Return values
bool

isChildrenFirst()

Determine if child nodes render first, before the node value

public isChildrenFirst() : bool
Return values
bool

isSelected()

Determine if the option value is selected

public isSelected() : bool
Return values
bool

parseFile()

Static method to parse an XML/HTML string from a file

public static parseFile(string $file) : Child
Parameters
$file : string
Tags
throws
Exception
Return values
Child

parseString()

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
Child

removeAttribute()

Remove an attribute from the child element object

public removeAttribute(string $name) : Child
Parameters
$name : string
Return values
Child

removeChild()

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|null

setAsCData()

Set the child node value as CDATA

public setAsCData([bool $cData = true ]) : Child
Parameters
$cData : bool = true
Return values
Child

setAttribute()

Set an attribute for the child element object

public setAttribute(string $name[, mixed $value = null ]) : Child
Parameters
$name : string
$value : mixed = null
Return values
Child

setAttributes()

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
Child

setChildrenFirst()

Set whether child nodes render first, before the node value

public setChildrenFirst([bool $first = true ]) : Child
Parameters
$first : bool = true
Return values
Child

setNodeName()

Set the child node name

public setNodeName(string $name) : Child
Parameters
$name : string
Return values
Child

setNodeValue()

Set the child node value

public setNodeValue(string $value) : Child
Parameters
$value : string
Return values
Child

setValue()

Set the option value

public setValue(mixed $value) : Option
Parameters
$value : mixed
Return values
Option

        
On this page

Search results