PHP Class SassNode

Base class for all Sass nodes.
Mostra file Open project: richthegeek/phpsass Class Usage Examples

Public Properties

Property Type Description
$children children of this node
$parent parent of this node
$root root node
$token source token

Public Methods

Method Description
__clone ( ) Resets children when cloned
__construct ( object $token ) : SassNode Constructor.
__get ( string $name ) : mixed Getter.
__set ( string $name, mixed $value ) : SassNode Setter.
addChild ( $child ) Adds a child to this node.
addWarning ( string $message ) Adds a warning to the node.
evaluate ( string $expression, SassContext $context, mixed $x = null ) : SassLiteral Evaluates a SassScript expression.
getChildren ( ) : array Returns the node's children
getDebug_info ( ) : boolean Returns the debug_info option setting for this node
getFilename ( ) : string Returns the filename for this node
getLastChild ( ) : SassNode Returns the last child node of this node.
getLevel ( ) : integer Returns the level of this node.
getLine ( ) : string Returns the line number for this node
getLine_numbers ( ) : boolean Returns the line_numbers option setting for this node
getParent ( ) : array Returns the node's parent
getParser ( ) : SassParser Returns the Sass parser.
getPropertySyntax ( ) : string Returns the property syntax being used.
getRenderer ( ) : SassRenderer Returns the renderer.
getScript ( ) : SassScriptParser Returns the SassScript parser.
getSource ( ) : string Returns the source for this node
getStyle ( ) : string Returns the render style of the document tree.
hasChildren ( ) : boolean Returns a value indicating if this node has children
hasParent ( ) : array Return a value indicating if this node has a parent
inDirective ( ) : boolean Returns a value indicating whether this node is in a directive
inSassScriptDirective ( ) : boolean Returns a value indicating whether this node is in a SassScript directive
interpolate ( string $expression, SassContext $context ) : string Replace interpolated SassScript contained in '#{}' with the parsed value.
isChildOf ( SassNode $node ) : boolean Returns a value indicating if this node is a child of the passed node.
isa ( object $token ) : boolean Returns a value indicating if the token represents this type of node.
parseChildren ( SassContext $context ) : array Parse the children of the node.
printDebugTree ( $i )
setRoot ( SassNode $root ) Sets a root recursively.

Method Details

__clone() public method

Resets children when cloned
See also: parse
public __clone ( )

__construct() public method

Constructor.
public __construct ( object $token ) : SassNode
$token object source token
return SassNode

__get() public method

Getter.
public __get ( string $name ) : mixed
$name string name of property to get
return mixed return value of getter function

__set() public method

Setter.
public __set ( string $name, mixed $value ) : SassNode
$name string name of property to set
$value mixed value of property
return SassNode this node

addChild() public method

Adds a child to this node.
public addChild ( $child )

addWarning() public method

Adds a warning to the node.
public addWarning ( string $message )
$message string warning message

evaluate() public method

Evaluates a SassScript expression.
public evaluate ( string $expression, SassContext $context, mixed $x = null ) : SassLiteral
$expression string expression to evaluate
$context SassContext the context in which the expression is evaluated
$x mixed
return SassLiteral value of parsed expression

getChildren() public method

Returns the node's children
public getChildren ( ) : array
return array the node's children

getDebug_info() public method

Returns the debug_info option setting for this node
public getDebug_info ( ) : boolean
return boolean the debug_info option setting for this node

getFilename() public method

Returns the filename for this node
public getFilename ( ) : string
return string the filename for this node

getLastChild() public method

Returns the last child node of this node.
public getLastChild ( ) : SassNode
return SassNode the last child node of this node

getLevel() public method

Returns the level of this node.
public getLevel ( ) : integer
return integer the level of this node

getLine() public method

Returns the line number for this node
public getLine ( ) : string
return string the line number for this node

getLine_numbers() public method

Returns the line_numbers option setting for this node
public getLine_numbers ( ) : boolean
return boolean the line_numbers option setting for this node

getParent() public method

Returns the node's parent
public getParent ( ) : array
return array the node's parent

getParser() public method

Returns the Sass parser.
public getParser ( ) : SassParser
return SassParser the Sass parser

getPropertySyntax() public method

Returns the property syntax being used.
public getPropertySyntax ( ) : string
return string the property syntax being used

getRenderer() public method

Returns the renderer.
public getRenderer ( ) : SassRenderer
return SassRenderer the renderer

getScript() public method

Returns the SassScript parser.
public getScript ( ) : SassScriptParser
return SassScriptParser the SassScript parser

getSource() public method

Returns the source for this node
public getSource ( ) : string
return string the source for this node

getStyle() public method

Returns the render style of the document tree.
public getStyle ( ) : string
return string the render style of the document tree

hasChildren() public method

Returns a value indicating if this node has children
public hasChildren ( ) : boolean
return boolean true if the node has children, false if not

hasParent() public method

Return a value indicating if this node has a parent
public hasParent ( ) : array
return array the node's parent

inDirective() public method

Returns a value indicating whether this node is in a directive
public inDirective ( ) : boolean
return boolean

inSassScriptDirective() public method

Returns a value indicating whether this node is in a SassScript directive
public inSassScriptDirective ( ) : boolean
return boolean

interpolate() public method

Replace interpolated SassScript contained in '#{}' with the parsed value.
public interpolate ( string $expression, SassContext $context ) : string
$expression string the text to interpolate
$context SassContext the context in which the string is interpolated
return string the interpolated text

isChildOf() public method

This just checks the levels of the nodes. If this node is at a greater level than the passed node if is a child of it.
public isChildOf ( SassNode $node ) : boolean
$node SassNode
return boolean true if the node is a child of the passed node, false if not

isa() public static method

Returns a value indicating if the token represents this type of node.
public static isa ( object $token ) : boolean
$token object token
return boolean true if the token represents this type of node, false if not

parseChildren() public method

Parse the children of the node.
public parseChildren ( SassContext $context ) : array
$context SassContext the context in which the children are parsed
return array the parsed child nodes

printDebugTree() public method

public printDebugTree ( $i )

setRoot() public method

Sets a root recursively.
public setRoot ( SassNode $root )
$root SassNode the new root node

Property Details

$children public_oe property

children of this node
public $children

$parent public_oe property

parent of this node
public $parent

$root public_oe property

root node
public $root

$token public_oe property

source token
public $token