PHP Class DiDom\Query

Show file Open project: imangazaliev/didom Class Usage Examples

Protected Properties

Property Type Description
$compiled array

Public Methods

Method Description
buildXpath ( array $segments, string $prefix = '//' ) : string
compile ( string $expression, string $type = self::TYPE_CSS ) : string Converts a CSS selector into an XPath expression.
cssToXpath ( string $selector, string $prefix = '//' ) : string Converts a CSS selector into an XPath expression.
getCompiled ( ) : array
getSegments ( string $selector ) : array Splits the CSS selector into parts (tag name, ID, classes, attributes, pseudo-class).
setCompiled ( array $compiled )

Protected Methods

Method Description
convertAttribute ( string $name, string $value ) : string
convertContains ( string $string, boolean $caseSensetive = false ) : string
convertNthExpression ( string $expression ) : string Converts nth-expression into an XPath expression.
convertProperty ( string $name, array $args = [] ) : string
convertPseudo ( string $pseudo, string $parameters = [], string &$tagName ) : string Converts a CSS pseudo-class into an XPath expression.
parseProperty ( string $property ) : array

Method Details

buildXpath() public static method

public static buildXpath ( array $segments, string $prefix = '//' ) : string
$segments array
$prefix string Specifies the nesting of nodes
return string XPath expression

compile() public static method

Converts a CSS selector into an XPath expression.
public static compile ( string $expression, string $type = self::TYPE_CSS ) : string
$expression string XPath expression or CSS selector
$type string The type of the expression
return string XPath expression

convertAttribute() protected static method

protected static convertAttribute ( string $name, string $value ) : string
$name string The attribute name
$value string The attribute value
return string

convertContains() protected static method

protected static convertContains ( string $string, boolean $caseSensetive = false ) : string
$string string
$caseSensetive boolean
return string

convertNthExpression() protected static method

Converts nth-expression into an XPath expression.
protected static convertNthExpression ( string $expression ) : string
$expression string nth-expression
return string

convertProperty() protected static method

protected static convertProperty ( string $name, array $args = [] ) : string
$name string
$args array
return string

convertPseudo() protected static method

Converts a CSS pseudo-class into an XPath expression.
protected static convertPseudo ( string $pseudo, string $parameters = [], string &$tagName ) : string
$pseudo string Pseudo-class
$parameters string
$tagName string
return string

cssToXpath() public static method

Converts a CSS selector into an XPath expression.
public static cssToXpath ( string $selector, string $prefix = '//' ) : string
$selector string A CSS selector
$prefix string Specifies the nesting of nodes
return string XPath expression

getCompiled() public static method

public static getCompiled ( ) : array
return array

getSegments() public static method

Splits the CSS selector into parts (tag name, ID, classes, attributes, pseudo-class).
public static getSegments ( string $selector ) : array
$selector string CSS selector
return array

parseProperty() protected static method

protected static parseProperty ( string $property ) : array
$property string
return array

setCompiled() public static method

public static setCompiled ( array $compiled )
$compiled array

Property Details

$compiled protected static property

protected static array $compiled
return array