PHP Class SassRuleNode

Represents a CSS rule.
Inheritance: extends SassNode
Show file Open project: richthegeek/phpsass Class Usage Examples

Public Methods

Method Description
__construct ( object $token ) : SassRuleNode SassRuleNode constructor.
addSelectors ( string $selectors, boolean $explode = true ) Adds selector(s) to the rule.
extend ( ) Extend this nodes selectors $extendee is the subject of the @extend directive $extender is the selector that contains the @extend directive $selector a selector or selector sequence that is to be extended
getIsContinued ( ) : boolean Returns a value indicating if the selectors for this rule are to be continued.
getSelectors ( ) : array Returns the selectors
isPlaceholder ( $selector )
parse ( SassContext $context ) : array Parse this node and its children into static nodes.
render ( ) : string Render this node and its children to CSS.
resolveSelectors ( SassContext $context ) : array Resolves selectors.

Protected Methods

Method Description
getParentSelectors ( mixed $context ) : array Returns the parent selector(s) for this node.

Private Methods

Method Description
explode ( string $string ) : array Explodes a string of selectors into an array.
hasParentReference ( string $selector ) : boolean Determines if there is a parent reference in the selector
isPsuedo ( string $selector ) : boolean Tests whether the selector is a psuedo selector
isSequence ( string $selector ) : boolean Tests whether the selector is a sequence selector
mergeSequence ( string $extender, string $extendee, string $selector ) : array Merges selector sequences
parentReferencePos ( string $selector ) : mixed Returns the position of the first parent reference in the selector.
resolveParentReferences ( string $selector, mixed $context ) : string Resolves parent references in the selector

Method Details

__construct() public method

SassRuleNode constructor.
public __construct ( object $token ) : SassRuleNode
$token object source token
return SassRuleNode

addSelectors() public method

If the selectors are to continue for the rule the selector must end in a comma
public addSelectors ( string $selectors, boolean $explode = true )
$selectors string selector
$explode boolean

extend() public method

Extend this nodes selectors $extendee is the subject of the @extend directive $extender is the selector that contains the @extend directive $selector a selector or selector sequence that is to be extended
public extend ( )

getIsContinued() public method

Returns a value indicating if the selectors for this rule are to be continued.
public getIsContinued ( ) : boolean
return boolean rue if the selectors for this rule are to be continued false if not

getParentSelectors() protected method

This in an empty array if there is no parent selector.
protected getParentSelectors ( mixed $context ) : array
$context mixed
return array the parent selector for this node

getSelectors() public method

Returns the selectors
public getSelectors ( ) : array
return array selectors

isPlaceholder() public method

public isPlaceholder ( $selector )

parse() public method

Parse this node and its children into static nodes.
public parse ( SassContext $context ) : array
$context SassContext the context in which this node is parsed
return array the parsed node and its children

render() public method

Render this node and its children to CSS.
public render ( ) : string
return string the rendered node

resolveSelectors() public method

Interpolates SassScript in selectors and resolves any parent references or appends the parent selectors.
public resolveSelectors ( SassContext $context ) : array
$context SassContext the context in which this node is parsed Change: 7/Dec/11 - change to make selector ordering conform to Ruby compiler.
return array