PHP Class SassContext

Defines the context that the parser is operating in and so allows variables to be scoped. A new context is created for Mixins and imported files.
Afficher le fichier Open project: richthegeek/phpsass Class Usage Examples

Méthodes publiques

Свойство Type Description
$content tree representing any contextual content.
$functions mixins defined in this context
$mixins mixins defined in this context
$node the node being processed
$parent enclosing context
$variables variables defined in this context

Méthodes publiques

Méthode Description
__construct ( $parent = null ) : SassContext SassContext constructor.
addFunction ( string $name, mixed $function ) : SassFunctionDefinitionNode Adds a function
addMixin ( string $name, mixed $mixin ) : SassMixinDefinitionNode Adds a mixin
getContent ( )
getFunction ( string $name ) : SassFunctionDefinitionNode Returns a function
getMixin ( string $name ) : SassMixinDefinitionNode Returns a mixin
getVariable ( string $name ) : string Returns a variable defined in this context
hasFunction ( string $name ) : boolean Returns a boolean wether this function exists
hasVariable ( string $name ) : boolean Returns a value indicating if the variable exists in this context
merge ( ) Makes variables and mixins from this context available in the parent context.
setVariable ( string $name, sassLiteral $value ) : SassContext Sets a variable to the given value
setVariables ( $vars )

Method Details

__construct() public méthode

SassContext constructor.
public __construct ( $parent = null ) : SassContext
Résultat SassContext

addFunction() public méthode

Adds a function
public addFunction ( string $name, mixed $function ) : SassFunctionDefinitionNode
$name string name of function
$function mixed
Résultat SassFunctionDefinitionNode the function

addMixin() public méthode

Adds a mixin
public addMixin ( string $name, mixed $mixin ) : SassMixinDefinitionNode
$name string name of mixin
$mixin mixed
Résultat SassMixinDefinitionNode the mixin

getContent() public méthode

public getContent ( )

getFunction() public méthode

Returns a function
public getFunction ( string $name ) : SassFunctionDefinitionNode
$name string name of function to return
Résultat SassFunctionDefinitionNode the mixin

getMixin() public méthode

Returns a mixin
public getMixin ( string $name ) : SassMixinDefinitionNode
$name string name of mixin to return
Résultat SassMixinDefinitionNode the mixin

getVariable() public méthode

Returns a variable defined in this context
public getVariable ( string $name ) : string
$name string name of variable to return
Résultat string the variable

hasFunction() public méthode

Returns a boolean wether this function exists
public hasFunction ( string $name ) : boolean
$name string name of function to check for
Résultat boolean

hasVariable() public méthode

Returns a value indicating if the variable exists in this context
public hasVariable ( string $name ) : boolean
$name string name of variable to test
Résultat boolean true if the variable exists in this context, false if not

merge() public méthode

Note that if there are variables or mixins with the same name in the two contexts they will be set to that defined in this context.
public merge ( )

setVariable() public méthode

Sets a variable to the given value
public setVariable ( string $name, sassLiteral $value ) : SassContext
$name string name of variable
$value sassLiteral value of variable
Résultat SassContext

setVariables() public méthode

public setVariables ( $vars )

Property Details

$content public_oe property

tree representing any contextual content.
public $content

$functions public_oe property

mixins defined in this context
public $functions

$mixins public_oe property

mixins defined in this context
public $mixins

$node public_oe property

the node being processed
public $node

$parent public_oe property

enclosing context
public $parent

$variables public_oe property

variables defined in this context
public $variables