PHP Class Leafo\ScssPhp\Compiler

Author: Leaf Corcoran ([email protected])
Show file Open project: leafo/scssphp Class Usage Examples

Public Properties

Property Type Description
$defaultValue
$emptyList
$emptyMap
$emptyString
$false
$null
$nullString
$selfSelector
$true
$with
$without

Protected Properties

Property Type Description
$charsetSeen
$encoding
$env
$formatter
$importCache
$importPaths
$importedFiles
$libAbs
$libAdjustColor
$libAdjustHue
$libAlpha
$libAppend
$libBlue
$libCeil
$libChangeColor
$libComparable
$libComplement
$libDarken
$libDesaturate
$libFadeIn
$libFadeOut
$libFeatureExists
$libFloor
$libFunctionExists
$libGlobalVariableExists
$libGrayscale
$libGreen
$libHsl
$libHsla
$libHue
$libIeHexStr
$libIf
$libIndex
$libInspect
$libInvert
$libJoin
$libKeywords
$libLength
$libLighten
$libLightness
$libMapGet
$libMapHasKey
$libMapKeys
$libMapMerge
$libMapRemove
$libMapValues
$libMix mix two colors
$libMixinExists
$libNth
$libOpacify increases opacity by amount
$libOpacity
$libPercentage
$libQuote
$libRandom
$libRed
$libRgb
$libRgba
$libRound
$libSaturate
$libSaturation
$libScaleColor
$libSetNth
$libStrIndex
$libStrInsert
$libStrLength
$libStrSlice
$libToLowerCase
$libToUpperCase
$libTransparentize decreases opacity by amount
$libTypeOf
$libUnit
$libUnitless
$libUnquote
$libVariableExists
$lineNumberStyle
$namespaces array
$operatorNames array
$registeredFeatures
$registeredVars
$rootBlock
$rootEnv
$scope
$sourceNames
$storeEnv
$userFunctions

Public Methods

Method Description
__construct ( ) Constructor
addFeature ( string $name ) Add feature
addImportPath ( string $path ) Add import path
addParsedFile ( string $path ) Adds to list of parsed files
assertColor ( array $value ) : array Assert value is a color
assertList ( array $value ) : array Assert value is a list
assertMap ( array $value ) : array Assert value is a map
assertNumber ( array $value ) : integer | float Assert value is a number
compile ( string $code, string $path = null ) : string Compile scss
compileValue ( array $value ) : string Compiles a primitive value into a CSS property value.
findImport ( string $url ) : string | null Return the file path for an import url if it exists
get ( string $name, boolean $shouldThrow = true, Leafo\ScssPhp\Compiler\Environment $env = null ) : mixed Get variable
getParsedFiles ( ) : array Returns list of parsed files
getVariables ( ) : array Returns list of variables
normalizeValue ( array $value ) : array Normalize value
registerFunction ( string $name, callable $func, array $prototype = null ) Register function
setEncoding ( string $encoding ) Set encoding
setFormatter ( string $formatterName ) Set formatter
setIgnoreErrors ( boolean $ignoreErrors ) : Compiler Ignore errors?
setImportPaths ( string | array $path ) Set import paths
setLineNumberStyle ( string $lineNumberStyle ) Set line number style
setNumberPrecision ( integer $numberPrecision ) Set number precision
setVariables ( array $variables ) Set variables
throwError ( string $msg ) Throw error (exception)
toBool ( mixed $thing ) : array Cast to boolean
toHSL ( integer $red, integer $green, integer $blue ) : array Convert RGB to HSL
toRGB ( integer $hue, integer $saturation, integer $lightness ) : array Convert HSL to RGB
unregisterFunction ( string $name ) Unregister function
unsetVariable ( string $name ) Unset variable

Protected Methods

Method Description
adjustHsl ( $color, $idx, $amount )
alterColor ( $args, $fn ) helper function for adjust_color, change_color, and scale_color
applyArguments ( array $argDef, array $argValues ) Apply argument values per definition
callNativeFunction ( string $name, array $args, array &$returnValue ) : boolean Call built-in and registered (PHP) functions
callScssFunction ( string $name, $argValues, array &$returnValue ) : boolean Call SCSS @function
coerceColor ( array $value ) : array | null Coerce value to color
coerceForExpression ( array $value ) : array | null Coerce color for expression
coerceList ( array $item, $delim = ',' ) : array Coerce something to list
coerceMap ( array $item ) : array Coerce something to map
coercePercent ( array $value ) : integer | float Coerce value to a percentage
coerceString ( array $value ) : array | null Coerce value to string
collapseSelectors ( array $selectors ) : string Collapse selectors
combineSelectorSingle ( array $base, array $other ) : array Combine selector single
compileAtRoot ( Leafo\ScssPhp\Block $block ) Compile at-root
compileBlock ( Leafo\ScssPhp\Block $block ) Recursively compiles a block.
compileChild ( array $child, Leafo\ScssPhp\Formatter\OutputBlock $out ) : array Compile child; returns a value to halt execution
compileChildren ( array $stms, Leafo\ScssPhp\Formatter\OutputBlock $out ) : array Compile children and return result
compileChildrenNoReturn ( array $stms, Leafo\ScssPhp\Formatter\OutputBlock $out ) Compile children and throw exception if unexpected @return
compileComment ( array $block ) Compile root level comment
compileDirective ( Leafo\ScssPhp\Block $block ) Compile directive
compileImport ( array $rawPath, array $out, boolean $once = false ) : boolean Compile import; returns true if the value was something that could be imported
compileKeyframeBlock ( Leafo\ScssPhp\Block $block, array $selectors ) Compile keyframe block
compileMedia ( Leafo\ScssPhp\Block $media ) Compile media
compileMediaQuery ( array $queryList ) : string Compile media query
compileNestedBlock ( Leafo\ScssPhp\Block $block, array $selectors ) Compile nested block
compileRoot ( Leafo\ScssPhp\Block $rootBlock ) Compile root
compileSelector ( array $selector ) : string Compile selector to string; self(&) should have been replaced by now
compileSelectorPart ( arary $piece ) : string Compile selector part
compileStringContent ( array $string ) : string Compile string content
evalSelector ( array $selector ) : array Evaluate selector
evalSelectorPart ( array $part ) : array Evaluate selector part; replaces all the interpolates, stripping quotes
evalSelectors ( array $selectors ) : array Evaluate selectors
expToString ( array $exp ) : array Reduce expression to string
extractInterpolation ( array $list ) : array Extract interpolation; it doesn't need to be recursive, compileValue will handle that
extractRelationshipFromFragment ( array $fragment ) : array Extract a relationship from the fragment.
fileExists ( string $name ) : boolean Does file exist?
fixColor ( array $c ) : array Make sure a color's components don't go out of bounds
flattenList ( array $list ) : string Flatten list
flattenSelectorSingle ( array $single ) : array Flatten selector single; joins together .classes and #ids
flattenSelectors ( Leafo\ScssPhp\Formatter\OutputBlock $block, string $parentKey = null ) Flatten selectors
getBuiltinFunction ( string $name ) : array Get built-in function
getNormalizedNumbers ( array $args ) : array Helper to normalize args containing numbers
getStoreEnv ( ) : Leafo\ScssPhp\Compiler\Environment Get store environment
handleImportLoop ( string $name ) Handle import loop
has ( string $name, Leafo\ScssPhp\Compiler\Environment $env = null ) : boolean Has variable?
hasSelectorPlaceholder ( array $selector ) : boolean Has selector placeholder?
importFile ( string $path, array $out ) Import file
injectVariables ( array $args ) Inject variables
isImmediateRelationshipCombinator ( string $value ) : boolean Is the value a direct relationship combinator?
isSelfExtend ( array $target, array $origin ) : boolean Is self extend?
isTruthy ( array $value ) : array Is truthy?
joinSelectors ( array $parent, array $child ) : array Join selectors; looks for & to replace, or append parent before child
libAbs ( $args )
libAdjustColor ( $args )
libAdjustHue ( $args )
libAlpha ( $args )
libAppend ( $args )
libBlue ( $args )
libCall ( $args, $kwargs ) protected static $libCall = ['name', 'args.
libCeil ( $args )
libChangeColor ( $args )
libComparable ( $args )
libComplement ( $args )
libCounter ( array $args ) Workaround IE7's content counter bug.
libDarken ( $args )
libDesaturate ( $args )
libFadeIn ( $args )
libFadeOut ( $args )
libFeatureExists ( $args )
libFloor ( $args )
libFunctionExists ( $args )
libGlobalVariableExists ( $args )
libGrayscale ( $args )
libGreen ( $args )
libHsl ( $args )
libHsla ( $args )
libHue ( $args )
libIeHexStr ( $args )
libIf ( $args )
libIndex ( $args )
libInspect ( $args )
libInvert ( $args )
libJoin ( $args )
libKeywords ( $args )
libLength ( $args )
libLighten ( $args )
libLightness ( $args )
libListSeparator ( $args ) protected static $libListSeparator = ['list.
libMapGet ( $args )
libMapHasKey ( $args )
libMapKeys ( $args )
libMapMerge ( $args )
libMapRemove ( $args )
libMapValues ( $args )
libMax ( $args )
libMin ( $args )
libMix ( $args )
libMixinExists ( $args )
libNth ( $args )
libOpacify ( $args )
libOpacity ( $args )
libPercentage ( $args )
libQuote ( $args )
libRandom ( $args )
libRed ( $args )
libRgb ( $args )
libRgba ( $args )
libRound ( $args )
libSaturate ( $args )
libSaturation ( $args )
libScaleColor ( $args )
libSetNth ( $args )
libStrIndex ( $args )
libStrInsert ( $args )
libStrLength ( $args )
libStrSlice ( $args )
libToLowerCase ( $args )
libToUpperCase ( $args )
libTransparentize ( $args )
libTypeOf ( $args )
libUniqueId ( )
libUnit ( $args )
libUnitless ( $args )
libUnquote ( $args )
libVariableExists ( $args )
libZip ( $args )
listSeparatorForJoin ( $list1, $sep )
makeOutputBlock ( string $type, array $selectors = null ) : Leafo\ScssPhp\Formatter\OutputBlock Make output block
matchExtends ( array $selector, array &$out, integer $from, boolean $initial = true ) Match extends
matchExtendsSingle ( array $rawSingle, array &$outOrigin ) : boolean Match extends single
mediaParent ( Leafo\ScssPhp\Formatter\OutputBlock $scope ) : Leafo\ScssPhp\Formatter\OutputBlock Media parent
mergeDirectRelationships ( $selectors1, $selectors2 )
mergeMediaTypes ( array $type1, array $type2 ) : array | null Merge media types
missingSelectors ( ) Report missing selectors
multiplyMedia ( Leafo\ScssPhp\Compiler\Environment $env = null, array $childQueries = null ) : array Multiply media
multiplySelectors ( Leafo\ScssPhp\Compiler\Environment $env ) : array Find the final set of selectors
normalizeName ( string $name ) : string Normalize name
opAdd ( array $left, array $right ) : array Add strings
opAddNumberNumber ( array $left, array $right ) : array Add numbers
opAnd ( array $left, array $right, boolean $shouldEval ) : array Boolean and
opCmpNumberNumber ( array $left, array $right ) : array Three-way comparison, aka spaceship operator
opColorColor ( string $op, array $left, array $right ) : array Compare colors
opColorNumber ( string $op, array $left, array $right ) : array Compare color and number
opDivNumberNumber ( array $left, array $right ) : array Divide numbers
opEq ( array $left, array $right ) : array Compare number1 == number2
opGtNumberNumber ( array $left, array $right ) : array Compare number1 > number2
opGteNumberNumber ( array $left, array $right ) : array Compare number1 >= number2
opLtNumberNumber ( array $left, array $right ) : array Compare number1 < number2
opLteNumberNumber ( array $left, array $right ) : array Compare number1 <= number2
opModNumberNumber ( array $left, array $right ) : array Mod numbers
opMulNumberNumber ( array $left, array $right ) : array Multiply numbers
opNeq ( array $left, array $right ) : array Compare number1 != number2
opNumberColor ( string $op, array $left, array $right ) : array Compare number and color
opOr ( array $left, array $right, boolean $shouldEval ) : array Boolean or
opSubNumberNumber ( array $left, array $right ) : array Subtract numbers
parserFactory ( string $path ) : Parser Instantiate parser
popEnv ( ) Pop environment
pushEnv ( Leafo\ScssPhp\Block $block = null ) : Leafo\ScssPhp\Compiler\Environment Push environment
pushExtends ( array $target, array $origin, stdClass $block ) Push extends
reduce ( array $value, boolean $inExp = false ) : array Reduce value
set ( string $name, mixed $value, boolean $shadow = false, Leafo\ScssPhp\Compiler\Environment $env = null ) Set variable
setExisting ( string $name, mixed $value, Leafo\ScssPhp\Compiler\Environment $env ) Set existing variable
setRaw ( string $name, mixed $value, Leafo\ScssPhp\Compiler\Environment $env ) Set raw variable
shouldEval ( array $value ) : boolean Should $value cause its operand to eval
sortArgs ( array $prototype, array $args ) : array Sorts keyword arguments

Private Methods

Method Description
coerceValue ( mixed $value ) : array Coerce a php value into a scss one
compactEnv ( Leafo\ScssPhp\Compiler\Environment $env ) : array Convert env linked list to stack
compileWith ( array $with ) : integer Compile @at-root's with: inclusion / without: exclusion into filter flags
extractEnv ( array $envs ) : Leafo\ScssPhp\Compiler\Environment Convert env stack to singly linked list
filterWithout ( array $envs, integer $without ) : Leafo\ScssPhp\Compiler\Environment Filter env stack
fncall ( string $name, array $argValues ) : array | null Function caller
hueToRGB ( float $m1, float $m2, float $h ) : float Hue to RGB helper
isWithout ( integer $without, Leafo\ScssPhp\Block $block ) : boolean Filter WITH rules
spliceTree ( array $envs, Leafo\ScssPhp\Block $block, integer $without ) : array Splice parse tree

Method Details

__construct() public method

Constructor
public __construct ( )

addFeature() public method

Add feature
public addFeature ( string $name )
$name string

addImportPath() public method

Add import path
public addImportPath ( string $path )
$path string

addParsedFile() public method

Adds to list of parsed files
public addParsedFile ( string $path )
$path string

adjustHsl() protected method

protected adjustHsl ( $color, $idx, $amount )

alterColor() protected method

helper function for adjust_color, change_color, and scale_color
protected alterColor ( $args, $fn )

applyArguments() protected method

Apply argument values per definition
protected applyArguments ( array $argDef, array $argValues )
$argDef array
$argValues array

assertColor() public method

Assert value is a color
public assertColor ( array $value ) : array
$value array
return array

assertList() public method

Assert value is a list
public assertList ( array $value ) : array
$value array
return array

assertMap() public method

Assert value is a map
public assertMap ( array $value ) : array
$value array
return array

assertNumber() public method

Assert value is a number
public assertNumber ( array $value ) : integer | float
$value array
return integer | float

callNativeFunction() protected method

Call built-in and registered (PHP) functions
protected callNativeFunction ( string $name, array $args, array &$returnValue ) : boolean
$name string
$args array
$returnValue array
return boolean Returns true if returnValue is set; otherwise, false

callScssFunction() protected method

Call SCSS @function
protected callScssFunction ( string $name, $argValues, array &$returnValue ) : boolean
$name string
$returnValue array
return boolean Returns true if returnValue is set; otherwise, false

coerceColor() protected method

Coerce value to color
protected coerceColor ( array $value ) : array | null
$value array
return array | null

coerceForExpression() protected method

Coerce color for expression
protected coerceForExpression ( array $value ) : array | null
$value array
return array | null

coerceList() protected method

Coerce something to list
protected coerceList ( array $item, $delim = ',' ) : array
$item array
return array

coerceMap() protected method

Coerce something to map
protected coerceMap ( array $item ) : array
$item array
return array

coercePercent() protected method

Coerce value to a percentage
protected coercePercent ( array $value ) : integer | float
$value array
return integer | float

coerceString() protected method

Coerce value to string
protected coerceString ( array $value ) : array | null
$value array
return array | null

collapseSelectors() protected method

Collapse selectors
protected collapseSelectors ( array $selectors ) : string
$selectors array
return string

combineSelectorSingle() protected method

Combine selector single
protected combineSelectorSingle ( array $base, array $other ) : array
$base array
$other array
return array

compile() public method

Compile scss
public compile ( string $code, string $path = null ) : string
$code string
$path string
return string

compileAtRoot() protected method

Compile at-root
protected compileAtRoot ( Leafo\ScssPhp\Block $block )
$block Leafo\ScssPhp\Block

compileBlock() protected method

A block is analogous to a CSS block in most cases. A single SCSS document is encapsulated in a block when parsed, but it does not have parent tags so all of its children appear on the root level when compiled. Blocks are made up of selectors and children. The children of a block are just all the blocks that are defined within. Compiling the block involves pushing a fresh environment on the stack, and iterating through the props, compiling each one.
See also: Compiler::compileChild()
protected compileBlock ( Leafo\ScssPhp\Block $block )
$block Leafo\ScssPhp\Block

compileChild() protected method

Compile child; returns a value to halt execution
protected compileChild ( array $child, Leafo\ScssPhp\Formatter\OutputBlock $out ) : array
$child array
$out Leafo\ScssPhp\Formatter\OutputBlock
return array

compileChildren() protected method

Compile children and return result
protected compileChildren ( array $stms, Leafo\ScssPhp\Formatter\OutputBlock $out ) : array
$stms array
$out Leafo\ScssPhp\Formatter\OutputBlock
return array

compileChildrenNoReturn() protected method

Compile children and throw exception if unexpected @return
protected compileChildrenNoReturn ( array $stms, Leafo\ScssPhp\Formatter\OutputBlock $out )
$stms array
$out Leafo\ScssPhp\Formatter\OutputBlock

compileComment() protected method

Compile root level comment
protected compileComment ( array $block )
$block array

compileDirective() protected method

Compile directive
protected compileDirective ( Leafo\ScssPhp\Block $block )
$block Leafo\ScssPhp\Block

compileImport() protected method

Compile import; returns true if the value was something that could be imported
protected compileImport ( array $rawPath, array $out, boolean $once = false ) : boolean
$rawPath array
$out array
$once boolean
return boolean

compileKeyframeBlock() protected method

Compile keyframe block
protected compileKeyframeBlock ( Leafo\ScssPhp\Block $block, array $selectors )
$block Leafo\ScssPhp\Block
$selectors array

compileMedia() protected method

Compile media
protected compileMedia ( Leafo\ScssPhp\Block $media )
$media Leafo\ScssPhp\Block

compileMediaQuery() protected method

Compile media query
protected compileMediaQuery ( array $queryList ) : string
$queryList array
return string

compileNestedBlock() protected method

Compile nested block
protected compileNestedBlock ( Leafo\ScssPhp\Block $block, array $selectors )
$block Leafo\ScssPhp\Block
$selectors array

compileRoot() protected method

Compile root
protected compileRoot ( Leafo\ScssPhp\Block $rootBlock )
$rootBlock Leafo\ScssPhp\Block

compileSelector() protected method

Compile selector to string; self(&) should have been replaced by now
protected compileSelector ( array $selector ) : string
$selector array
return string

compileSelectorPart() protected method

Compile selector part
protected compileSelectorPart ( arary $piece ) : string
$piece arary
return string

compileStringContent() protected method

Compile string content
protected compileStringContent ( array $string ) : string
$string array
return string

compileValue() public method

Values in scssphp are typed by being wrapped in arrays, their format is typically: array(type, contents [, additional_contents]*) The input is expected to be reduced. This function will not work on things like expressions and variables.
public compileValue ( array $value ) : string
$value array
return string

evalSelector() protected method

Evaluate selector
protected evalSelector ( array $selector ) : array
$selector array
return array

evalSelectorPart() protected method

Evaluate selector part; replaces all the interpolates, stripping quotes
protected evalSelectorPart ( array $part ) : array
$part array
return array

evalSelectors() protected method

Evaluate selectors
protected evalSelectors ( array $selectors ) : array
$selectors array
return array

expToString() protected method

Reduce expression to string
protected expToString ( array $exp ) : array
$exp array
return array

extractInterpolation() protected method

Extract interpolation; it doesn't need to be recursive, compileValue will handle that
protected extractInterpolation ( array $list ) : array
$list array
return array

extractRelationshipFromFragment() protected method

When extracting the last portion of a selector we will be left with a fragment which may end with a direction relationship combinator. This method will extract the relationship fragment and return it along side the rest.
protected extractRelationshipFromFragment ( array $fragment ) : array
$fragment array The selector fragment maybe ending with a direction relationship combinator.
return array The selector without the relationship fragment if any, the relationship fragment.

fileExists() protected method

Does file exist?
protected fileExists ( string $name ) : boolean
$name string
return boolean

findImport() public method

Return the file path for an import url if it exists
public findImport ( string $url ) : string | null
$url string
return string | null

fixColor() protected method

Make sure a color's components don't go out of bounds
protected fixColor ( array $c ) : array
$c array
return array

flattenList() protected method

Flatten list
protected flattenList ( array $list ) : string
$list array
return string

flattenSelectorSingle() protected method

Flatten selector single; joins together .classes and #ids
protected flattenSelectorSingle ( array $single ) : array
$single array
return array

flattenSelectors() protected method

Flatten selectors
protected flattenSelectors ( Leafo\ScssPhp\Formatter\OutputBlock $block, string $parentKey = null )
$block Leafo\ScssPhp\Formatter\OutputBlock
$parentKey string

get() public method

Get variable
public get ( string $name, boolean $shouldThrow = true, Leafo\ScssPhp\Compiler\Environment $env = null ) : mixed
$name string
$shouldThrow boolean
$env Leafo\ScssPhp\Compiler\Environment
return mixed

getBuiltinFunction() protected method

Get built-in function
protected getBuiltinFunction ( string $name ) : array
$name string Normalized name
return array

getNormalizedNumbers() protected method

Helper to normalize args containing numbers
protected getNormalizedNumbers ( array $args ) : array
$args array
return array

getParsedFiles() public method

Returns list of parsed files
public getParsedFiles ( ) : array
return array

getStoreEnv() protected method

Get store environment
protected getStoreEnv ( ) : Leafo\ScssPhp\Compiler\Environment
return Leafo\ScssPhp\Compiler\Environment

getVariables() public method

Returns list of variables
public getVariables ( ) : array
return array

handleImportLoop() protected method

Handle import loop
protected handleImportLoop ( string $name )
$name string

has() protected method

Has variable?
protected has ( string $name, Leafo\ScssPhp\Compiler\Environment $env = null ) : boolean
$name string
$env Leafo\ScssPhp\Compiler\Environment
return boolean

hasSelectorPlaceholder() protected method

Has selector placeholder?
protected hasSelectorPlaceholder ( array $selector ) : boolean
$selector array
return boolean

importFile() protected method

Import file
protected importFile ( string $path, array $out )
$path string
$out array

injectVariables() protected method

Inject variables
protected injectVariables ( array $args )
$args array

isImmediateRelationshipCombinator() protected method

Is the value a direct relationship combinator?
protected isImmediateRelationshipCombinator ( string $value ) : boolean
$value string
return boolean

isSelfExtend() protected method

Is self extend?
protected isSelfExtend ( array $target, array $origin ) : boolean
$target array
$origin array
return boolean

isTruthy() protected method

Is truthy?
protected isTruthy ( array $value ) : array
$value array
return array

joinSelectors() protected method

Join selectors; looks for & to replace, or append parent before child
protected joinSelectors ( array $parent, array $child ) : array
$parent array
$child array
return array

libAbs() protected method

protected libAbs ( $args )

libAdjustColor() protected method

protected libAdjustColor ( $args )

libAdjustHue() protected method

protected libAdjustHue ( $args )

libAlpha() protected method

protected libAlpha ( $args )

libAppend() protected method

protected libAppend ( $args )

libBlue() protected method

protected libBlue ( $args )

libCall() protected method

..'];
protected libCall ( $args, $kwargs )

libCeil() protected method

protected libCeil ( $args )

libChangeColor() protected method

protected libChangeColor ( $args )

libComparable() protected method

protected libComparable ( $args )

libComplement() protected method

protected libComplement ( $args )

libCounter() protected method

Workaround IE7's content counter bug.
protected libCounter ( array $args )
$args array

libDarken() protected method

protected libDarken ( $args )

libDesaturate() protected method

protected libDesaturate ( $args )

libFadeIn() protected method

protected libFadeIn ( $args )

libFadeOut() protected method

protected libFadeOut ( $args )

libFeatureExists() protected method

protected libFeatureExists ( $args )

libFloor() protected method

protected libFloor ( $args )

libFunctionExists() protected method

protected libFunctionExists ( $args )

libGlobalVariableExists() protected method

protected libGlobalVariableExists ( $args )

libGrayscale() protected method

protected libGrayscale ( $args )

libGreen() protected method

protected libGreen ( $args )

libHsl() protected method

protected libHsl ( $args )

libHsla() protected method

protected libHsla ( $args )

libHue() protected method

protected libHue ( $args )

libIeHexStr() protected method

protected libIeHexStr ( $args )

libIf() protected method

protected libIf ( $args )

libIndex() protected method

protected libIndex ( $args )

libInspect() protected method

protected libInspect ( $args )

libInvert() protected method

protected libInvert ( $args )

libJoin() protected method

protected libJoin ( $args )

libKeywords() protected method

protected libKeywords ( $args )

libLength() protected method

protected libLength ( $args )

libLighten() protected method

protected libLighten ( $args )

libLightness() protected method

protected libLightness ( $args )

libListSeparator() protected method

..'];
protected libListSeparator ( $args )

libMapGet() protected method

protected libMapGet ( $args )

libMapHasKey() protected method

protected libMapHasKey ( $args )

libMapKeys() protected method

protected libMapKeys ( $args )

libMapMerge() protected method

protected libMapMerge ( $args )

libMapRemove() protected method

protected libMapRemove ( $args )

libMapValues() protected method

protected libMapValues ( $args )

libMax() protected method

protected libMax ( $args )

libMin() protected method

protected libMin ( $args )

libMix() protected method

protected libMix ( $args )

libMixinExists() protected method

protected libMixinExists ( $args )

libNth() protected method

protected libNth ( $args )

libOpacify() protected method

protected libOpacify ( $args )

libOpacity() protected method

protected libOpacity ( $args )

libPercentage() protected method

protected libPercentage ( $args )

libQuote() protected method

protected libQuote ( $args )

libRandom() protected method

protected libRandom ( $args )

libRed() protected method

protected libRed ( $args )

libRgb() protected method

protected libRgb ( $args )

libRgba() protected method

protected libRgba ( $args )

libRound() protected method

protected libRound ( $args )

libSaturate() protected method

protected libSaturate ( $args )

libSaturation() protected method

protected libSaturation ( $args )

libScaleColor() protected method

protected libScaleColor ( $args )

libSetNth() protected method

protected libSetNth ( $args )

libStrIndex() protected method

protected libStrIndex ( $args )

libStrInsert() protected method

protected libStrInsert ( $args )

libStrLength() protected method

protected libStrLength ( $args )

libStrSlice() protected method

protected libStrSlice ( $args )

libToLowerCase() protected method

protected libToLowerCase ( $args )

libToUpperCase() protected method

protected libToUpperCase ( $args )

libTransparentize() protected method

protected libTransparentize ( $args )

libTypeOf() protected method

protected libTypeOf ( $args )

libUniqueId() protected method

protected libUniqueId ( )

libUnit() protected method

protected libUnit ( $args )

libUnitless() protected method

protected libUnitless ( $args )

libUnquote() protected method

protected libUnquote ( $args )

libVariableExists() protected method

protected libVariableExists ( $args )

libZip() protected method

protected libZip ( $args )

listSeparatorForJoin() protected method

protected listSeparatorForJoin ( $list1, $sep )

makeOutputBlock() protected method

Make output block
protected makeOutputBlock ( string $type, array $selectors = null ) : Leafo\ScssPhp\Formatter\OutputBlock
$type string
$selectors array
return Leafo\ScssPhp\Formatter\OutputBlock

matchExtends() protected method

Match extends
protected matchExtends ( array $selector, array &$out, integer $from, boolean $initial = true )
$selector array
$out array
$from integer
$initial boolean

matchExtendsSingle() protected method

Match extends single
protected matchExtendsSingle ( array $rawSingle, array &$outOrigin ) : boolean
$rawSingle array
$outOrigin array
return boolean

mediaParent() protected method

Media parent
protected mediaParent ( Leafo\ScssPhp\Formatter\OutputBlock $scope ) : Leafo\ScssPhp\Formatter\OutputBlock
$scope Leafo\ScssPhp\Formatter\OutputBlock
return Leafo\ScssPhp\Formatter\OutputBlock

mergeDirectRelationships() protected method

protected mergeDirectRelationships ( $selectors1, $selectors2 )

mergeMediaTypes() protected method

Merge media types
protected mergeMediaTypes ( array $type1, array $type2 ) : array | null
$type1 array
$type2 array
return array | null

missingSelectors() protected method

Report missing selectors
protected missingSelectors ( )

multiplyMedia() protected method

Multiply media
protected multiplyMedia ( Leafo\ScssPhp\Compiler\Environment $env = null, array $childQueries = null ) : array
$env Leafo\ScssPhp\Compiler\Environment
$childQueries array
return array

multiplySelectors() protected method

Find the final set of selectors
protected multiplySelectors ( Leafo\ScssPhp\Compiler\Environment $env ) : array
$env Leafo\ScssPhp\Compiler\Environment
return array

normalizeName() protected method

Normalize name
protected normalizeName ( string $name ) : string
$name string
return string

normalizeValue() public method

Normalize value
public normalizeValue ( array $value ) : array
$value array
return array

opAdd() protected method

Add strings
protected opAdd ( array $left, array $right ) : array
$left array
$right array
return array

opAddNumberNumber() protected method

Add numbers
protected opAddNumberNumber ( array $left, array $right ) : array
$left array
$right array
return array

opAnd() protected method

Boolean and
protected opAnd ( array $left, array $right, boolean $shouldEval ) : array
$left array
$right array
$shouldEval boolean
return array

opCmpNumberNumber() protected method

Three-way comparison, aka spaceship operator
protected opCmpNumberNumber ( array $left, array $right ) : array
$left array
$right array
return array

opColorColor() protected method

Compare colors
protected opColorColor ( string $op, array $left, array $right ) : array
$op string
$left array
$right array
return array

opColorNumber() protected method

Compare color and number
protected opColorNumber ( string $op, array $left, array $right ) : array
$op string
$left array
$right array
return array

opDivNumberNumber() protected method

Divide numbers
protected opDivNumberNumber ( array $left, array $right ) : array
$left array
$right array
return array

opEq() protected method

Compare number1 == number2
protected opEq ( array $left, array $right ) : array
$left array
$right array
return array

opGtNumberNumber() protected method

Compare number1 > number2
protected opGtNumberNumber ( array $left, array $right ) : array
$left array
$right array
return array

opGteNumberNumber() protected method

Compare number1 >= number2
protected opGteNumberNumber ( array $left, array $right ) : array
$left array
$right array
return array

opLtNumberNumber() protected method

Compare number1 < number2
protected opLtNumberNumber ( array $left, array $right ) : array
$left array
$right array
return array

opLteNumberNumber() protected method

Compare number1 <= number2
protected opLteNumberNumber ( array $left, array $right ) : array
$left array
$right array
return array

opModNumberNumber() protected method

Mod numbers
protected opModNumberNumber ( array $left, array $right ) : array
$left array
$right array
return array

opMulNumberNumber() protected method

Multiply numbers
protected opMulNumberNumber ( array $left, array $right ) : array
$left array
$right array
return array

opNeq() protected method

Compare number1 != number2
protected opNeq ( array $left, array $right ) : array
$left array
$right array
return array

opNumberColor() protected method

Compare number and color
protected opNumberColor ( string $op, array $left, array $right ) : array
$op string
$left array
$right array
return array

opOr() protected method

Boolean or
protected opOr ( array $left, array $right, boolean $shouldEval ) : array
$left array
$right array
$shouldEval boolean
return array

opSubNumberNumber() protected method

Subtract numbers
protected opSubNumberNumber ( array $left, array $right ) : array
$left array
$right array
return array

parserFactory() protected method

Instantiate parser
protected parserFactory ( string $path ) : Parser
$path string
return Parser

popEnv() protected method

Pop environment
protected popEnv ( )

pushEnv() protected method

Push environment
protected pushEnv ( Leafo\ScssPhp\Block $block = null ) : Leafo\ScssPhp\Compiler\Environment
$block Leafo\ScssPhp\Block
return Leafo\ScssPhp\Compiler\Environment

pushExtends() protected method

Push extends
protected pushExtends ( array $target, array $origin, stdClass $block )
$target array
$origin array
$block stdClass

reduce() protected method

Reduce value
protected reduce ( array $value, boolean $inExp = false ) : array
$value array
$inExp boolean
return array

registerFunction() public method

Register function
public registerFunction ( string $name, callable $func, array $prototype = null )
$name string
$func callable
$prototype array

set() protected method

Set variable
protected set ( string $name, mixed $value, boolean $shadow = false, Leafo\ScssPhp\Compiler\Environment $env = null )
$name string
$value mixed
$shadow boolean
$env Leafo\ScssPhp\Compiler\Environment

setEncoding() public method

Set encoding
public setEncoding ( string $encoding )
$encoding string

setExisting() protected method

Set existing variable
protected setExisting ( string $name, mixed $value, Leafo\ScssPhp\Compiler\Environment $env )
$name string
$value mixed
$env Leafo\ScssPhp\Compiler\Environment

setFormatter() public method

Set formatter
public setFormatter ( string $formatterName )
$formatterName string

setIgnoreErrors() public method

Ignore errors?
public setIgnoreErrors ( boolean $ignoreErrors ) : Compiler
$ignoreErrors boolean
return Compiler

setImportPaths() public method

Set import paths
public setImportPaths ( string | array $path )
$path string | array

setLineNumberStyle() public method

Set line number style
public setLineNumberStyle ( string $lineNumberStyle )
$lineNumberStyle string

setNumberPrecision() public method

Set number precision
public setNumberPrecision ( integer $numberPrecision )
$numberPrecision integer

setRaw() protected method

Set raw variable
protected setRaw ( string $name, mixed $value, Leafo\ScssPhp\Compiler\Environment $env )
$name string
$value mixed
$env Leafo\ScssPhp\Compiler\Environment

setVariables() public method

Set variables
public setVariables ( array $variables )
$variables array

shouldEval() protected method

Should $value cause its operand to eval
protected shouldEval ( array $value ) : boolean
$value array
return boolean

sortArgs() protected method

Sorts keyword arguments
protected sortArgs ( array $prototype, array $args ) : array
$prototype array
$args array
return array

throwError() public method

Throw error (exception)
public throwError ( string $msg )
$msg string Message with optional sprintf()-style vararg parameters

toBool() public method

Cast to boolean
public toBool ( mixed $thing ) : array
$thing mixed
return array

toHSL() public method

Convert RGB to HSL
public toHSL ( integer $red, integer $green, integer $blue ) : array
$red integer
$green integer
$blue integer
return array

toRGB() public method

Convert HSL to RGB
public toRGB ( integer $hue, integer $saturation, integer $lightness ) : array
$hue integer H from 0 to 360
$saturation integer S from 0 to 100
$lightness integer L from 0 to 100
return array

unregisterFunction() public method

Unregister function
public unregisterFunction ( string $name )
$name string

unsetVariable() public method

Unset variable
public unsetVariable ( string $name )
$name string

Property Details

$charsetSeen protected property

protected $charsetSeen

$defaultValue public static property

public static $defaultValue

$emptyList public static property

public static $emptyList

$emptyMap public static property

public static $emptyMap

$emptyString public static property

public static $emptyString

$encoding protected property

protected $encoding

$env protected property

protected $env

$false public static property

public static $false

$formatter protected property

protected $formatter

$importCache protected property

protected $importCache

$importPaths protected property

protected $importPaths

$importedFiles protected property

protected $importedFiles

$libAbs protected static property

protected static $libAbs

$libAdjustColor protected static property

protected static $libAdjustColor

$libAdjustHue protected static property

protected static $libAdjustHue

$libAlpha protected static property

protected static $libAlpha

$libAppend protected static property

protected static $libAppend

$libBlue protected static property

protected static $libBlue

$libCeil protected static property

protected static $libCeil

$libChangeColor protected static property

protected static $libChangeColor

$libComparable protected static property

protected static $libComparable

$libComplement protected static property

protected static $libComplement

$libDarken protected static property

protected static $libDarken

$libDesaturate protected static property

protected static $libDesaturate

$libFadeIn protected static property

protected static $libFadeIn

$libFadeOut protected static property

protected static $libFadeOut

$libFeatureExists protected static property

protected static $libFeatureExists

$libFloor protected static property

protected static $libFloor

$libFunctionExists protected static property

protected static $libFunctionExists

$libGlobalVariableExists protected static property

protected static $libGlobalVariableExists

$libGrayscale protected static property

protected static $libGrayscale

$libGreen protected static property

protected static $libGreen

$libHsl protected static property

protected static $libHsl

$libHsla protected static property

protected static $libHsla

$libHue protected static property

protected static $libHue

$libIeHexStr protected static property

protected static $libIeHexStr

$libIf protected static property

protected static $libIf

$libIndex protected static property

protected static $libIndex

$libInspect protected static property

protected static $libInspect

$libInvert protected static property

protected static $libInvert

$libJoin protected static property

protected static $libJoin

$libKeywords protected static property

protected static $libKeywords

$libLength protected static property

protected static $libLength

$libLighten protected static property

protected static $libLighten

$libLightness protected static property

protected static $libLightness

$libMapGet protected static property

protected static $libMapGet

$libMapHasKey protected static property

protected static $libMapHasKey

$libMapKeys protected static property

protected static $libMapKeys

$libMapMerge protected static property

protected static $libMapMerge

$libMapRemove protected static property

protected static $libMapRemove

$libMapValues protected static property

protected static $libMapValues

$libMix protected static property

mix two colors
protected static $libMix

$libMixinExists protected static property

protected static $libMixinExists

$libNth protected static property

protected static $libNth

$libOpacify protected static property

increases opacity by amount
protected static $libOpacify

$libOpacity protected static property

protected static $libOpacity

$libPercentage protected static property

protected static $libPercentage

$libQuote protected static property

protected static $libQuote

$libRandom protected static property

protected static $libRandom

$libRed protected static property

protected static $libRed

$libRgb protected static property

protected static $libRgb

$libRgba protected static property

protected static $libRgba

$libRound protected static property

protected static $libRound

$libSaturate protected static property

protected static $libSaturate

$libSaturation protected static property

protected static $libSaturation

$libScaleColor protected static property

protected static $libScaleColor

$libSetNth protected static property

protected static $libSetNth

$libStrIndex protected static property

protected static $libStrIndex

$libStrInsert protected static property

protected static $libStrInsert

$libStrLength protected static property

protected static $libStrLength

$libStrSlice protected static property

protected static $libStrSlice

$libToLowerCase protected static property

protected static $libToLowerCase

$libToUpperCase protected static property

protected static $libToUpperCase

$libTransparentize protected static property

decreases opacity by amount
protected static $libTransparentize

$libTypeOf protected static property

protected static $libTypeOf

$libUnit protected static property

protected static $libUnit

$libUnitless protected static property

protected static $libUnitless

$libUnquote protected static property

protected static $libUnquote

$libVariableExists protected static property

protected static $libVariableExists

$lineNumberStyle protected property

protected $lineNumberStyle

$namespaces protected static property

protected static array $namespaces
return array

$null public static property

public static $null

$nullString public static property

public static $nullString

$operatorNames protected static property

protected static array $operatorNames
return array

$registeredFeatures protected property

protected $registeredFeatures

$registeredVars protected property

protected $registeredVars

$rootBlock protected property

protected $rootBlock

$rootEnv protected property

protected $rootEnv

$scope protected property

protected $scope

$selfSelector public static property

public static $selfSelector

$sourceNames protected property

protected $sourceNames

$storeEnv protected property

protected $storeEnv

$true public static property

public static $true

$userFunctions protected property

protected $userFunctions

$with public static property

public static $with

$without public static property

public static $without