\FOFLess
This class is taken near verbatim (changes marked with **FOF** comment markers) from:
lessphp v0.3.9
http://leafo.net/lessphp
LESS css compiler, adapted from http://lesscss.org
Copyright 2012, Leaf Corcoran <leafot@gmail.com>
Licensed under MIT or GPLv3, see LICENSE
THIS IS THIRD PARTY CODE. Code comments are mostly useless placeholders to
stop phpcs from complaining...
Synopsis
class FOFLess
{
- // members
- public $VERSION;
- protected $TRUE;
- protected $FALSE;
- protected $libFunctions;
- protected $registeredVars;
- protected $preserveComments;
- public $vPrefix;
- public $mPrefix;
- public $parentSelector;
- public $importDisabled;
- public $importDir;
- protected $numberPrecision;
- protected FOFLessParser $sourceParser;
- protected $sourceLoc;
- public $defaultValue;
- protected $nextImportId;
- protected $cssColors;
- // methods
- protected string|null findImport()
- protected boolean fileExists()
- public static array compressList()
- public static string preg_quote()
- protected boolean tryImport()
- protected void compileImportedProps()
- protected void compileBlock()
- protected void compileCSSBlock()
- protected void compileMedia()
- protected stdClass mediaParent()
- protected void compileNestedBlock()
- protected void compileRoot()
- protected void compileProps()
- protected type sortProps()
- protected string compileMediaQuery()
- protected type multiplyMedia()
- protected type expandParentSelectors()
- protected array findClosestSelectors()
- protected array multiplySelectors()
- protected array compileSelectors()
- protected boolean eq()
- protected boolean patternMatch()
- protected type patternMatchAll()
- protected null findBlocks()
- protected void zipSetArgs()
- protected void compileProp()
- protected void compileValue()
- protected boolean lib_isnumber()
- protected boolean lib_isstring()
- protected boolean lib_iscolor()
- protected boolean lib_iskeyword()
- protected boolean lib_ispixel()
- protected boolean lib_ispercentage()
- protected boolean lib_isem()
- protected boolean lib_isrem()
- protected boolean lib_rgbahex()
- protected type lib_argb()
- protected string lib_e()
- protected type lib__sprintf()
- protected array lib_floor()
- protected array lib_ceil()
- protected array lib_round()
- protected array lib_unit()
- protected array colorArgs()
- protected type lib_darken()
- protected type lib_lighten()
- protected type lib_saturate()
- protected type lib_desaturate()
- protected type lib_spin()
- protected type lib_fadeout()
- protected type lib_fadein()
- protected type lib_hue()
- protected type lib_saturation()
- protected type lib_lightness()
- protected string lib_alpha()
- protected string lib_fade()
- protected string lib_percentage()
- protected string lib_mix()
- protected string lib_contrast()
- protected type assertColor()
- protected type assertNumber()
- protected type toHSL()
- protected type toRGB_helper()
- protected type toRGB()
- protected type clamp()
- protected type funcToColor()
- protected type reduce()
- protected null coerceColor()
- protected null coerceString()
- protected type flattenList()
- protected type toBool()
- protected type evaluate()
- protected string stringConcatenate()
- protected int fixColor()
- protected type op_number_color()
- protected type op_color_number()
- protected type op_color_color()
- public type lib_red()
- public type lib_green()
- public type lib_blue()
- protected type op_number_number()
- protected stdclass makeOutputBlock()
- protected stdclass pushEnv()
- protected type popEnv()
- protected void set()
- protected type get()
- protected void injectVariables()
- public void __construct()
- public type compile()
- public type compileFile()
- public boolean checkedCompile()
- public array cachedCompile()
- public type parse()
- protected FOFLessParser makeParser()
- public void setFormatter()
- protected FOFLessFormatterLessjs newFormatter()
- public void setPreserveComments()
- public void registerFunction()
- public void unregisterFunction()
- public void setVariables()
- public void unsetVariable()
- public void setImportDir()
- public void addImportDir()
- public type allParsedFiles()
- protected void addParsedFile()
- protected void throwError()
- public static type ccompile()
- public static type cexecute()
Tasks
Tasks
Line | Task |
---|---|
211 | need to mark the source parser these came from this file |
254 | this is because the importDir api is stupid |
Members
protected
- $FALSE
- $TRUE
- $cssColors
- $libFunctions
- $nextImportId
—
integer
Uniquely identify imports - $numberPrecision
- $preserveComments
- $registeredVars
- $sourceLoc
- $sourceParser
—
FOFLessParser
Set to the parser that generated the current line when compiling so we know how to create error messages
public
- $VERSION
- $defaultValue
- $importDir
- $importDisabled
- $mPrefix
—
string
Prefix of abstract blocks - $parentSelector
- $vPrefix
—
string
Prefix of abstract properties
Methods
protected
- addParsedFile() — Add parsed file
- assertColor() — Assert color
- assertNumber() — Assert number
- clamp() — Clamp
- coerceColor() — Coerce a value for use in color operation
- coerceString() — Make something string like into a string
- colorArgs() — Helper function to get arguments for color manipulation functions.
- compileBlock() — Recursively compiles a block.
- compileCSSBlock() — Compile CSS block
- compileImportedProps() — Compile Imported Props
- compileMedia() — Compile media
- compileMediaQuery() — Compile media query
- compileNestedBlock() — Compile nested block
- compileProp() — Compile a prop and update $lines or $blocks appropriately
- compileProps() — Compile props
- compileRoot() — Compile root
- compileSelectors() — Reduces selector expressions
- compileValue() — Compiles a primitive value into a CSS property value.
- eq() — Equality check
- evaluate() — Evaluate an expression
- expandParentSelectors() — Expand parent selectors
- fileExists() — Does file $name exists? It's a simple proxy to JFile for now
- findBlocks() — Attempt to find blocks matched by path and args
- findClosestSelectors() — Find closest selectors
- findImport() — Attempts to find the path of an import url, returns null for css files
- fixColor() — Make sure a color's components don't go out of bounds
- flattenList() — Turn list of length 1 into value type
- funcToColor() — Convert the rgb, rgba, hsl color literals of function type as returned by the parser into values of color type.
- get() — Get the highest occurrence entry for a name
- injectVariables() — Inject array of unparsed strings into environment as variables
- lib__sprintf() — Lib sprintf
- lib_alpha() — Get the alpha of a color Defaults to 1 for non-colors or colors without an alpha
- lib_argb() — Lib argb
- lib_ceil() — Lib ceil
- lib_contrast() — Third party code; your guess is as good as mine
- lib_darken() — Lib darken
- lib_desaturate() — Lib desaturate
- lib_e() — Utility func to unquote a string
- lib_fade() — Set the alpha of the color
- lib_fadein() — Lib fadein
- lib_fadeout() — Lib fadeout
- lib_floor() — Lib floor
- lib_hue() — Lib hue
- lib_iscolor() — Lib is color
- lib_isem() — Lib is em
- lib_iskeyword() — Lib is keyword
- lib_isnumber() — Lib is number
- lib_ispercentage() — Lib is percentage
- lib_ispixel() — Lib is pixel
- lib_isrem() — Lib is rem
- lib_isstring() — Lib is string
- lib_lighten() — Lib lighten
- lib_lightness() — Lib lightness
- lib_mix() — mixes two colors by weight mix(@color1, @color2, @weight); http://sass-lang.com/docs/yardoc/Sass/Script/Functions.html#mix-instance_method
- lib_percentage() — Third party code; your guess is as good as mine
- lib_rgbahex() — LIb rgba hex
- lib_round() — Lib round
- lib_saturate() — Lib saturate
- lib_saturation() — Lib saturation
- lib_spin() — Lib spin
- lib_unit() — Lib unit
- makeOutputBlock() — Make output block
- makeParser() — Make parser
- mediaParent() — Media parent
- multiplyMedia() — Multiply media
- multiplySelectors() — Multiply $selectors against the nearest selectors in env
- newFormatter() — New formatter
- op_color_color() — Op color color
- op_color_number() — Op color number
- op_number_color() — Op number color
- op_number_number() — Operator on two numbers
- patternMatch() — Pattern match
- patternMatchAll() — Pattern match all
- popEnv() — Pop something off the stack
- pushEnv() — The state of execution
- reduce() — Reduce
- set() — Set something in the current env
- sortProps() — Sort props
- stringConcatenate() — String concatenate
- throwError() — Uses the current value of $this->count to show line and line number
- toBool() — To bool
- toHSL() — To HSL
- toRGB() — Converts a hsl array into a color value in rgb.
- toRGB_helper() — To RGB helper
- tryImport() — Try import
- zipSetArgs() — Sets all argument names in $args to either the default value or the one passed in through $values
public
- __construct() — Initialize any static state, can initialize parser for a file
- addImportDir() — Add import dir
- allParsedFiles() — All parsed files
- cachedCompile() — Execute lessphp on a .less file or a lessphp cache structure
- ccompile() — Compile file $in to file $out if $in is newer than $out Returns true when it compiles, false otherwise
- cexecute() — Compile execute
- checkedCompile() — Compile only if changed input has changed or output doesn't exist
- compile() — Compile
- compileFile() — Compile file
- compressList() — Compresslist
- lib_blue() — Lib blue
- lib_green() — Lib green
- lib_red() — Lib red
- parse() — Parse and compile buffer
- preg_quote() — Quote for regular expression
- registerFunction() — Register function
- setFormatter() — Set Formatter
- setImportDir() — Set import dir
- setPreserveComments() — Set preserve comments
- setVariables() — Set variables
- unregisterFunction() — Unregister function
- unsetVariable() — Unset variable