Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

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

SCSSPHP

Copyright: 2012-2020 Leaf Corcoran
License: http://opensource.org/licenses/MIT MIT
File Size: 10355 lines (311 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.

return: void
param: LoggerInterface $logger

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

return: void
param: resource $handle

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

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

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

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

isFreshCachedResult(CachedResult $result)   X-Ref

return: bool
param: CachedResult $result

parserFactory($path)   X-Ref
Instantiate parser

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

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

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

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

return: void
param: array      $target
param: array      $origin
param: array|null $block

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

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

compileRoot(Block $rootBlock)   X-Ref
Compile root

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

missingSelectors()   X-Ref
Report missing selectors

return: void

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

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

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

return: array
param: array $parts

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

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

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

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

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

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

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

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

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.

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

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

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

compileMedia(Block $media)   X-Ref
Compile media

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

mediaParent(OutputBlock $scope)   X-Ref
Media parent

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

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

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

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

return: string
param: string|array $directiveName

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

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

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

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

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)

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

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

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

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

return: array
param: array|null $withCondition

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

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

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

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

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

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

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

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

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

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

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

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

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.

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

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

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

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

return: void
param: array $block

evalSelectors($selectors)   X-Ref
Evaluate selectors

return: array
param: array $selectors

evalSelector($selector)   X-Ref
Evaluate selector

return: array
param: array $selector

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

return: array
param: array $part

collapseSelectors($selectors)   X-Ref
Collapse selectors

return: string
param: array $selectors

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

return: array
param: array $single

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

return: string
param: string|array $selector

compileSelectorPart($piece)   X-Ref
Compile selector part

return: string
param: array $piece

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

return: bool
param: array $selector

pushCallStack($name = '')   X-Ref

return: void
param: string $name

popCallStack()   X-Ref

return: void

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

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

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

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

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

return: array
param: array $queryList

compileMediaQuery($queryList)   X-Ref
Compile media query

return: string[]
param: array $queryList

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

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

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

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

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

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

compileImportPath($rawPath)   X-Ref

return: string
param: array $rawPath

escapeImportPathString($path)   X-Ref

return: array
param: array $path

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)

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

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

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

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

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

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

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

isTruthy($value)   X-Ref
Is truthy?

return: bool
param: array|Number $value

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

return: bool
param: string $value

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

return: bool
param: array $value

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

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

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

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

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

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

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

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

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

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

normalizeName($name)   X-Ref
Normalize name

return: string
param: string $name

normalizeValue($value)   X-Ref
Normalize value

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

toBool($thing)   X-Ref
Cast to boolean

return: array
param: bool $thing

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

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

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.

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

compileDebugValue($value)   X-Ref

return: string
param: array|Number $value

flattenList($list)   X-Ref
Flatten list

return: string
param: array $list

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.

return: string
param: array $value

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

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

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

return: array
param: array $list

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

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

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

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

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

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

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

return: Environment[]
param: Environment $env

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

return: Environment
param: Environment[] $envs

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

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

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)

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

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

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

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

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

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

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

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

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

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

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

injectVariables(array $args)   X-Ref
Inject variables

return: void
param: array $args

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

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

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

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

setVariables(array $variables)   X-Ref
Set variables

return: void
param: array $variables

unsetVariable($name)   X-Ref
Unset variable

return: void
param: string $name

getVariables()   X-Ref
Returns list of variables

return: array

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

return: void
param: string|null $path

getParsedFiles()   X-Ref
Returns list of parsed files

return: array<string, int>

addImportPath($path)   X-Ref
Add import path

return: void
param: string|callable $path

setImportPaths($path)   X-Ref
Set import paths

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

setNumberPrecision($numberPrecision)   X-Ref
Set number precision

return: void
param: int $numberPrecision

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

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

setFormatter($formatterName)   X-Ref
Set formatter

return: void
param: string $formatterName

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

return: void
param: string $lineNumberStyle

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

return: void
param: bool $charset

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

return: void
param: int $sourceMap

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

return: void
param: array $sourceMapOptions

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

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

unregisterFunction($name)   X-Ref
Unregister function

return: void
param: string $name

addFeature($name)   X-Ref
Add feature

return: void
param: string $name

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

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

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

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

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.

return: bool
param: string $url

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

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

resolveImportPath($url, $baseDir)   X-Ref

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

checkImportPathConflicts(array $paths)   X-Ref

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

tryImportPathWithExtensions($path)   X-Ref

return: string[]
param: string $path

tryImportPath($path)   X-Ref

return: string[]
param: string $path

tryImportPathAsDirectory($path)   X-Ref

return: string|null
param: string $path

getPrettyPath($path)   X-Ref

return: string
param: string|null $path

setEncoding($encoding)   X-Ref
Set encoding

return: void
param: string|null $encoding

setIgnoreErrors($ignoreErrors)   X-Ref
Ignore errors?

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

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

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

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

addLocationToMessage($msg)   X-Ref

return: string
param: string $msg

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

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

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

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

handleImportLoop($name)   X-Ref
Handle import loop

param: string $name

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

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

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

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

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

return: array
param: string $name Normalized name

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

return: string
param: string $name

isNativeFunction($name)   X-Ref
No description

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

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

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.

return: array
param: string[] $prototype

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.

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

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.

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

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

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

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.

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

maybeReduce($reduce, $value)   X-Ref

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

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

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

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.

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

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

return: array|Number
param: mixed $value

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

return: array
param: array|Number $value

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.

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

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

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

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

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

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

return: array
param: array|Number $value

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.

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

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

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

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

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

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

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

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

return: array
param: array $args

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

return: array
param: array $c

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

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

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

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

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

return: array
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

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

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

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

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

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
No description

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

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

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

libAdjustColor($args)   X-Ref

return: float|int|null
param: string $name
param: float|int $max
param: bool $checkPercent
param: bool $assertPercent

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
No description

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

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

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

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

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

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

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

return: bool
param: array|Number $keyValue

libMapMerge($args)   X-Ref
No description

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

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

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

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

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

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

libKeywords($args)   X-Ref
No description

libIsBracketed($args)   X-Ref
No description

listSeparatorForJoin($list1, $sep)   X-Ref

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

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

return: string
param: array|Number $value

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

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

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.

return: array
param: array $args

libRandom($args)   X-Ref
No description

libUniqueId()   X-Ref
No description

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

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

libInspect($args)   X-Ref
No description

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

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

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

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

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

return: array
param: array $selectors

libIsSuperselector($args)   X-Ref
No description

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

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

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

return: array
param: array $selectors

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

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

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)

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

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

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

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

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

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

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

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 '*'

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

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

return: string
param: string[] $parts

libSimpleSelectors($args)   X-Ref
No description

libScssphpGlob($args)   X-Ref
No description