PHP Класс 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.
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$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

Открытые методы

Метод Описание
__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 )

Описание методов

__construct() публичный Метод

SassContext constructor.
public __construct ( $parent = null ) : SassContext
Результат SassContext

addFunction() публичный Метод

Adds a function
public addFunction ( string $name, mixed $function ) : SassFunctionDefinitionNode
$name string name of function
$function mixed
Результат SassFunctionDefinitionNode the function

addMixin() публичный Метод

Adds a mixin
public addMixin ( string $name, mixed $mixin ) : SassMixinDefinitionNode
$name string name of mixin
$mixin mixed
Результат SassMixinDefinitionNode the mixin

getContent() публичный Метод

public getContent ( )

getFunction() публичный Метод

Returns a function
public getFunction ( string $name ) : SassFunctionDefinitionNode
$name string name of function to return
Результат SassFunctionDefinitionNode the mixin

getMixin() публичный Метод

Returns a mixin
public getMixin ( string $name ) : SassMixinDefinitionNode
$name string name of mixin to return
Результат SassMixinDefinitionNode the mixin

getVariable() публичный Метод

Returns a variable defined in this context
public getVariable ( string $name ) : string
$name string name of variable to return
Результат string the variable

hasFunction() публичный Метод

Returns a boolean wether this function exists
public hasFunction ( string $name ) : boolean
$name string name of function to check for
Результат boolean

hasVariable() публичный Метод

Returns a value indicating if the variable exists in this context
public hasVariable ( string $name ) : boolean
$name string name of variable to test
Результат boolean true if the variable exists in this context, false if not

merge() публичный Метод

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() публичный Метод

Sets a variable to the given value
public setVariable ( string $name, sassLiteral $value ) : SassContext
$name string name of variable
$value sassLiteral value of variable
Результат SassContext

setVariables() публичный Метод

public setVariables ( $vars )

Описание свойств

$content публичное свойство

tree representing any contextual content.
public $content

$functions публичное свойство

mixins defined in this context
public $functions

$mixins публичное свойство

mixins defined in this context
public $mixins

$node публичное свойство

the node being processed
public $node

$parent публичное свойство

enclosing context
public $parent

$variables публичное свойство

variables defined in this context
public $variables