Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401]

SCSSPHP

Copyright: 2012-2020 Leaf Corcoran
License: http://opensource.org/licenses/MIT MIT
File Size: 10430 lines (313 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Compiler:: (302 methods):
  __construct()
  getCompileOptions()
  setLogger()
  setErrorOuput()
  compile()
  compileString()
  isFreshCachedResult()
  parserFactory()
  isSelfExtend()
  pushExtends()
  makeOutputBlock()
  compileRoot()
  missingSelectors()
  flattenSelectors()
  glueFunctionSelectors()
  matchExtends()
  isPseudoSelector()
  pushOrMergeExtentedSelector()
  matchExtendsSingle()
  extractRelationshipFromFragment()
  combineSelectorSingle()
  compileMedia()
  mediaParent()
  compileDirective()
  compileDirectiveName()
  compileAtRoot()
  filterScopeWithWithout()
  completeScope()
  findScopeSelectors()
  compileWith()
  filterWithWithout()
  isWith()
  testWithWithout()
  compileKeyframeBlock()
  compileNestedPropertiesBlock()
  compileNestedBlock()
  compileBlock()
  compileCommentValue()
  compileComment()
  evalSelectors()
  evalSelector()
  evalSelectorPart()
  collapseSelectors()
  collapseSelectorsAsList()
  replaceSelfSelector()
  flattenSelectorSingle()
  compileSelector()
  compileSelectorPart()
  hasSelectorPlaceholder()
  pushCallStack()
  popCallStack()
  compileChildren()
  compileChildrenNoReturn()
  evaluateMediaQuery()
  compileMediaQuery()
  mergeDirectRelationships()
  mergeMediaTypes()
  compileImport()
  compileImportPath()
  escapeImportPathString()
  appendRootDirective()
  appendOutputLine()
  compileChild()
  expToString()
  isTruthy()
  isImmediateRelationshipCombinator()
  shouldEval()
  reduce()
  fncall()
  cssValidArg()
  stringifyFncallArgs()
  getFunctionReference()
  normalizeName()
  normalizeValue()
  opAddNumberNumber()
  opMulNumberNumber()
  opSubNumberNumber()
  opDivNumberNumber()
  opModNumberNumber()
  opAdd()
  opAnd()
  opOr()
  opColorColor()
  opColorNumber()
  opNumberColor()
  opEq()
  opNeq()
  opEqNumberNumber()
  opNeqNumberNumber()
  opGteNumberNumber()
  opGtNumberNumber()
  opLteNumberNumber()
  opLtNumberNumber()
  toBool()
  escapeNonPrintableChars()
  compileValue()
  compileDebugValue()
  flattenList()
  getStringText()
  compileStringContent()
  extractInterpolation()
  multiplySelectors()
  joinSelectors()
  multiplyMedia()
  compactEnv()
  extractEnv()
  pushEnv()
  popEnv()
  backPropagateEnv()
  getStoreEnv()
  set()
  setExisting()
  setRaw()
  get()
  has()
  injectVariables()
  replaceVariables()
  addVariables()
  setVariables()
  unsetVariable()
  getVariables()
  addParsedFile()
  getParsedFiles()
  addImportPath()
  setImportPaths()
  setNumberPrecision()
  setOutputStyle()
  setFormatter()
  setLineNumberStyle()
  setCharset()
  setSourceMap()
  setSourceMapOptions()
  registerFunction()
  unregisterFunction()
  addFeature()
  importFile()
  registerImport()
  isCssImport()
  findImport()
  resolveImportPath()
  checkImportPathConflicts()
  tryImportPathWithExtensions()
  tryImportPath()
  tryImportPathAsDirectory()
  getPrettyPath()
  setEncoding()
  setIgnoreErrors()
  getSourcePosition()
  throwError()
  error()
  addLocationToMessage()
  errorArgsNumber()
  callStackMessage()
  handleImportLoop()
  callScssFunction()
  callNativeFunction()
  getBuiltinFunction()
  normalizeNativeFunctionName()
  isNativeFunction()
  sortNativeFunctionArgs()
  parseFunctionPrototype()
  selectFunctionPrototype()
  checkPrototypeMatches()
  verifyPrototype()
  evaluateArguments()
  maybeReduce()
  applyArguments()
  applyArgumentsToDeclaration()
  coerceValue()
  tryMap()
  coerceMap()
  coerceList()
  coerceForExpression()
  coerceColor()
  compileRGBAValue()
  compileColorPartValue()
  coerceString()
  assertString()
  coercePercent()
  assertMap()
  assertList()
  getArgumentListKeywords()
  assertColor()
  assertNumber()
  assertInteger()
  extractSlashAlphaInColorFunction()
  fixColor()
  toHSL()
  hueToRGB()
  toRGB()
  HWBtoRGB()
  RGBtoHWB()
  libCall()
  libGetFunction()
  libIf()
  libIndex()
  libRgb()
  libRgba()
  alterColor()
  libAdjustColor()
  libChangeColor()
  libScaleColor()
  libIeHexStr()
  libRed()
  libGreen()
  libBlue()
  libAlpha()
  libOpacity()
  libMix()
  libHsl()
  libHsla()
  libHue()
  libSaturation()
  libLightness()
  adjustHsl()
  libAdjustHue()
  libLighten()
  libDarken()
  libSaturate()
  libDesaturate()
  libGrayscale()
  libComplement()
  libInvert()
  libOpacify()
  libFadeIn()
  libTransparentize()
  libFadeOut()
  libUnquote()
  libQuote()
  libPercentage()
  libRound()
  libFloor()
  libCeil()
  libAbs()
  libMin()
  libMax()
  libLength()
  libListSeparator()
  libNth()
  libSetNth()
  libMapGet()
  mapGet()
  mapGetEntryIndex()
  libMapKeys()
  libMapValues()
  libMapRemove()
  libMapHasKey()
  mapHasKey()
  libMapMerge()
  modifyMap()
  modifyNestedMap()
  mergeMaps()
  libKeywords()
  libIsBracketed()
  listSeparatorForJoin()
  libJoin()
  libAppend()
  libZip()
  libTypeOf()
  getTypeOf()
  libUnit()
  libUnitless()
  libComparable()
  libStrIndex()
  libStrInsert()
  libStrLength()
  libStrSlice()
  libToLowerCase()
  libToUpperCase()
  stringTransformAsciiOnly()
  libFeatureExists()
  libFunctionExists()
  libGlobalVariableExists()
  libMixinExists()
  libVariableExists()
  libCounter()
  libRandom()
  libUniqueId()
  inspectFormatValue()
  libInspect()
  getSelectorArg()
  checkSelectorArgType()
  formatOutputSelector()
  libIsSuperselector()
  isSuperSelector()
  isSuperPart()
  libSelectorAppend()
  selectorAppend()
  libSelectorExtend()
  libSelectorReplace()
  extendOrReplaceSelectors()
  libSelectorNest()
  libSelectorParse()
  libSelectorUnify()
  unifyCompoundSelectors()
  prependSelectors()
  matchPartInCompound()
  mergeParts()
  checkCompatibleTags()
  findTagName()
  libSimpleSelectors()
  libScssphpGlob()


Class: Compiler  - X-Ref

SCSS compiler

__construct($cacheOptions = null)   X-Ref
Constructor

param: array|null $cacheOptions

getCompileOptions()   X-Ref
Get compiler options

return: array<string, mixed>

setLogger(LoggerInterface $logger)   X-Ref
Sets an alternative logger.

Changing the logger in the middle of the compilation is not
supported and will result in an undefined behavior.

param: LoggerInterface $logger
return: void

setErrorOuput($handle)   X-Ref
Set an alternative error output stream, for testing purpose only

param: resource $handle
return: void

compile($code, $path = null)   X-Ref
Compile scss

param: string      $code
param: string|null $path
return: string

compileString($source, $path = null)   X-Ref
Compile scss

param: string      $source
param: string|null $path
return: CompilationResult

isFreshCachedResult(CachedResult $result)   X-Ref

param: CachedResult $result
return: bool

parserFactory($path)   X-Ref
Instantiate parser

param: string|null $path
return: \ScssPhp\ScssPhp\Parser

isSelfExtend($target, $origin)   X-Ref
Is self extend?

param: array $target
param: array $origin
return: bool

pushExtends($target, $origin, $block)   X-Ref
Push extends

param: string[]   $target
param: array      $origin
param: array|null $block
return: void

makeOutputBlock($type, $selectors = null)   X-Ref
Make output block

param: string|null   $type
param: string[]|null $selectors
return: \ScssPhp\ScssPhp\Formatter\OutputBlock

compileRoot(Block $rootBlock)   X-Ref
Compile root

param: \ScssPhp\ScssPhp\Block $rootBlock
return: void

missingSelectors()   X-Ref
Report missing selectors

return: void

flattenSelectors(OutputBlock $block, $parentKey = null)   X-Ref
Flatten selectors

param: \ScssPhp\ScssPhp\Formatter\OutputBlock $block
param: string                                 $parentKey
return: void

glueFunctionSelectors($parts)   X-Ref
Glue parts of :not( or :nth-child( ... that are in general split in selectors parts

param: array $parts
return: array

matchExtends($selector, &$out, $from = 0, $initial = true)   X-Ref
Match extends

param: array $selector
param: array $out
param: int   $from
param: bool  $initial
return: void

isPseudoSelector($part, &$matches)   X-Ref
Test a part for being a pseudo selector

param: string $part
param: array  $matches
return: bool

pushOrMergeExtentedSelector(&$out, $extended)   X-Ref
Push extended selector except if
- this is a pseudo selector
- same as previous
- in a white list
in this case we merge the pseudo selector content

param: array $out
param: array $extended
return: void

matchExtendsSingle($rawSingle, &$outOrigin, $initial = true)   X-Ref
Match extends single

param: array $rawSingle
param: array $outOrigin
param: bool  $initial
return: bool

extractRelationshipFromFragment(array $fragment)   X-Ref
Extract a relationship from the fragment.

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.

param: array $fragment The selector fragment maybe ending with a direction relationship combinator.
return: array The selector without the relationship fragment if any, the relationship fragment.

combineSelectorSingle($base, $other)   X-Ref
Combine selector single

param: array $base
param: array $other
return: array

compileMedia(Block $media)   X-Ref
Compile media

param: \ScssPhp\ScssPhp\Block $media
return: void

mediaParent(OutputBlock $scope)   X-Ref
Media parent

param: \ScssPhp\ScssPhp\Formatter\OutputBlock $scope
return: \ScssPhp\ScssPhp\Formatter\OutputBlock

compileDirective($directive, OutputBlock $out)   X-Ref
Compile directive

param: DirectiveBlock|array                   $directive
param: \ScssPhp\ScssPhp\Formatter\OutputBlock $out
return: void

compileDirectiveName($directiveName)   X-Ref
directive names can include some interpolation

param: string|array $directiveName
return: string

compileAtRoot(Block $block)   X-Ref
Compile at-root

param: \ScssPhp\ScssPhp\Block $block
return: void

filterScopeWithWithout($scope, $with, $without)   X-Ref
Filter at-root scope depending on with/without option

param: \ScssPhp\ScssPhp\Formatter\OutputBlock $scope
param: array                                  $with
param: array                                  $without
return: OutputBlock

completeScope($scope, $previousScope)   X-Ref
found missing selector from a at-root compilation in the previous scope
(if at-root is just enclosing a property, the selector is in the parent tree)

param: \ScssPhp\ScssPhp\Formatter\OutputBlock $scope
param: \ScssPhp\ScssPhp\Formatter\OutputBlock $previousScope
return: OutputBlock

findScopeSelectors($scope, $depth)   X-Ref
Find a selector by the depth node in the scope

param: \ScssPhp\ScssPhp\Formatter\OutputBlock $scope
param: int                                    $depth
return: array

compileWith($withCondition)   X-Ref
Compile @at-root's with: inclusion / without: exclusion into 2 lists uses to filter scope/env later

param: array|null $withCondition
return: array

filterWithWithout($envs, $with, $without)   X-Ref
Filter env stack

param: Environment[] $envs
param: array $with
param: array $without
return: Environment

isWith($block, $with, $without)   X-Ref
Filter WITH rules

param: \ScssPhp\ScssPhp\Block|\ScssPhp\ScssPhp\Formatter\OutputBlock $block
param: array                                                         $with
param: array                                                         $without
return: bool

testWithWithout($what, $with, $without)   X-Ref
Test a single type of block against with/without lists

param: string $what
param: array  $with
param: array  $without
return: bool

compileKeyframeBlock(Block $block, $selectors)   X-Ref
Compile keyframe block

param: \ScssPhp\ScssPhp\Block $block
param: string[]               $selectors
return: void

compileNestedPropertiesBlock(Block $block, OutputBlock $out)   X-Ref
Compile nested properties lines

param: \ScssPhp\ScssPhp\Block                 $block
param: \ScssPhp\ScssPhp\Formatter\OutputBlock $out
return: void

compileNestedBlock(Block $block, $selectors)   X-Ref
Compile nested block

param: \ScssPhp\ScssPhp\Block $block
param: string[]               $selectors
return: void

compileBlock(Block $block)   X-Ref
Recursively compiles a block.

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.

param: \ScssPhp\ScssPhp\Block $block
return: void

compileCommentValue($value, $pushEnv = false)   X-Ref
Compile the value of a comment that can have interpolation

param: array $value
param: bool  $pushEnv
return: string

compileComment($block)   X-Ref
Compile root level comment

param: array $block
return: void

evalSelectors($selectors)   X-Ref
Evaluate selectors

param: array $selectors
return: array

evalSelector($selector)   X-Ref
Evaluate selector

param: array $selector
return: array

evalSelectorPart($part)   X-Ref
Evaluate selector part; replaces all the interpolates, stripping quotes

param: array $part
return: array

collapseSelectors($selectors)   X-Ref
Collapse selectors

param: array $selectors
return: string

collapseSelectorsAsList($selectors)   X-Ref
No description

replaceSelfSelector($selectors, $replace = null)   X-Ref
No description

flattenSelectorSingle($single)   X-Ref
Flatten selector single; joins together .classes and #ids

param: array $single
return: array

compileSelector($selector)   X-Ref
Compile selector to string; self(&) should have been replaced by now

param: string|array $selector
return: string

compileSelectorPart($piece)   X-Ref
Compile selector part

param: array $piece
return: string

hasSelectorPlaceholder($selector)   X-Ref
Has selector placeholder?

param: array $selector
return: bool

pushCallStack($name = '')   X-Ref

param: string $name
return: void

popCallStack()   X-Ref

return: void

compileChildren($stms, OutputBlock $out, $traceName = '')   X-Ref
Compile children and return result

param: array                                  $stms
param: \ScssPhp\ScssPhp\Formatter\OutputBlock $out
param: string                                 $traceName
return: array|Number|null

compileChildrenNoReturn($stms, OutputBlock $out, $selfParent = null, $traceName = '')   X-Ref
Compile children and throw exception if unexpected at-return

param: array[]                                $stms
param: \ScssPhp\ScssPhp\Formatter\OutputBlock $out
param: \ScssPhp\ScssPhp\Block                 $selfParent
param: string                                 $traceName
return: void

evaluateMediaQuery($queryList)   X-Ref
evaluate media query : compile internal value keeping the structure unchanged

param: array $queryList
return: array

compileMediaQuery($queryList)   X-Ref
Compile media query

param: array $queryList
return: string[]

mergeDirectRelationships($selectors1, $selectors2)   X-Ref
Merge direct relationships between selectors

param: array $selectors1
param: array $selectors2
return: array

mergeMediaTypes($type1, $type2)   X-Ref
Merge media types

param: array $type1
param: array $type2
return: array|null

compileImport($rawPath, OutputBlock $out, $once = false)   X-Ref
Compile import; returns true if the value was something that could be imported

param: array                                  $rawPath
param: \ScssPhp\ScssPhp\Formatter\OutputBlock $out
param: bool                                   $once
return: bool

compileImportPath($rawPath)   X-Ref

param: array $rawPath
return: string

escapeImportPathString($path)   X-Ref

param: array $path
return: array

appendRootDirective($line, $out, $allowed = [Type::T_COMMENT])   X-Ref
Append a root directive like @import or @charset as near as the possible from the source code
(keeping before comments, @import and @charset coming before in the source code)

param: string                                 $line
param: \ScssPhp\ScssPhp\Formatter\OutputBlock $out
param: array                                  $allowed
return: void

appendOutputLine(OutputBlock $out, $type, $line)   X-Ref
Append lines to the current output block:
directly to the block or through a child if necessary

param: \ScssPhp\ScssPhp\Formatter\OutputBlock $out
param: string                                 $type
param: string                                 $line
return: void

compileChild($child, OutputBlock $out)   X-Ref
Compile child; returns a value to halt execution

param: array                                  $child
param: \ScssPhp\ScssPhp\Formatter\OutputBlock $out
return: array|Number|null

expToString($exp, $keepParens = false)   X-Ref
Reduce expression to string

param: array $exp
param: bool $keepParens
return: array

isTruthy($value)   X-Ref
Is truthy?

param: array|Number $value
return: bool

isImmediateRelationshipCombinator($value)   X-Ref
Is the value a direct relationship combinator?

param: string $value
return: bool

shouldEval($value)   X-Ref
Should $value cause its operand to eval

param: array $value
return: bool

reduce($value, $inExp = false)   X-Ref
Reduce value

param: array|Number $value
param: bool         $inExp
return: array|Number

fncall($functionReference, $argValues)   X-Ref
Function caller

param: string|array $functionReference
param: array        $argValues
return: array|Number

cssValidArg($arg, $allowed_function = [], $inFunction = false)   X-Ref

param: array|Number $arg
param: string[]     $allowed_function
param: bool         $inFunction
return: array|Number|false

stringifyFncallArgs($arg)   X-Ref
Reformat fncall arguments to proper css function output

param: array|Number $arg
return: array|Number

getFunctionReference($name, $safeCopy = false)   X-Ref
Find a function reference

param: string $name
param: bool $safeCopy
return: array

normalizeName($name)   X-Ref
Normalize name

param: string $name
return: string

normalizeValue($value)   X-Ref
Normalize value

param: array|Number $value
return: array|Number

opAddNumberNumber(Number $left, Number $right)   X-Ref
Add numbers

param: Number $left
param: Number $right
return: Number

opMulNumberNumber(Number $left, Number $right)   X-Ref
Multiply numbers

param: Number $left
param: Number $right
return: Number

opSubNumberNumber(Number $left, Number $right)   X-Ref
Subtract numbers

param: Number $left
param: Number $right
return: Number

opDivNumberNumber(Number $left, Number $right)   X-Ref
Divide numbers

param: Number $left
param: Number $right
return: Number

opModNumberNumber(Number $left, Number $right)   X-Ref
Mod numbers

param: Number $left
param: Number $right
return: Number

opAdd($left, $right)   X-Ref
Add strings

param: array $left
param: array $right
return: array|null

opAnd($left, $right, $shouldEval)   X-Ref
Boolean and

param: array|Number $left
param: array|Number $right
param: bool         $shouldEval
return: array|Number|null

opOr($left, $right, $shouldEval)   X-Ref
Boolean or

param: array|Number $left
param: array|Number $right
param: bool         $shouldEval
return: array|Number|null

opColorColor($op, $left, $right)   X-Ref
Compare colors

param: string $op
param: array  $left
param: array  $right
return: array

opColorNumber($op, $left, Number $right)   X-Ref
Compare color and number

param: string $op
param: array  $left
param: Number  $right
return: array

opNumberColor($op, Number $left, $right)   X-Ref
Compare number and color

param: string $op
param: Number  $left
param: array  $right
return: array

opEq($left, $right)   X-Ref
Compare number1 == number2

param: array|Number $left
param: array|Number $right
return: array

opNeq($left, $right)   X-Ref
Compare number1 != number2

param: array|Number $left
param: array|Number $right
return: array

opEqNumberNumber(Number $left, Number $right)   X-Ref
Compare number1 == number2

param: Number $left
param: Number $right
return: array

opNeqNumberNumber(Number $left, Number $right)   X-Ref
Compare number1 != number2

param: Number $left
param: Number $right
return: array

opGteNumberNumber(Number $left, Number $right)   X-Ref
Compare number1 >= number2

param: Number $left
param: Number $right
return: array

opGtNumberNumber(Number $left, Number $right)   X-Ref
Compare number1 > number2

param: Number $left
param: Number $right
return: array

opLteNumberNumber(Number $left, Number $right)   X-Ref
Compare number1 <= number2

param: Number $left
param: Number $right
return: array

opLtNumberNumber(Number $left, Number $right)   X-Ref
Compare number1 < number2

param: Number $left
param: Number $right
return: array

toBool($thing)   X-Ref
Cast to boolean

param: bool $thing
return: array

escapeNonPrintableChars($string, $inKeyword = false)   X-Ref
Escape non printable chars in strings output as in dart-sass

param: string $string
param: bool   $inKeyword
return: string

compileValue($value, $quote = true)   X-Ref
Compiles a primitive value into a CSS property value.

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.

param: array|Number $value
param: bool         $quote
return: string

compileDebugValue($value)   X-Ref

param: array|Number $value
return: string

flattenList($list)   X-Ref
Flatten list

param: array $list
return: string

getStringText(array $value)   X-Ref
Gets the text of a Sass string

Calling this method on anything else than a SassString is unsupported. Use {@see assertString} first
to ensure that the value is indeed a string.

param: array $value
return: string

compileStringContent($string, $quote = true)   X-Ref
Compile string content

param: array $string
param: bool  $quote
return: string

extractInterpolation($list)   X-Ref
Extract interpolation; it doesn't need to be recursive, compileValue will handle that

param: array $list
return: array

multiplySelectors(Environment $env, $selfParent = null)   X-Ref
Find the final set of selectors

param: \ScssPhp\ScssPhp\Compiler\Environment $env
param: \ScssPhp\ScssPhp\Block                $selfParent
return: array

joinSelectors($parent, $child, &$stillHasSelf, $selfParentSelectors = null)   X-Ref
Join selectors; looks for & to replace, or append parent before child

param: array $parent
param: array $child
param: bool  $stillHasSelf
param: array $selfParentSelectors
return: array

multiplyMedia(Environment $env = null, $childQueries = null)   X-Ref
Multiply media

param: \ScssPhp\ScssPhp\Compiler\Environment $env
param: array                                 $childQueries
return: array

compactEnv(Environment $env)   X-Ref
Convert env linked list to stack

param: Environment $env
return: Environment[]

extractEnv($envs)   X-Ref
Convert env stack to singly linked list

param: Environment[] $envs
return: Environment

pushEnv(Block $block = null)   X-Ref
Push environment

param: \ScssPhp\ScssPhp\Block $block
return: \ScssPhp\ScssPhp\Compiler\Environment

popEnv()   X-Ref
Pop environment

return: void

backPropagateEnv($store, $excludedVars = null)   X-Ref
Propagate vars from a just poped Env (used in @each and @for)

param: array         $store
param: null|string[] $excludedVars
return: void

getStoreEnv()   X-Ref
Get store environment

return: \ScssPhp\ScssPhp\Compiler\Environment

set($name, $value, $shadow = false, Environment $env = null, $valueUnreduced = null)   X-Ref
Set variable

param: string                                $name
param: mixed                                 $value
param: bool                                  $shadow
param: \ScssPhp\ScssPhp\Compiler\Environment $env
param: mixed                                 $valueUnreduced
return: void

setExisting($name, $value, Environment $env, $valueUnreduced = null)   X-Ref
Set existing variable

param: string                                $name
param: mixed                                 $value
param: \ScssPhp\ScssPhp\Compiler\Environment $env
param: mixed                                 $valueUnreduced
return: void

setRaw($name, $value, Environment $env, $valueUnreduced = null)   X-Ref
Set raw variable

param: string                                $name
param: mixed                                 $value
param: \ScssPhp\ScssPhp\Compiler\Environment $env
param: mixed                                 $valueUnreduced
return: void

get($name, $shouldThrow = true, Environment $env = null, $unreduced = false)   X-Ref
Get variable

param: string                                $name
param: bool                                  $shouldThrow
param: \ScssPhp\ScssPhp\Compiler\Environment $env
param: bool                                  $unreduced
return: mixed|null

has($name, Environment $env = null)   X-Ref
Has variable?

param: string                                $name
param: \ScssPhp\ScssPhp\Compiler\Environment $env
return: bool

injectVariables(array $args)   X-Ref
Inject variables

param: array $args
return: void

replaceVariables(array $variables)   X-Ref
Replaces variables.

param: array<string, mixed> $variables
return: void

addVariables(array $variables)   X-Ref
Replaces variables.

param: array<string, mixed> $variables
return: void

setVariables(array $variables)   X-Ref
Set variables

param: array $variables
return: void

unsetVariable($name)   X-Ref
Unset variable

param: string $name
return: void

getVariables()   X-Ref
Returns list of variables

return: array

addParsedFile($path)   X-Ref
Adds to list of parsed files

param: string|null $path
return: void

getParsedFiles()   X-Ref
Returns list of parsed files

return: array<string, int>

addImportPath($path)   X-Ref
Add import path

param: string|callable $path
return: void

setImportPaths($path)   X-Ref
Set import paths

param: string|array<string|callable> $path
return: void

setNumberPrecision($numberPrecision)   X-Ref
Set number precision

param: int $numberPrecision
return: void

setOutputStyle($style)   X-Ref
Sets the output style.

param: string $style One of the OutputStyle constants
return: void

setFormatter($formatterName)   X-Ref
Set formatter

param: string $formatterName
return: void

setLineNumberStyle($lineNumberStyle)   X-Ref
Set line number style

param: string $lineNumberStyle
return: void

setCharset($charset)   X-Ref
Configures the handling of non-ASCII outputs.

If $charset is `true`, this will include a `@charset` declaration or a
UTF-8 [byte-order mark][] if the stylesheet contains any non-ASCII
characters. Otherwise, it will never include a `@charset` declaration or a
byte-order mark.

[byte-order mark]: https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8

param: bool $charset
return: void

setSourceMap($sourceMap)   X-Ref
Enable/disable source maps

param: int $sourceMap
return: void

setSourceMapOptions($sourceMapOptions)   X-Ref
Set source map options

param: array $sourceMapOptions
return: void

registerFunction($name, $callback, $argumentDeclaration = null)   X-Ref
Register function

param: string        $name
param: callable      $callback
param: string[]|null $argumentDeclaration
return: void

unregisterFunction($name)   X-Ref
Unregister function

param: string $name
return: void

addFeature($name)   X-Ref
Add feature

param: string $name
return: void

importFile($path, OutputBlock $out)   X-Ref
Import file

param: string                                 $path
param: \ScssPhp\ScssPhp\Formatter\OutputBlock $out
return: void

registerImport($currentDirectory, $path, $filePath)   X-Ref
Save the imported files with their resolving path context

param: string|null $currentDirectory
param: string      $path
param: string      $filePath
return: void

isCssImport($url)   X-Ref
Detects whether the import is a CSS import.

For legacy reasons, custom importers are called for those, allowing them
to replace them with an actual Sass import. However this behavior is
deprecated. Custom importers are expected to return null when they receive
a CSS import.

param: string $url
return: bool

findImport($url, $currentDir = null)   X-Ref
Return the file path for an import url if it exists

param: string      $url
param: string|null $currentDir
return: string|null

resolveImportPath($url, $baseDir)   X-Ref

param: string $url
param: string $baseDir
return: string|null

checkImportPathConflicts(array $paths)   X-Ref

param: string[] $paths
return: string|null

tryImportPathWithExtensions($path)   X-Ref

param: string $path
return: string[]

tryImportPath($path)   X-Ref

param: string $path
return: string[]

tryImportPathAsDirectory($path)   X-Ref

param: string $path
return: string|null

getPrettyPath($path)   X-Ref

param: string|null $path
return: string

setEncoding($encoding)   X-Ref
Set encoding

param: string|null $encoding
return: void

setIgnoreErrors($ignoreErrors)   X-Ref
Ignore errors?

param: bool $ignoreErrors
return: \ScssPhp\ScssPhp\Compiler

getSourcePosition()   X-Ref
Get source position

return: array

throwError($msg)   X-Ref
Throw error (exception)

param: string $msg Message with optional sprintf()-style vararg parameters
return: never

error($msg, ...$args)   X-Ref
Build an error (exception)

param: string                     $msg Message with optional sprintf()-style vararg parameters
param: bool|float|int|string|null ...$args
return: CompilerException

addLocationToMessage($msg)   X-Ref

param: string $msg
return: string

errorArgsNumber($functionName, $ExpectedArgs, $nbActual)   X-Ref

param: string $functionName
param: array $ExpectedArgs
param: int $nbActual
return: CompilerException

callStackMessage($all = false, $limit = null)   X-Ref
Beautify call stack for output

param: bool     $all
param: int|null $limit
return: string

handleImportLoop($name)   X-Ref
Handle import loop

param: string $name
return: void

callScssFunction($func, $argValues)   X-Ref
Call SCSS @function

param: CallableBlock|null $func
param: array              $argValues
return: array|Number

callNativeFunction($name, $function, $prototype, $args)   X-Ref
Call built-in and registered (PHP) functions

param: string $name
param: callable $function
param: array  $prototype
param: array  $args
return: array|Number|null

getBuiltinFunction($name)   X-Ref
Get built-in function

param: string $name Normalized name
return: array

normalizeNativeFunctionName($name)   X-Ref
Normalize native function name

param: string $name
return: string

isNativeFunction($name)   X-Ref
No description

sortNativeFunctionArgs($functionName, $prototypes, $args)   X-Ref
Sorts keyword arguments

param: string $functionName
param: array|null  $prototypes
param: array  $args
return: array|null

parseFunctionPrototype(array $prototype)   X-Ref
Parses a function prototype to the internal representation of arguments.

The input is an array of strings describing each argument, as supported
in {@see registerFunction}. Argument names don't include the `$`.
The output contains the list of positional argument, with their normalized
name (underscores are replaced by dashes), their original name (to be used
in case of error reporting) and their default value. The output also contains
the normalized name of the rest argument, or null if the function prototype
is not variadic.

param: string[] $prototype
return: array

selectFunctionPrototype(array $prototypes, $positional, array $names)   X-Ref
Returns the function prototype for the given positional and named arguments.

If no exact match is found, finds the closest approximation. Note that this
doesn't guarantee that $positional and $names are valid for the returned
prototype.

param: array[]               $prototypes
param: int                   $positional
param: array<string, string> $names A set of names, as both keys and values
return: array

checkPrototypeMatches(array $prototype, $positional, array $names)   X-Ref
Checks whether the argument invocation matches the callable prototype.

The rules are similar to {@see verifyPrototype}. The boolean return value
avoids the overhead of building and catching exceptions when the reason of
not matching the prototype does not need to be known.

param: array                 $prototype
param: int                   $positional
param: array<string, string> $names
return: bool

verifyPrototype(array $prototype, $positional, array $names, $hasSplat)   X-Ref
Verifies that the argument invocation is valid for the callable prototype.

param: array                 $prototype
param: int                   $positional
param: array<string, string> $names
param: bool                  $hasSplat
return: void

evaluateArguments(array $args, $reduce = true)   X-Ref
Evaluates the argument from the invocation.

This returns several things about this invocation:
- the list of positional arguments
- the map of named arguments, indexed by normalized names
- the set of names used in the arguments (that's an array using the normalized names as keys for O(1) access)
- the separator used by the list using the splat operator, if any
- a boolean indicator whether any splat argument (list or map) was used, to support the incomplete error reporting.

param: array[] $args
param: bool    $reduce Whether arguments should be reduced to their value
return: array

maybeReduce($reduce, $value)   X-Ref

param: bool         $reduce
param: array|Number $value
return: array|Number

applyArguments($argDef, $argValues, $storeInEnv = true, $reduce = true)   X-Ref
Apply argument values per definition

param: array[]    $argDef
param: array|null $argValues
param: bool       $storeInEnv
param: bool       $reduce     only used if $storeInEnv = false
return: array<string, array|Number>

applyArgumentsToDeclaration(array $prototype, array $positionalArgs, array $namedArgs, $splatSeparator)   X-Ref
Apply argument values per definition.

This method assumes that the arguments are valid for the provided prototype.
The validation with {@see verifyPrototype} must have been run before calling
it.
Arguments are returned as a map from the normalized argument names to the
value. Additional arguments are collected in a sass argument list available
under the name of the rest argument in the result.

Defaults are not applied as they are resolved in a different environment.

param: array                       $prototype
param: array<array|Number>         $positionalArgs
param: array<string, array|Number> $namedArgs
param: string|null                 $splatSeparator
return: array<string, array|Number>

coerceValue($value)   X-Ref
Coerce a php value into a scss one

param: mixed $value
return: array|Number

tryMap($item)   X-Ref
Tries to convert an item to a Sass map

param: Number|array $item
return: array|null

coerceMap($item)   X-Ref
Coerce something to map

param: array|Number $item
return: array|Number

coerceList($item, $delim = ',', $removeTrailingNull = false)   X-Ref
Coerce something to list

param: array|Number $item
param: string       $delim
param: bool         $removeTrailingNull
return: array

coerceForExpression($value)   X-Ref
Coerce color for expression

param: array|Number $value
return: array|Number

coerceColor($value, $inRGBFunction = false)   X-Ref
Coerce value to color

param: array|Number $value
param: bool         $inRGBFunction
return: array|null

compileRGBAValue($value, $isAlpha = false)   X-Ref

param: int|Number $value
param: bool       $isAlpha
return: int|mixed

compileColorPartValue($value, $min, $max, $isInt = true)   X-Ref

param: mixed     $value
param: int|float $min
param: int|float $max
param: bool      $isInt
return: int|mixed

coerceString($value)   X-Ref
Coerce value to string

param: array|Number $value
return: array

assertString($value, $varName = null)   X-Ref
Assert value is a string

This method deals with internal implementation details of the value
representation where unquoted strings can sometimes be stored under
other types.
The returned value is always using the T_STRING type.

param: array|Number $value
param: string|null  $varName
return: array

coercePercent($value)   X-Ref
Coerce value to a percentage

param: array|Number $value
return: int|float

assertMap($value, $varName = null)   X-Ref
Assert value is a map

param: array|Number $value
param: string|null  $varName
return: array

assertList($value)   X-Ref
Assert value is a list

param: array|Number $value
return: array

getArgumentListKeywords($value)   X-Ref
Gets the keywords of an argument list.

Keys in the returned array are normalized names (underscores are replaced with dashes)
without the leading `$`.
Calling this helper with anything that an argument list received for a rest argument
of the function argument declaration is not supported.

param: array|Number $value
return: array<string, array|Number>

assertColor($value, $varName = null)   X-Ref
Assert value is a color

param: array|Number $value
param: string|null  $varName
return: array

assertNumber($value, $varName = null)   X-Ref
Assert value is a number

param: array|Number $value
param: string|null  $varName
return: Number

assertInteger($value, $varName = null)   X-Ref
Assert value is a integer

param: array|Number $value
param: string|null  $varName
return: int

extractSlashAlphaInColorFunction($args)   X-Ref
Extract the  ... / alpha on the last argument of channel arg
in color functions

param: array $args
return: array

fixColor($c)   X-Ref
Make sure a color's components don't go out of bounds

param: array $c
return: array

toHSL($red, $green, $blue)   X-Ref
Convert RGB to HSL

param: int $red
param: int $green
param: int $blue
return: array

hueToRGB($m1, $m2, $h)   X-Ref
Hue to RGB helper

param: float $m1
param: float $m2
param: float $h
return: float

toRGB($hue, $saturation, $lightness)   X-Ref
Convert HSL to RGB

param: int|float $hue        H from 0 to 360
param: int|float $saturation S from 0 to 100
param: int|float $lightness  L from 0 to 100
return: array

HWBtoRGB($hue, $whiteness, $blackness)   X-Ref
Convert HWB to RGB
https://www.w3.org/TR/css-color-4/#hwb-to-rgb

param: int|float $hue        H from 0 to 360
param: int|float $whiteness  W from 0 to 100
param: int|float $blackness  B from 0 to 100
return: array

RGBtoHWB($red, $green, $blue)   X-Ref
Convert RGB to HWB

param: int $red
param: int $green
param: int $blue
return: array

libCall($args)   X-Ref
No description

libGetFunction($args)   X-Ref
No description

libIf($args)   X-Ref
No description

libIndex($args)   X-Ref
No description

libRgb($args, $kwargs, $funcName = 'rgb')   X-Ref

param: array $args
param: array $kwargs
param: string $funcName
return: array

libRgba($args, $kwargs)   X-Ref
No description

alterColor(array $args, $operation, $fn)   X-Ref
Helper function for adjust_color, change_color, and scale_color

param: array<array|Number> $args
param: string $operation
param: callable $fn
return: array

libAdjustColor($args)   X-Ref
No description

libChangeColor($args)   X-Ref
No description

libScaleColor($args)   X-Ref
No description

libIeHexStr($args)   X-Ref
No description

libRed($args)   X-Ref
No description

libGreen($args)   X-Ref
No description

libBlue($args)   X-Ref
No description

libAlpha($args)   X-Ref
No description

libOpacity($args)   X-Ref
No description

libMix($args)   X-Ref
No description

libHsl($args, $kwargs, $funcName = 'hsl')   X-Ref

param: array $args
param: array $kwargs
param: string $funcName
return: array|null

libHsla($args, $kwargs)   X-Ref
No description

libHue($args)   X-Ref
No description

libSaturation($args)   X-Ref
No description

libLightness($args)   X-Ref
No description

adjustHsl($color, $idx, $amount)   X-Ref

param: array     $color
param: int       $idx
param: int|float $amount
return: array

libAdjustHue($args)   X-Ref
No description

libLighten($args)   X-Ref
No description

libDarken($args)   X-Ref
No description

libSaturate($args)   X-Ref
No description

libDesaturate($args)   X-Ref
No description

libGrayscale($args)   X-Ref
No description

libComplement($args)   X-Ref
No description

libInvert($args)   X-Ref
No description

libOpacify($args)   X-Ref
No description

libFadeIn($args)   X-Ref
No description

libTransparentize($args)   X-Ref
No description

libFadeOut($args)   X-Ref
No description

libUnquote($args)   X-Ref
No description

libQuote($args)   X-Ref
No description

libPercentage($args)   X-Ref
No description

libRound($args)   X-Ref
No description

libFloor($args)   X-Ref
No description

libCeil($args)   X-Ref
No description

libAbs($args)   X-Ref
No description

libMin($args)   X-Ref
No description

libMax($args)   X-Ref


libLength($args)   X-Ref


libListSeparator($args)   X-Ref
No description

libNth($args)   X-Ref
No description

libSetNth($args)   X-Ref
No description

libMapGet($args)   X-Ref
No description

mapGet(array $map, $key)   X-Ref
Gets the value corresponding to that key in the map

param: array        $map
param: Number|array $key
return: Number|array|null

mapGetEntryIndex(array $map, $key)   X-Ref
Gets the index corresponding to that key in the map entries

param: array        $map
param: Number|array $key
return: int|null

libMapKeys($args)   X-Ref
No description

libMapValues($args)   X-Ref
No description

libMapRemove($args)   X-Ref
No description

libMapHasKey($args)   X-Ref
No description

mapHasKey(array $map, $keyValue)   X-Ref

param: array|Number $keyValue
return: bool

libMapMerge($args)   X-Ref
No description

modifyMap(array $map, array $keys, callable $modify, $addNesting = true)   X-Ref

param: array    $map
param: array    $keys
param: callable $modify
param: bool     $addNesting
return: Number|array

modifyNestedMap(array $map, array $keys, callable $modify, $addNesting)   X-Ref

param: array    $map
param: array    $keys
param: callable $modify
param: bool     $addNesting
return: array

mergeMaps(array $map1, array $map2)   X-Ref
Merges 2 Sass maps together

param: array $map1
param: array $map2
return: array

libKeywords($args)   X-Ref
No description

libIsBracketed($args)   X-Ref
No description

listSeparatorForJoin($list1, $sep)   X-Ref

param: array $list1
param: array|Number|null $sep
return: string

libJoin($args)   X-Ref
No description

libAppend($args)   X-Ref
No description

libZip($args)   X-Ref
No description

libTypeOf($args)   X-Ref
No description

getTypeOf($value)   X-Ref

param: array|Number $value
return: string

libUnit($args)   X-Ref
No description

libUnitless($args)   X-Ref
No description

libComparable($args)   X-Ref
No description

libStrIndex($args)   X-Ref
No description

libStrInsert($args)   X-Ref
No description

libStrLength($args)   X-Ref
No description

libStrSlice($args)   X-Ref
No description

libToLowerCase($args)   X-Ref
No description

libToUpperCase($args)   X-Ref
No description

stringTransformAsciiOnly($stringContent, $filter)   X-Ref
Apply a filter on a string content, only on ascii chars
let extended chars untouched

param: string $stringContent
param: callable $filter
return: string

libFeatureExists($args)   X-Ref
No description

libFunctionExists($args)   X-Ref
No description

libGlobalVariableExists($args)   X-Ref
No description

libMixinExists($args)   X-Ref
No description

libVariableExists($args)   X-Ref
No description

libCounter($args)   X-Ref
Workaround IE7's content counter bug.

param: array $args
return: array

libRandom($args)   X-Ref
No description

libUniqueId()   X-Ref
No description

inspectFormatValue($value, $force_enclosing_display = false)   X-Ref

param: array|Number $value
param: bool         $force_enclosing_display
return: array

libInspect($args)   X-Ref
No description

getSelectorArg($arg, $varname = null, $allowParent = false)   X-Ref
Preprocess selector args

param: array       $arg
param: string|null $varname
param: bool        $allowParent
return: array

checkSelectorArgType($arg, $maxDepth = 2)   X-Ref
Check variable type for getSelectorArg() function

param: array $arg
param: int $maxDepth
return: bool

formatOutputSelector($selectors)   X-Ref
Postprocess selector to output in right format

param: array $selectors
return: array

libIsSuperselector($args)   X-Ref
No description

isSuperSelector($super, $sub)   X-Ref
Test a $super selector again $sub

param: array $super
param: array $sub
return: bool

isSuperPart($superParts, $subParts)   X-Ref
No description

libSelectorAppend($args)   X-Ref
No description

selectorAppend($selectors)   X-Ref
Append parts of the last selector in the list to the previous, recursively

param: array $selectors
return: array

libSelectorExtend($args)   X-Ref
No description

libSelectorReplace($args)   X-Ref
No description

extendOrReplaceSelectors($selectors, $extendee, $extender, $replace = false)   X-Ref
Extend/replace in selectors
used by selector-extend and selector-replace that use the same logic

param: array $selectors
param: array $extendee
param: array $extender
param: bool  $replace
return: array

libSelectorNest($args)   X-Ref
No description

libSelectorParse($args)   X-Ref
No description

libSelectorUnify($args)   X-Ref
No description

unifyCompoundSelectors($compound1, $compound2)   X-Ref
The selector-unify magic as its best
(at least works as expected on test cases)

param: array $compound1
param: array $compound2
return: array

prependSelectors($selectors, $parts)   X-Ref
Prepend each selector from $selectors with $parts

param: array $selectors
param: array $parts
return: array

matchPartInCompound($part, $compound)   X-Ref
Try to find a matching part in a compound:
- with same html tag name
- with some class or id or something in common

param: array $part
param: array $compound
return: array|false

mergeParts($parts1, $parts2)   X-Ref
Merge two part list taking care that
- the html tag is coming first - if any
- the :something are coming last

param: array $parts1
param: array $parts2
return: array

checkCompatibleTags($tag1, $tag2)   X-Ref
Check the compatibility between two tag names:
if both are defined they should be identical or one has to be '*'

param: string $tag1
param: string $tag2
return: array|false

findTagName($parts)   X-Ref
Find the html tag name in a selector parts list

param: string[] $parts
return: string

libSimpleSelectors($args)   X-Ref
No description

libScssphpGlob($args)   X-Ref
No description