Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
|
Moodle SCSS compiler class. More...
Public Member Functions | |
add_variables (array $variables) | |
Add variables. | |
addFeature ($name) | |
Add feature. | |
addImportPath ($path) | |
Add import path. | |
addParsedFile ($path) | |
Adds to list of parsed files. | |
addVariables (array $variables) | |
Replaces variables. | |
append_raw_scss ($scss) | |
Append raw SCSS to what's to compile. | |
assertColor ($value, $varName=null) | |
Assert value is a color. | |
assertInteger ($value, $varName=null) | |
Assert value is a integer. | |
assertList ($value) | |
Assert value is a list. | |
assertMap ($value, $varName=null) | |
Assert value is a map. | |
assertNumber ($value, $varName=null) | |
Assert value is a number. | |
assertString ($value, $varName=null) | |
Assert value is a string. | |
compile ($code, $path=null) | |
Compile scss. | |
compileString ($source, $path=null) | |
Compile scss. | |
compileValue ($value, $quote=true) | |
Compiles a primitive value into a CSS property value. | |
error ($msg,... $args) | |
Build an error (exception) | |
errorArgsNumber ($functionName, $ExpectedArgs, $nbActual) | |
escapeNonPrintableChars ($string, $inKeyword=false) | |
Escape non printable chars in strings output as in dart-sass. | |
findImport ($url, $currentDir=null) | |
Return the file path for an import url if it exists. | |
get ($name, $shouldThrow=true, Environment $env=null, $unreduced=false) | |
Get variable. | |
getArgumentListKeywords ($value) | |
Gets the keywords of an argument list. | |
getCompileOptions () | |
Get compiler options. | |
getParsedFiles () | |
Returns list of parsed files. | |
getSourcePosition () | |
Get source position. | |
getStringText (array $value) | |
Gets the text of a Sass string. | |
getVariables () | |
Returns list of variables. | |
isTruthy ($value) | |
Is truthy? | |
normalizeValue ($value) | |
Normalize value. | |
prepend_raw_scss ($scss) | |
Prepend raw SCSS to what's to compile. | |
registerFunction ($name, $callback, $argumentDeclaration=null) | |
Register function. | |
replaceVariables (array $variables) | |
Replaces variables. | |
set_file ($filepath) | |
Set the file to compile from. | |
setCharset ($charset) | |
Configures the handling of non-ASCII outputs. | |
setEncoding ($encoding) | |
Set encoding. | |
setErrorOuput ($handle) | |
Set an alternative error output stream, for testing purpose only. | |
setFormatter ($formatterName) | |
Set formatter. | |
setIgnoreErrors ($ignoreErrors) | |
Ignore errors? | |
setImportPaths ($path) | |
Set import paths. | |
setLineNumberStyle ($lineNumberStyle) | |
Set line number style. | |
setLogger (LoggerInterface $logger) | |
Sets an alternative logger. | |
setNumberPrecision ($numberPrecision) | |
Set number precision. | |
setOutputStyle ($style) | |
Sets the output style. | |
setSourceMap ($sourceMap) | |
Enable/disable source maps. | |
setSourceMapOptions ($sourceMapOptions) | |
Set source map options. | |
setVariables (array $variables) | |
Set variables. | |
throwError ($msg) | |
Throw error (exception) | |
to_css () | |
Compiles to CSS. | |
toBool ($thing) | |
Cast to boolean. | |
toHSL ($red, $green, $blue) | |
Convert RGB to HSL. | |
toRGB ($hue, $saturation, $lightness) | |
Convert HSL to RGB. | |
unregisterFunction ($name) | |
Unregister function. | |
unsetVariable ($name) | |
Unset variable. | |
Static Public Member Functions | |
static | isCssImport ($url) |
Detects whether the import is a CSS import. | |
static | isNativeFunction ($name) |
Check if a function is a native built-in scss function, for css parsing. | |
static | normalizeNativeFunctionName ($name) |
Normalize native function name. | |
Public Attributes | |
const | DEBUG_INFO = 2 |
const | LINE_COMMENTS = 1 |
const | SOURCE_MAP_FILE = 2 |
const | SOURCE_MAP_INLINE = 1 |
const | SOURCE_MAP_NONE = 0 |
const | WITH_ALL = 7 |
const | WITH_MEDIA = 2 |
const | WITH_RULE = 1 |
const | WITH_SUPPORTS = 4 |
Static Public Attributes | |
static | $defaultValue = [Type::T_KEYWORD, ''] |
static | $emptyList = [Type::T_LIST, '', []] |
static | $emptyMap = [Type::T_MAP, [], []] |
static | $emptyString = [Type::T_STRING, '"', []] |
static | $false = [Type::T_KEYWORD, 'false'] |
static | $Infinity = [Type::T_KEYWORD, 'Infinity'] |
static | $NaN = [Type::T_KEYWORD, 'NaN'] |
static | $null = [Type::T_NULL] |
static | $nullString = [Type::T_STRING, '', []] |
static | $selfSelector = [Type::T_SELF] |
static static static | $true = [Type::T_KEYWORD, 'true'] |
static | $with = [Type::T_KEYWORD, 'with'] |
static | $without = [Type::T_KEYWORD, 'without'] |
Protected Member Functions | |
adjustHsl ($color, $idx, $amount) | |
alterColor (array $args, $operation, $fn) | |
Helper function for adjust_color, change_color, and scale_color. | |
appendOutputLine (OutputBlock $out, $type, $line) | |
Append lines to the current output block: directly to the block or through a child if necessary. | |
appendRootDirective ($line, $out, $allowed=[Type::T_COMMENT]) | |
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) | |
applyArguments ($argDef, $argValues, $storeInEnv=true, $reduce=true) | |
Apply argument values per definition. | |
backPropagateEnv ($store, $excludedVars=null) | |
Propagate vars from a just poped Env (used in @each and @for) | |
callNativeFunction ($name, $function, $prototype, $args) | |
Call built-in and registered (PHP) functions. | |
callScssFunction ($func, $argValues) | |
Call SCSS @function. | |
callStackMessage ($all=false, $limit=null) | |
Beautify call stack for output. | |
checkCompatibleTags ($tag1, $tag2) | |
Check the compatibility between two tag names: if both are defined they should be identical or one has to be '*'. | |
checkSelectorArgType ($arg, $maxDepth=2) | |
Check variable type for getSelectorArg() function. | |
coerceColor ($value, $inRGBFunction=false) | |
Coerce value to color. | |
coerceForExpression ($value) | |
Coerce color for expression. | |
coerceList ($item, $delim=',', $removeTrailingNull=false) | |
Coerce something to list. | |
coerceMap ($item) | |
Coerce something to map. | |
coercePercent ($value) | |
Coerce value to a percentage. | |
coerceString ($value) | |
Coerce value to string. | |
coerceValue ($value) | |
Coerce a php value into a scss one. | |
collapseSelectors ($selectors) | |
Collapse selectors. | |
combineSelectorSingle ($base, $other) | |
Combine selector single. | |
compactEnv (Environment $env) | |
Convert env linked list to stack. | |
compileAtRoot (Block $block) | |
Compile at-root. | |
compileBlock (Block $block) | |
Recursively compiles a block. | |
compileChild ($child, ScssPhp\ScssPhp\Formatter\OutputBlock $out) | |
Compile child; returns a value to halt execution. | |
compileChildren ($stms, OutputBlock $out, $traceName='') | |
Compile children and return result. | |
compileChildrenNoReturn ($stms, OutputBlock $out, $selfParent=null, $traceName='') | |
Compile children and throw exception if unexpected at-return. | |
compileColorPartValue ($value, $min, $max, $isInt=true) | |
compileComment ($block) | |
Compile root level comment. | |
compileCommentValue ($value, $pushEnv=false) | |
Compile the value of a comment that can have interpolation. | |
compileDebugValue ($value) | |
compileDirective ($directive, OutputBlock $out) | |
Compile directive. | |
compileDirectiveName ($directiveName) | |
directive names can include some interpolation | |
compileImport ($rawPath, OutputBlock $out, $once=false) | |
Compile import; returns true if the value was something that could be imported. | |
compileImportPath ($rawPath) | |
compileKeyframeBlock (Block $block, $selectors) | |
Compile keyframe block. | |
compileMedia (Block $media) | |
Compile media. | |
compileMediaQuery ($queryList) | |
Compile media query. | |
compileNestedBlock (Block $block, $selectors) | |
Compile nested block. | |
compileNestedPropertiesBlock (Block $block, OutputBlock $out) | |
Compile nested properties lines. | |
compileRGBAValue ($value, $isAlpha=false) | |
compileRoot (Block $rootBlock) | |
Compile root. | |
compileSelector ($selector) | |
Compile selector to string; self(&) should have been replaced by now. | |
compileSelectorPart ($piece) | |
Compile selector part. | |
compileStringContent ($string, $quote=true) | |
Compile string content. | |
compileWith ($withCondition) | |
Compile @at-root's with: inclusion / without: exclusion into 2 lists uses to filter scope/env later. | |
completeScope ($scope, $previousScope) | |
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) | |
cssValidArg ($arg, $allowed_function=[], $inFunction=false) | |
escapeImportPathString ($path) | |
evalSelector ($selector) | |
Evaluate selector. | |
evalSelectorPart ($part) | |
Evaluate selector part; replaces all the interpolates, stripping quotes. | |
evalSelectors ($selectors) | |
Evaluate selectors. | |
evaluateMediaQuery ($queryList) | |
evaluate media query : compile internal value keeping the structure unchanged | |
expToString ($exp, $keepParens=false) | |
Reduce expression to string. | |
extendOrReplaceSelectors ($selectors, $extendee, $extender, $replace=false) | |
Extend/replace in selectors used by selector-extend and selector-replace that use the same logic. | |
extractEnv ($envs) | |
Convert env stack to singly linked list. | |
extractInterpolation ($list) | |
Extract interpolation; it doesn't need to be recursive, compileValue will handle that. | |
extractRelationshipFromFragment (array $fragment) | |
Extract a relationship from the fragment. | |
filterScopeWithWithout ($scope, $with, $without) | |
Filter at-root scope depending on with/without option. | |
filterWithWithout ($envs, $with, $without) | |
Filter env stack. | |
findScopeSelectors ($scope, $depth) | |
Find a selector by the depth node in the scope. | |
findTagName ($parts) | |
Find the html tag name in a selector parts list. | |
fixColor ($c) | |
Make sure a color's components don't go out of bounds. | |
flattenList ($list) | |
Flatten list. | |
flattenSelectors (OutputBlock $block, $parentKey=null) | |
Flatten selectors. | |
flattenSelectorSingle ($single) | |
Flatten selector single; joins together .classes and ids. | |
fncall ($functionReference, $argValues) | |
Function caller. | |
formatOutputSelector ($selectors) | |
Postprocess selector to output in right format. | |
getBuiltinFunction ($name) | |
Get built-in function. | |
getFunctionReference ($name, $safeCopy=false) | |
Find a function reference. | |
getSelectorArg ($arg, $varname=null, $allowParent=false) | |
Preprocess selector args. | |
getStoreEnv () | |
Get store environment. | |
glueFunctionSelectors ($parts) | |
Glue parts of :not( or :nth-child( ... that are in general split in selectors parts. | |
handleImportLoop ($name) | |
Handle import loop. | |
has ($name, Environment $env=null) | |
Has variable? | |
hasSelectorPlaceholder ($selector) | |
Has selector placeholder? | |
hueToRGB ($m1, $m2, $h) | |
Hue to RGB helper. | |
importFile ($path, OutputBlock $out) | |
Import file. | |
injectVariables (array $args) | |
Inject variables. | |
inspectFormatValue ($value, $force_enclosing_display=false) | |
is_valid_file ($path) | |
Is the given file valid for import ? | |
isImmediateRelationshipCombinator ($value) | |
Is the value a direct relationship combinator? | |
isPseudoSelector ($part, &$matches) | |
Test a part for being a pseudo selector. | |
isSelfExtend ($target, $origin) | |
Is self extend? | |
isSuperPart ($superParts, $subParts) | |
Test a part of super selector again a part of sub selector. | |
isSuperSelector ($super, $sub) | |
Test a $super selector again $sub. | |
isWith ($block, $with, $without) | |
Filter WITH rules. | |
joinSelectors ($parent, $child, &$stillHasSelf, $selfParentSelectors=null) | |
Join selectors; looks for & to replace, or append parent before child. | |
libAbs ($args) | |
libAdjustColor ($args) | |
libAdjustHue ($args) | |
libAlpha ($args) | |
libAppend ($args) | |
libBlue ($args) | |
libCall ($args) | |
libCeil ($args) | |
libChangeColor ($args) | |
libComparable ($args) | |
libComplement ($args) | |
libCounter ($args) | |
Workaround IE7's content counter bug. | |
libDarken ($args) | |
libDesaturate ($args) | |
libFadeIn ($args) | |
libFadeOut ($args) | |
libFeatureExists ($args) | |
libFloor ($args) | |
libFunctionExists ($args) | |
libGetFunction ($args) | |
libGlobalVariableExists ($args) | |
libGrayscale ($args) | |
libGreen ($args) | |
libHsl ($args, $kwargs, $funcName='hsl') | |
libHsla ($args, $kwargs) | |
libHue ($args) | |
libIeHexStr ($args) | |
libIf ($args) | |
libIndex ($args) | |
libInspect ($args) | |
libInvert ($args) | |
libIsBracketed ($args) | |
libIsSuperselector ($args) | |
libJoin ($args) | |
libKeywords ($args) | |
libLength ($args) | |
libLighten ($args) | |
libLightness ($args) | |
libListSeparator ($args) | |
libMapGet ($args) | |
libMapHasKey ($args) | |
libMapKeys ($args) | |
libMapMerge ($args) | |
libMapRemove ($args) | |
libMapValues ($args) | |
libMax ($args) | |
libMin ($args) | |
libMix ($args) | |
libMixinExists ($args) | |
libNth ($args) | |
libOpacify ($args) | |
libOpacity ($args) | |
libPercentage ($args) | |
libQuote ($args) | |
libRandom ($args) | |
libRed ($args) | |
libRgb ($args, $kwargs, $funcName='rgb') | |
libRgba ($args, $kwargs) | |
libRound ($args) | |
libSaturate ($args) | |
libSaturation ($args) | |
libScaleColor ($args) | |
libScssphpGlob ($args) | |
libSelectorAppend ($args) | |
libSelectorExtend ($args) | |
libSelectorNest ($args) | |
libSelectorParse ($args) | |
libSelectorReplace ($args) | |
libSelectorUnify ($args) | |
libSetNth ($args) | |
libSimpleSelectors ($args) | |
libStrIndex ($args) | |
libStrInsert ($args) | |
libStrLength ($args) | |
libStrSlice ($args) | |
libToLowerCase ($args) | |
libToUpperCase ($args) | |
libTransparentize ($args) | |
libTypeOf ($args) | |
libUniqueId () | |
libUnit ($args) | |
libUnitless ($args) | |
libUnquote ($args) | |
libVariableExists ($args) | |
libZip ($args) | |
listSeparatorForJoin ($list1, $sep) | |
makeOutputBlock ($type, $selectors=null) | |
Make output block. | |
matchExtends ($selector, &$out, $from=0, $initial=true) | |
Match extends. | |
matchExtendsSingle ($rawSingle, &$outOrigin, $initial=true) | |
Match extends single. | |
matchPartInCompound ($part, $compound) | |
Try to find a matching part in a compound: | |
mediaParent (OutputBlock $scope) | |
Media parent. | |
mergeDirectRelationships ($selectors1, $selectors2) | |
Merge direct relationships between selectors. | |
mergeMediaTypes ($type1, $type2) | |
Merge media types. | |
mergeParts ($parts1, $parts2) | |
Merge two part list taking care that. | |
missingSelectors () | |
Report missing selectors. | |
multiplyMedia (Environment $env=null, $childQueries=null) | |
Multiply media. | |
multiplySelectors (Environment $env, $selfParent=null) | |
Find the final set of selectors. | |
normalizeName ($name) | |
Normalize name. | |
opAdd ($left, $right) | |
Add strings. | |
opAddNumberNumber (Number $left, Number $right) | |
Add numbers. | |
opAnd ($left, $right, $shouldEval) | |
Boolean and. | |
opColorColor ($op, $left, $right) | |
Compare colors. | |
opColorNumber ($op, $left, Number $right) | |
Compare color and number. | |
opDivNumberNumber (Number $left, Number $right) | |
Divide numbers. | |
opEq ($left, $right) | |
Compare number1 == number2. | |
opEqNumberNumber (Number $left, Number $right) | |
Compare number1 == number2. | |
opGteNumberNumber (Number $left, Number $right) | |
Compare number1 >= number2. | |
opGtNumberNumber (Number $left, Number $right) | |
Compare number1 > number2. | |
opLteNumberNumber (Number $left, Number $right) | |
Compare number1 <= number2. | |
opLtNumberNumber (Number $left, Number $right) | |
Compare number1 < number2. | |
opModNumberNumber (Number $left, Number $right) | |
Mod numbers. | |
opMulNumberNumber (Number $left, Number $right) | |
Multiply numbers. | |
opNeq ($left, $right) | |
Compare number1 != number2. | |
opNeqNumberNumber (Number $left, Number $right) | |
Compare number1 != number2. | |
opNumberColor ($op, Number $left, $right) | |
Compare number and color. | |
opOr ($left, $right, $shouldEval) | |
Boolean or. | |
opSubNumberNumber (Number $left, Number $right) | |
Subtract numbers. | |
parserFactory ($path) | |
Instantiate parser. | |
popCallStack () | |
popEnv () | |
Pop environment. | |
prependSelectors ($selectors, $parts) | |
Prepend each selector from $selectors with $parts. | |
pushCallStack ($name='') | |
pushEnv (Block $block=null) | |
Push environment. | |
pushExtends ($target, $origin, $block) | |
Push extends. | |
pushOrMergeExtentedSelector (&$out, $extended) | |
Push extended selector except if. | |
reduce ($value, $inExp=false) | |
Reduce value. | |
replaceSelfSelector ($selectors, $replace=null) | |
Parse down the selector and revert [self] to "&" before a reparsing. | |
selectorAppend ($selectors) | |
Append parts of the last selector in the list to the previous, recursively. | |
set ($name, $value, $shadow=false, Environment $env=null, $valueUnreduced=null) | |
Set variable. | |
setExisting ($name, $value, Environment $env, $valueUnreduced=null) | |
Set existing variable. | |
setRaw ($name, $value, Environment $env, $valueUnreduced=null) | |
Set raw variable. | |
shouldEval ($value) | |
Should $value cause its operand to eval. | |
sortNativeFunctionArgs ($functionName, $prototypes, $args) | |
Sorts keyword arguments. | |
stringifyFncallArgs ($arg) | |
Reformat fncall arguments to proper css function output. | |
stringTransformAsciiOnly ($stringContent, $filter) | |
Apply a filter on a string content, only on ascii chars let extended chars untouched. | |
testWithWithout ($what, $with, $without) | |
Test a single type of block against with/without lists. | |
unifyCompoundSelectors ($compound1, $compound2) | |
The selector-unify magic as its best (at least works as expected on test cases) | |
Protected Attributes | |
bool null | $charsetSeen |
array< int, $importPaths=[];protected array< string, $importCache=[];protected string[] $importedFiles=[];protected array $userFunctions=[];protected array< string, $registeredVars=[];protected array< string, $registeredFeatures=['extend-selector-pseudoclass'=> false, 'at-error'=> true, 'units-level-3'=> true, 'global-variable-shadowing'=> string null | $encoding = null |
ScssPhp ScssPhp Compiler Environment | $env |
Formatter | $formatter |
null | $lineNumberStyle = null |
OutputBlock null | $rootBlock |
Environment | $rootEnv |
OutputBlock null | $scope |
array | $scsscontent = array() |
Bits of SCSS content. | |
string | $scssfile |
The path to the SCSS file. | |
array | $scssprepend = array() |
Bits of SCSS content to prepend. | |
int SourceMapGenerator | $sourceMap = self::SOURCE_MAP_NONE |
@phpstan-var self\SOURCE_MAP_*|SourceMapGenerator | |
array | $sourceMapOptions = [] |
@phpstan-var array{sourceRoot?: string, sourceMapFilename?: string|null, sourceMapURL?: string|null, sourceMapWriteTo?: string|null, outputSourceFiles?: bool, sourceMapRootpath?: string, sourceMapBasepath?: string} | |
Environment null | $storeEnv |
array< int, $importPaths=[];protected array< string, $importCache=[];protected string[] $importedFiles=[];protected array $userFunctions=[];protected array< string, $registeredVars=[];protected array< string, $registeredFeatures=['extend-selector-pseudoclass'=> false, 'at-error'=> true, 'units-level-3'=> true, 'global-variable-shadowing'=> | false |
string|callable> | |
array< int, $sourceNames;protected Cache|null $cache;protected bool $cacheCheckImportResolutions=false;protected int $indentLevel;protected array[] $extends;protected array< string, $extendsMap;protected array< string, $parsedFiles=[];protected Parser|null $parser;protected int|null $sourceIndex;protected int|null $sourceLine;protected int|null $sourceColumn;protected bool|null $shouldEvaluate;protected null $ignoreErrors;protected bool $ignoreCallStackMessage=false;protected array[] $callStack=[];private array $resolvedImports=[];private string|null $currentDirectory;private string $rootDirectory;private bool $legacyCwdImportPath=true;private LoggerInterface $logger;private array< string, $warnedChildFunctions=[];public function __construct( $cacheOptions=null) { $this->sourceNames=[];if( $cacheOptions) { $this->cache=new Cache( $cacheOptions);if(!empty( $cacheOptions[ 'checkImportResolutions'])) { $this->cacheCheckImportResolutions=true;} } $this-> | logger = new StreamLogger(fopen('php://stderr', 'w'), true) |
string|null> | |
Static Protected Attributes | |
static | $libAbs = ['number'] |
static | $libAdjustColor = ['color', 'kwargs...'] |
static | $libAdjustHue = ['color', 'degrees'] |
static | $libAlpha = ['color'] |
static | $libAppend = ['list', 'val', 'separator:auto'] |
static | $libBlue = ['color'] |
static | $libCall = ['function', 'args...'] |
static | $libCeil = ['number'] |
static | $libChangeColor = ['color', 'kwargs...'] |
static | $libComparable |
static | $libComplement = ['color'] |
static | $libCounter = ['args...'] |
static | $libDarken = ['color', 'amount'] |
static | $libDesaturate = ['color', 'amount'] |
static | $libFadeIn = ['color', 'amount'] |
static | $libFadeOut = ['color', 'amount'] |
static | $libFeatureExists = ['feature'] |
static | $libFloor = ['number'] |
static | $libFunctionExists = ['name'] |
static | $libGetFunction |
static | $libGlobalVariableExists = ['name'] |
static | $libGrayscale = ['color'] |
static | $libGreen = ['color'] |
static | $libHsl |
static | $libHsla |
static | $libHue = ['color'] |
static | $libIeHexStr = ['color'] |
static | $libIf = ['condition', 'if-true', 'if-false:'] |
static | $libIndex = ['list', 'value'] |
static | $libInspect = ['value'] |
static | $libInvert = ['color', 'weight:100%'] |
static | $libIsBracketed = ['list'] |
static | $libIsSuperselector = ['super', 'sub'] |
static | $libJoin = ['list1', 'list2', 'separator:auto', 'bracketed:auto'] |
static | $libKeywords = ['args'] |
static | $libLength = ['list'] |
static | $libLighten = ['color', 'amount'] |
static | $libLightness = ['color'] |
static | $libListSeparator = ['list'] |
static | $libMapGet = ['map', 'key', 'keys...'] |
static | $libMapHasKey = ['map', 'key', 'keys...'] |
static | $libMapKeys = ['map'] |
static | $libMapMerge |
static | $libMapRemove |
static | $libMapValues = ['map'] |
static | $libMax = ['numbers...'] |
static | $libMin = ['numbers...'] |
static | $libMix |
static | $libMixinExists = ['name'] |
static | $libNth = ['list', 'n'] |
static | $libOpacify = ['color', 'amount'] |
static | $libOpacity = ['color'] |
static | $libPercentage = ['number'] |
static | $libQuote = ['string'] |
static | $libRandom = ['limit:null'] |
static | $libRed = ['color'] |
static | $libRgb |
static | $libRgba |
static | $libRound = ['number'] |
static | $libSaturate = [['color', 'amount'], ['amount']] |
static | $libSaturation = ['color'] |
static | $libScaleColor = ['color', 'kwargs...'] |
static | $libScssphpGlob = ['pattern'] |
static | $libSelectorAppend = ['selector...'] |
static | $libSelectorExtend |
static | $libSelectorNest = ['selector...'] |
static | $libSelectorParse |
static | $libSelectorReplace |
static | $libSelectorUnify = ['selectors1', 'selectors2'] |
static | $libSetNth = ['list', 'n', 'value'] |
static | $libSimpleSelectors = ['selector'] |
static | $libStrIndex = ['string', 'substring'] |
static | $libStrInsert = ['string', 'insert', 'index'] |
static | $libStrLength = ['string'] |
static | $libStrSlice = ['string', 'start-at', 'end-at:-1'] |
static | $libToLowerCase = ['string'] |
static | $libToUpperCase = ['string'] |
static | $libTransparentize = ['color', 'amount'] |
static | $libTypeOf = ['value'] |
static | $libUniqueId = [] |
static | $libUnit = ['number'] |
static | $libUnitless = ['number'] |
static | $libUnquote = ['string'] |
static | $libVariableExists = ['name'] |
static | $libZip = ['lists...'] |
static static | array< string, $namespaces=['special'=> |
string> | |
static | array< string, $operatorNames=['+'=> |
string> | |
Moodle SCSS compiler class.
core_scss::add_variables | ( | array | $variables | ) |
Add variables.
array | $scss | Associative array of variables and their values. |
void |
|
inherited |
Add feature.
@api
string | $name |
void |
|
inherited |
Add import path.
@api
string | callable | $path |
void |
|
inherited |
Replaces variables.
array<string,mixed> | $variables |
void |
|
protectedinherited |
array | $color | |
int | $idx | |
int | float | $amount |
array |
|
protectedinherited |
Helper function for adjust_color, change_color, and scale_color.
array<array|Number> | $args | |
string | $operation | |
callable | $fn |
array |
@phpstan-param callable(float|int, float|int|null, float|int): (float|int) $fn
core_scss::append_raw_scss | ( | $scss | ) |
Append raw SCSS to what's to compile.
string | $scss | SCSS code. |
void |
|
protectedinherited |
Append lines to the current output block: directly to the block or through a child if necessary.
ScssPhp\ScssPhp\Formatter\OutputBlock | $out | |
string | $type | |
string | $line |
void |
|
protectedinherited |
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)
string | $line | |
ScssPhp\ScssPhp\Formatter\OutputBlock | $out | |
array | $allowed |
void |
|
protectedinherited |
Apply argument values per definition.
array[] | $argDef | |
array | null | $argValues | |
bool | $storeInEnv | |
bool | $reduce | only used if $storeInEnv = false |
array<string,array|Number> |
@phpstan-param list<array{0: string, 1: array|Number|null, 2: bool}> $argDef
Exception |
|
inherited |
Assert value is a color.
@api
array | Number | $value | |
string | null | $varName |
array |
SassScriptException |
|
inherited |
Assert value is a integer.
@api
array | Number | $value | |
string | null | $varName |
int |
SassScriptException |
|
inherited |
Assert value is a list.
@api
array | Number | $value |
array |
Exception |
|
inherited |
Assert value is a map.
@api
array | Number | $value | |
string | null | $varName |
array |
SassScriptException |
|
inherited |
Assert value is a number.
@api
array | Number | $value | |
string | null | $varName |
Number |
SassScriptException |
|
inherited |
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.
@api
array | Number | $value | |
string | null | $varName |
array |
SassScriptException |
|
protectedinherited |
Propagate vars from a just poped Env (used in @each and @for)
array | $store | |
null | string[] | $excludedVars |
void |
|
protectedinherited |
Call built-in and registered (PHP) functions.
string | $name | |
callable | $function | |
array | $prototype | |
array | $args |
array|Number|null |
|
protectedinherited |
Call SCSS @function.
CallableBlock | null | $func | |
array | $argValues |
array|Number |
|
protectedinherited |
Beautify call stack for output.
bool | $all | |
int | null | $limit |
string |
|
protectedinherited |
Check the compatibility between two tag names: if both are defined they should be identical or one has to be '*'.
string | $tag1 | |
string | $tag2 |
array|false |
|
protectedinherited |
Check variable type for getSelectorArg() function.
array | $arg | |
int | $maxDepth |
bool |
|
protectedinherited |
Coerce value to color.
array | Number | $value | |
bool | $inRGBFunction |
array|null |
|
protectedinherited |
Coerce color for expression.
array | Number | $value |
array|Number |
|
protectedinherited |
Coerce something to list.
array | Number | $item | |
string | $delim | |
bool | $removeTrailingNull |
array |
|
protectedinherited |
Coerce something to map.
array | Number | $item |
array|Number |
|
protectedinherited |
|
protectedinherited |
Coerce value to string.
array | Number | $value |
array |
|
protectedinherited |
Coerce a php value into a scss one.
mixed | $value |
array|Number |
|
protectedinherited |
Collapse selectors.
array | $selectors |
string |
|
protectedinherited |
Combine selector single.
array | $base | |
array | $other |
array |
|
protectedinherited |
Convert env linked list to stack.
Environment | $env |
Environment[] |
@phpstan-return non-empty-array<Environment>
core_scss::compile | ( | $code, | |
$path = null ) |
Compile scss.
Overrides ScssPHP's implementation, using the SassC compiler if it is available.
string | $code | SCSS to compile. |
string | $path | Path to SCSS to compile. |
string | The compiled CSS. |
Reimplemented from ScssPhp\ScssPhp\Compiler.
|
protectedinherited |
|
protectedinherited |
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.
ScssPhp\ScssPhp\Block | $block |
void |
|
protected |
Compile child; returns a value to halt execution.
array | $child | |
ScssPhp\ScssPhp\Formatter\OutputBlock | $out |
array|null |
Reimplemented from ScssPhp\ScssPhp\Compiler.
|
protectedinherited |
Compile children and return result.
array | $stms | |
ScssPhp\ScssPhp\Formatter\OutputBlock | $out | |
string | $traceName |
array|Number|null |
|
protectedinherited |
Compile children and throw exception if unexpected at-return.
array[] | $stms | |
ScssPhp\ScssPhp\Formatter\OutputBlock | $out | |
ScssPhp\ScssPhp\Block | $selfParent | |
string | $traceName |
void |
Exception |
|
protectedinherited |
mixed | $value | |
int | float | $min | |
int | float | $max | |
bool | $isInt |
int|mixed |
|
protectedinherited |
Compile root level comment.
array | $block |
void |
|
protectedinherited |
Compile the value of a comment that can have interpolation.
array | $value | |
bool | $pushEnv |
string |
|
protectedinherited |
array | Number | $value |
string |
|
protectedinherited |
Compile directive.
DirectiveBlock | array | $directive | |
ScssPhp\ScssPhp\Formatter\OutputBlock | $out |
void |
|
protectedinherited |
directive names can include some interpolation
string | array | $directiveName |
string |
CompilerException |
|
protectedinherited |
Compile import; returns true if the value was something that could be imported.
array | $rawPath | |
ScssPhp\ScssPhp\Formatter\OutputBlock | $out | |
bool | $once |
bool |
|
protectedinherited |
array | $rawPath |
string |
CompilerException |
|
protectedinherited |
Compile keyframe block.
ScssPhp\ScssPhp\Block | $block | |
string[] | $selectors |
void |
|
protectedinherited |
|
protectedinherited |
Compile media query.
array | $queryList |
string[] |
|
protectedinherited |
|
protectedinherited |
Compile nested properties lines.
ScssPhp\ScssPhp\Block | $block | |
ScssPhp\ScssPhp\Formatter\OutputBlock | $out |
void |
|
protectedinherited |
int | Number | $value | |
bool | $isAlpha |
int|mixed |
|
protectedinherited |
|
protectedinherited |
Compile selector to string; self(&) should have been replaced by now.
string | array | $selector |
string |
|
protectedinherited |
Compile selector part.
array | $piece |
string |
|
inherited |
Compile scss.
string | $source | |
string | null | $path |
CompilationResult |
SassException | when the source fails to compile |
|
protectedinherited |
Compile string content.
array | $string | |
bool | $quote |
string |
|
inherited |
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.
@api
array | Number | $value | |
bool | $quote |
string |
|
protectedinherited |
Compile @at-root's with: inclusion / without: exclusion into 2 lists uses to filter scope/env later.
array | null | $withCondition |
array |
@phpstan-return array{array<string, bool>, array<string, bool>}
|
protectedinherited |
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)
ScssPhp\ScssPhp\Formatter\OutputBlock | $scope | |
ScssPhp\ScssPhp\Formatter\OutputBlock | $previousScope |
OutputBlock |
|
protectedinherited |
array | Number | $arg | |
string[] | $allowed_function | |
bool | $inFunction |
array|Number|false |
|
inherited |
string | $functionName | |
array | $ExpectedArgs | |
int | $nbActual |
CompilerException |
|
protectedinherited |
array | $path |
array |
CompilerException |
|
protectedinherited |
Evaluate selector.
array | $selector |
array |
@phpstan-impure
|
protectedinherited |
Evaluate selector part; replaces all the interpolates, stripping quotes.
array | $part |
array |
@phpstan-impure
|
protectedinherited |
Evaluate selectors.
array | $selectors |
array |
|
protectedinherited |
evaluate media query : compile internal value keeping the structure unchanged
array | $queryList |
array |
|
protectedinherited |
Reduce expression to string.
array | $exp | |
bool | $keepParens |
array |
|
protectedinherited |
Extend/replace in selectors used by selector-extend and selector-replace that use the same logic.
array | $selectors | |
array | $extendee | |
array | $extender | |
bool | $replace |
array |
|
protectedinherited |
Convert env stack to singly linked list.
Environment[] | $envs |
Environment |
@phpstan-param non-empty-array<Environment> $envs
|
protectedinherited |
Extract interpolation; it doesn't need to be recursive, compileValue will handle that.
array | $list |
array |
|
protectedinherited |
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.
array | $fragment | The selector fragment maybe ending with a direction relationship combinator. |
array | The selector without the relationship fragment if any, the relationship fragment. |
|
protectedinherited |
Filter at-root scope depending on with/without option.
ScssPhp\ScssPhp\Formatter\OutputBlock | $scope | |
array | $with | |
array | $without |
OutputBlock |
|
protectedinherited |
Filter env stack.
Environment[] | $envs | |
array | $with | |
array | $without |
Environment |
@phpstan-param non-empty-array<Environment> $envs
|
protectedinherited |
Find a selector by the depth node in the scope.
ScssPhp\ScssPhp\Formatter\OutputBlock | $scope | |
int | $depth |
array |
|
protectedinherited |
Find the html tag name in a selector parts list.
string[] | $parts |
string |
|
protectedinherited |
Make sure a color's components don't go out of bounds.
array | $c |
array |
|
protectedinherited |
|
protectedinherited |
Flatten selectors.
ScssPhp\ScssPhp\Formatter\OutputBlock | $block | |
string | $parentKey |
void |
|
protectedinherited |
Flatten selector single; joins together .classes and ids.
array | $single |
array |
|
protectedinherited |
Function caller.
string | array | $functionReference | |
array | $argValues |
array|Number |
|
protectedinherited |
Postprocess selector to output in right format.
array | $selectors |
array |
|
inherited |
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.
array | Number | $value |
array<string,array|Number> |
|
protectedinherited |
Get built-in function.
string | $name | Normalized name |
array |
|
inherited |
Get compiler options.
array<string,mixed> |
|
protectedinherited |
Find a function reference.
string | $name | |
bool | $safeCopy |
array |
|
inherited |
|
protectedinherited |
Preprocess selector args.
array | $arg | |
string | null | $varname | |
bool | $allowParent |
array |
|
inherited |
|
protectedinherited |
Get store environment.
ScssPhp\ScssPhp\Compiler\Environment |
|
inherited |
Gets the text of a Sass string.
Calling this method on anything else than a SassString is unsupported. Use {
array | $value |
string |
|
inherited |
Returns list of variables.
@api
array |
|
protectedinherited |
Glue parts of :not( or :nth-child( ... that are in general split in selectors parts.
array | $parts |
array |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
Has selector placeholder?
array | $selector |
bool |
|
protectedinherited |
Hue to RGB helper.
float | $m1 | |
float | $m2 | |
float | $h |
float |
|
protectedinherited |
|
protectedinherited |
Inject variables.
array | $args |
void |
|
protectedinherited |
array | Number | $value | |
bool | $force_enclosing_display |
array |
|
protected |
Is the given file valid for import ?
$path |
bool |
|
staticinherited |
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.
string | $url |
bool |
|
protectedinherited |
Is the value a direct relationship combinator?
string | $value |
bool |
|
protectedinherited |
Test a part for being a pseudo selector.
string | $part | |
array | $matches |
bool |
|
protectedinherited |
Is self extend?
array | $target | |
array | $origin |
bool |
|
protectedinherited |
Test a part of super selector again a part of sub selector.
array | $superParts | |
array | $subParts |
bool |
|
protectedinherited |
Test a $super selector again $sub.
array | $super | |
array | $sub |
bool |
|
inherited |
Is truthy?
array | Number | $value |
bool |
|
protectedinherited |
Filter WITH rules.
ScssPhp\ScssPhp\Block | ScssPhp\ScssPhp\Formatter\OutputBlock | $block | |
array | $with | |
array | $without |
bool |
|
protectedinherited |
Join selectors; looks for & to replace, or append parent before child.
array | $parent | |
array | $child | |
bool | $stillHasSelf | |
array | $selfParentSelectors |
array |
|
protectedinherited |
Workaround IE7's content counter bug.
array | $args |
array |
|
protectedinherited |
array | $args | |
array | $kwargs | |
string | $funcName |
array|null |
|
protectedinherited |
array | $args | |
array | $kwargs | |
string | $funcName |
array |
|
protectedinherited |
array | $list1 | |
array | Number | null | $sep |
string |
CompilerException |
|
protectedinherited |
Make output block.
string | null | $type | |
string[] | null | $selectors |
ScssPhp\ScssPhp\Formatter\OutputBlock |
|
protectedinherited |
Match extends.
array | $selector | |
array | $out | |
int | $from | |
bool | $initial |
void |
|
protectedinherited |
Match extends single.
array | $rawSingle | |
array | $outOrigin | |
bool | $initial |
bool |
|
protectedinherited |
Try to find a matching part in a compound:
array | $part | |
array | $compound |
array|false |
|
protectedinherited |
Media parent.
ScssPhp\ScssPhp\Formatter\OutputBlock | $scope |
ScssPhp\ScssPhp\Formatter\OutputBlock |
|
protectedinherited |
Merge direct relationships between selectors.
array | $selectors1 | |
array | $selectors2 |
array |
|
protectedinherited |
Merge media types.
array | $type1 | |
array | $type2 |
array|null |
|
protectedinherited |
Merge two part list taking care that.
array | $parts1 | |
array | $parts2 |
array |
|
protectedinherited |
Report missing selectors.
void |
|
protectedinherited |
Multiply media.
ScssPhp\ScssPhp\Compiler\Environment | $env | |
array | $childQueries |
array |
|
protectedinherited |
Find the final set of selectors.
ScssPhp\ScssPhp\Compiler\Environment | $env | |
ScssPhp\ScssPhp\Block | $selfParent |
array |
|
protectedinherited |
Normalize name.
string | $name |
string |
|
protectedinherited |
Add strings.
array | $left | |
array | $right |
array|null |
Add numbers.
Number | $left | |
Number | $right |
Number |
|
protectedinherited |
Boolean and.
array | Number | $left | |
array | Number | $right | |
bool | $shouldEval |
array|Number|null |
|
protectedinherited |
Compare colors.
string | $op | |
array | $left | |
array | $right |
array |
|
protectedinherited |
Compare color and number.
string | $op | |
array | $left | |
Number | $right |
array |
Divide numbers.
Number | $left | |
Number | $right |
Number |
|
protectedinherited |
Compare number1 == number2.
array | Number | $left | |
array | Number | $right |
array |
Compare number1 == number2.
Number | $left | |
Number | $right |
array |
Compare number1 >= number2.
Number | $left | |
Number | $right |
array |
Compare number1 > number2.
Number | $left | |
Number | $right |
array |
Compare number1 <= number2.
Number | $left | |
Number | $right |
array |
Compare number1 < number2.
Number | $left | |
Number | $right |
array |
Mod numbers.
Number | $left | |
Number | $right |
Number |
Multiply numbers.
Number | $left | |
Number | $right |
Number |
|
protectedinherited |
Compare number1 != number2.
array | Number | $left | |
array | Number | $right |
array |
Compare number1 != number2.
Number | $left | |
Number | $right |
array |
|
protectedinherited |
Compare number and color.
string | $op | |
Number | $left | |
array | $right |
array |
|
protectedinherited |
Boolean or.
array | Number | $left | |
array | Number | $right | |
bool | $shouldEval |
array|Number|null |
Subtract numbers.
Number | $left | |
Number | $right |
Number |
|
protectedinherited |
Instantiate parser.
string | null | $path |
ScssPhp\ScssPhp\Parser |
|
protectedinherited |
void |
|
protectedinherited |
Pop environment.
void |
core_scss::prepend_raw_scss | ( | $scss | ) |
Prepend raw SCSS to what's to compile.
string | $scss | SCSS code. |
void |
|
protectedinherited |
Prepend each selector from $selectors with $parts.
array | $selectors | |
array | $parts |
array |
|
protectedinherited |
string | $name |
void |
|
protectedinherited |
Push environment.
ScssPhp\ScssPhp\Block | $block |
ScssPhp\ScssPhp\Compiler\Environment |
|
protectedinherited |
Push extends.
string[] | $target | |
array | $origin | |
array | null | $block |
void |
|
protectedinherited |
Push extended selector except if.
array | $out | |
array | $extended |
void |
|
protectedinherited |
Reduce value.
array | Number | $value | |
bool | $inExp |
array|Number |
|
inherited |
Register function.
@api
string | $name | |
callable | $callback | |
string[] | null | $argumentDeclaration |
void |
|
protectedinherited |
Parse down the selector and revert [self] to "&" before a reparsing.
array | $selectors | |
string | null | $replace |
array |
|
inherited |
Replaces variables.
array<string,mixed> | $variables |
void |
|
protectedinherited |
Append parts of the last selector in the list to the previous, recursively.
array | $selectors |
array |
ScssPhp\ScssPhp\Exception\CompilerException |
|
protectedinherited |
Set variable.
string | $name | |
mixed | $value | |
bool | $shadow | |
ScssPhp\ScssPhp\Compiler\Environment | $env | |
mixed | $valueUnreduced |
void |
core_scss::set_file | ( | $filepath | ) |
Set the file to compile from.
The purpose of this method is to provide a way to import the content of a file without messing with the import directories.
string | $filepath | The path to the file. |
void |
|
inherited |
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.
bool | $charset |
void |
|
inherited |
Set encoding.
@api
string | null | $encoding |
void |
|
inherited |
Set an alternative error output stream, for testing purpose only.
resource | $handle |
void |
|
protectedinherited |
Set existing variable.
string | $name | |
mixed | $value | |
ScssPhp\ScssPhp\Compiler\Environment | $env | |
mixed | $valueUnreduced |
void |
|
inherited |
Set formatter.
@api
string | $formatterName |
void |
@phpstan-param class-string<Formatter> $formatterName
|
inherited |
Ignore errors?
@api
bool | $ignoreErrors |
ScssPhp\ScssPhp\Compiler |
|
inherited |
Set import paths.
@api
string|array<string|callable> | $path |
void |
|
inherited |
Set line number style.
@api
string | $lineNumberStyle |
void |
|
inherited |
Sets an alternative logger.
Changing the logger in the middle of the compilation is not supported and will result in an undefined behavior.
LoggerInterface | $logger |
void |
|
inherited |
Set number precision.
@api
int | $numberPrecision |
void |
|
inherited |
Sets the output style.
@api
string | $style | One of the OutputStyle constants |
void |
@phpstan-param OutputStyle::* $style
|
protectedinherited |
Set raw variable.
string | $name | |
mixed | $value | |
ScssPhp\ScssPhp\Compiler\Environment | $env | |
mixed | $valueUnreduced |
void |
|
inherited |
Enable/disable source maps.
@api
int | $sourceMap |
void |
@phpstan-param self\SOURCE_MAP_* $sourceMap
|
inherited |
Set source map options.
@api
array | $sourceMapOptions |
@phpstan-param array{sourceRoot?: string, sourceMapFilename?: string|null, sourceMapURL?: string|null, sourceMapWriteTo?: string|null, outputSourceFiles?: bool, sourceMapRootpath?: string, sourceMapBasepath?: string} $sourceMapOptions
void |
|
inherited |
Set variables.
@api
array | $variables |
void |
|
protectedinherited |
Should $value cause its operand to eval.
array | $value |
bool |
|
protectedinherited |
Sorts keyword arguments.
string | $functionName | |
array | null | $prototypes | |
array | $args |
array|null |
|
protectedinherited |
Reformat fncall arguments to proper css function output.
array | Number | $arg |
array|Number |
|
protectedinherited |
Apply a filter on a string content, only on ascii chars let extended chars untouched.
string | $stringContent | |
callable | $filter |
string |
|
protectedinherited |
Test a single type of block against with/without lists.
string | $what | |
array | $with | |
array | $without |
bool | true if the block should be kept, false to reject |
|
inherited |
Throw error (exception)
@api
string | $msg | Message with optional sprintf()-style vararg parameters |
never |
ScssPhp\ScssPhp\Exception\CompilerException |
core_scss::to_css | ( | ) |
Compiles to CSS.
string |
|
inherited |
Cast to boolean.
@api
bool | $thing |
array |
|
protectedinherited |
The selector-unify magic as its best (at least works as expected on test cases)
array | $compound1 | |
array | $compound2 |
array |
|
inherited |
Unregister function.
@api
string | $name |
void |
|
inherited |
Unset variable.
@api
string | $name |
void |
|
protectedinherited |
|
staticinherited |
|
staticprotectedinherited |
|
staticprotectedinherited |
|
staticprotectedinherited |
|
staticprotectedinherited |
|
staticprotectedinherited |
|
staticprotectedinherited |
|
staticprotectedinherited |
|
staticprotectedinherited |
|
staticprotectedinherited |
|
staticprotectedinherited |
|
staticprotectedinherited |
|
staticprotectedinherited |
|
protectedinherited |
|
staticinherited |
|
staticprotectedinherited |
string>
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |