PHP Class PHPHtmlParser\Selector

Show file Open project: paquettg/php-html-parser Class Usage Examples

Protected Properties

Property Type Description
$pattern string Pattern of CSS selectors, modified from 'mootools'
$selectors

Public Methods

Method Description
__construct ( string $selector ) Constructs with the selector string
find ( AbstractNode $node ) : Collection Attempts to find the selectors starting from the given node object.
getSelectors ( ) : array Returns the selectors that where found in __construct

Protected Methods

Method Description
alterNext ( array $rule ) : array Attempts to figure out what the alteration will be for the next element.
flattenOptions ( array $optionsArray ) : array Flattens the option array.
match ( string $operator, string $pattern, string $value ) : boolean Attempts to match the given arguments with the given operator.
parseSelectorString ( string $selector ) Parses the selector string
seek ( array $nodes, array $rule, array $options ) : array Attempts to find all children that match the rule given.

Method Details

__construct() public method

Constructs with the selector string
public __construct ( string $selector )
$selector string

alterNext() protected method

Attempts to figure out what the alteration will be for the next element.
protected alterNext ( array $rule ) : array
$rule array
return array

find() public method

Attempts to find the selectors starting from the given node object.
public find ( AbstractNode $node ) : Collection
$node PHPHtmlParser\Dom\AbstractNode
return PHPHtmlParser\Dom\Collection

flattenOptions() protected method

Flattens the option array.
protected flattenOptions ( array $optionsArray ) : array
$optionsArray array
return array

getSelectors() public method

Returns the selectors that where found in __construct
public getSelectors ( ) : array
return array

match() protected method

Attempts to match the given arguments with the given operator.
protected match ( string $operator, string $pattern, string $value ) : boolean
$operator string
$pattern string
$value string
return boolean

parseSelectorString() protected method

Parses the selector string
protected parseSelectorString ( string $selector )
$selector string

seek() protected method

Attempts to find all children that match the rule given.
protected seek ( array $nodes, array $rule, array $options ) : array
$nodes array
$rule array
$options array
return array

Property Details

$pattern protected property

Pattern of CSS selectors, modified from 'mootools'
protected string $pattern
return string

$selectors protected property

protected $selectors