Complex classes like Compiler often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Compiler, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
48 | class Compiler |
||
49 | { |
||
50 | const VERSION = 'v0.5.1'; |
||
51 | |||
52 | public static $TRUE = ['keyword', 'true']; |
||
53 | public static $FALSE = ['keyword', 'false']; |
||
54 | |||
55 | /** |
||
56 | * @var callable[] |
||
57 | */ |
||
58 | private $libFunctions = []; |
||
59 | |||
60 | /** |
||
61 | * @var string[] |
||
62 | */ |
||
63 | private $registeredVars = []; |
||
64 | |||
65 | /** |
||
66 | * @var bool |
||
67 | */ |
||
68 | protected $preserveComments = false; |
||
69 | |||
70 | /** |
||
71 | * @var string $vPrefix prefix of abstract properties |
||
72 | */ |
||
73 | private $vPrefix = '@'; |
||
74 | |||
75 | /** |
||
76 | * @var string $mPrefix prefix of abstract blocks |
||
77 | */ |
||
78 | private $mPrefix = '$'; |
||
79 | |||
80 | /** |
||
81 | * @var string |
||
82 | */ |
||
83 | private $parentSelector = '&'; |
||
84 | |||
85 | /** |
||
86 | * @var bool $importDisabled disable @import |
||
87 | */ |
||
88 | private $importDisabled = false; |
||
89 | |||
90 | /** |
||
91 | * @var string[] |
||
92 | */ |
||
93 | private $importDirs = []; |
||
94 | |||
95 | /** |
||
96 | * @var int |
||
97 | */ |
||
98 | private $numberPrecision; |
||
99 | |||
100 | /** |
||
101 | * @var string[] |
||
102 | */ |
||
103 | private $allParsedFiles = []; |
||
104 | |||
105 | /** |
||
106 | * set to the parser that generated the current line when compiling |
||
107 | * so we know how to create error messages |
||
108 | * @var \LesserPhp\Parser |
||
109 | */ |
||
110 | private $sourceParser; |
||
111 | |||
112 | /** |
||
113 | * @var integer $sourceLoc Lines of Code |
||
114 | */ |
||
115 | private $sourceLoc; |
||
116 | |||
117 | /** |
||
118 | * @var int $nextImportId uniquely identify imports |
||
119 | */ |
||
120 | private static $nextImportId = 0; |
||
121 | |||
122 | /** |
||
123 | * @var Parser |
||
124 | */ |
||
125 | private $parser; |
||
126 | |||
127 | /** |
||
128 | * @var \LesserPhp\Formatter\FormatterInterface |
||
129 | */ |
||
130 | private $formatter; |
||
131 | |||
132 | /** |
||
133 | * @var \LesserPhp\NodeEnv What's the meaning of "env" in this context? |
||
134 | */ |
||
135 | private $env; |
||
136 | |||
137 | /** |
||
138 | * @var \LesserPhp\Library\Coerce |
||
139 | */ |
||
140 | private $coerce; |
||
141 | |||
142 | /** |
||
143 | * @var \LesserPhp\Library\Assertions |
||
144 | */ |
||
145 | private $assertions; |
||
146 | |||
147 | /** |
||
148 | * @var \LesserPhp\Library\Functions |
||
149 | */ |
||
150 | private $functions; |
||
151 | |||
152 | /** |
||
153 | * @var mixed what's this exactly? |
||
154 | */ |
||
155 | private $scope; |
||
156 | |||
157 | /** |
||
158 | * @var string |
||
159 | */ |
||
160 | private $formatterName; |
||
161 | |||
162 | /** |
||
163 | * @var \LesserPhp\Color\Converter |
||
164 | */ |
||
165 | private $converter; |
||
166 | |||
167 | /** |
||
168 | * @var bool Allow importing of *.css files |
||
169 | * @see tryImport() |
||
170 | * @see importCss() |
||
171 | */ |
||
172 | 64 | private $import_css = false; |
|
173 | |||
174 | 64 | /** |
|
175 | 64 | * Constructor. |
|
176 | 64 | * |
|
177 | 64 | * Hardwires dependencies for now |
|
178 | 64 | */ |
|
179 | public function __construct() |
||
186 | 48 | ||
187 | /** |
||
188 | 48 | * @param array $items |
|
189 | 48 | * @param $delim |
|
190 | * |
||
191 | 27 | * @return array |
|
192 | */ |
||
193 | public static function compressList(array $items, $delim) |
||
201 | |||
202 | 36 | /** |
|
203 | * @param string $what |
||
204 | * |
||
205 | * @return string |
||
206 | */ |
||
207 | public static function pregQuote($what) |
||
211 | |||
212 | /** |
||
213 | 3 | * @param array $importPath |
|
214 | * @param $parentBlock |
||
215 | 3 | * @param $out |
|
216 | 2 | * |
|
217 | * @return array|false |
||
218 | * @throws \LesserPhp\Exception\GeneralException |
||
219 | 3 | */ |
|
220 | 3 | protected function tryImport(array $importPath, $parentBlock, $out) |
|
289 | 2 | ||
290 | /** |
||
291 | 2 | * @param array $props |
|
292 | * @param $block |
||
293 | 2 | * @param $out |
|
294 | 2 | * @param string $importDir |
|
295 | */ |
||
296 | protected function compileImportedProps(array $props, $block, $out, $importDir) |
||
311 | |||
312 | /** |
||
313 | * Recursively compiles a block. |
||
314 | * |
||
315 | * A block is analogous to a CSS block in most cases. A single LESS document |
||
316 | * is encapsulated in a block when parsed, but it does not have parent tags |
||
317 | * so all of it's children appear on the root level when compiled. |
||
318 | * |
||
319 | * Blocks are made up of props and children. |
||
320 | * |
||
321 | * Props are property instructions, array tuples which describe an action |
||
322 | * to be taken, eg. write a property, set a variable, mixin a block. |
||
323 | * |
||
324 | * The children of a block are just all the blocks that are defined within. |
||
325 | 49 | * This is used to look up mixins when performing a mixin. |
|
326 | * |
||
327 | 49 | * Compiling the block involves pushing a fresh environment on the stack, |
|
328 | 49 | * and iterating through the props, compiling each one. |
|
329 | 49 | * |
|
330 | 38 | * See lessc::compileProp() |
|
331 | 46 | * |
|
332 | 46 | * @param Block $block |
|
333 | 35 | * |
|
334 | 6 | * @throws \LesserPhp\Exception\GeneralException |
|
335 | 3 | */ |
|
336 | 3 | protected function compileBlock(Block $block) |
|
360 | 46 | ||
361 | 46 | /** |
|
362 | * @param Block $block |
||
363 | 46 | * |
|
364 | 46 | * @throws \LesserPhp\Exception\GeneralException |
|
365 | */ |
||
366 | 35 | protected function compileCSSBlock(Block $block) |
|
380 | 3 | ||
381 | 3 | /** |
|
382 | * @param Block\Media $media |
||
383 | 3 | */ |
|
384 | protected function compileMedia(Block\Media $media) |
||
409 | |||
410 | 1 | /** |
|
411 | * @param $scope |
||
412 | * |
||
413 | 3 | * @return mixed |
|
414 | */ |
||
415 | protected function mediaParent($scope) |
||
426 | 4 | ||
427 | /** |
||
428 | 4 | * @param Block $block |
|
429 | 4 | * @param string[] $selectors |
|
430 | 4 | */ |
|
431 | protected function compileNestedBlock(Block $block, array $selectors) |
||
442 | |||
443 | /** |
||
444 | * @param Block $root |
||
445 | */ |
||
446 | protected function compileRoot(Block $root) |
||
453 | |||
454 | 38 | /** |
|
455 | 38 | * @param Block $block |
|
456 | * @param \stdClass $out |
||
457 | * |
||
458 | * @throws \LesserPhp\Exception\GeneralException |
||
459 | */ |
||
460 | protected function compileProps(Block $block, $out) |
||
467 | |||
468 | 38 | /** |
|
469 | 38 | * Deduplicate lines in a block. Comments are not deduplicated. If a |
|
470 | * duplicate rule is detected, the comments immediately preceding each |
||
471 | 38 | * occurence are consolidated. |
|
472 | 38 | * |
|
473 | 2 | * @param array $lines |
|
474 | 2 | * |
|
475 | * @return array |
||
476 | 37 | */ |
|
477 | 37 | protected function deduplicate(array $lines) |
|
496 | 49 | ||
497 | 49 | /** |
|
498 | * @param array $props |
||
499 | 49 | * @param bool $split |
|
500 | 49 | * |
|
501 | 49 | * @return array |
|
502 | 1 | */ |
|
503 | 1 | protected function sortProps(array $props, $split = false) |
|
547 | 3 | ||
548 | 3 | /** |
|
549 | 3 | * @param array $queries |
|
550 | 3 | * |
|
551 | 3 | * @return string |
|
552 | 1 | */ |
|
553 | 1 | protected function compileMediaQuery(array $queries) |
|
590 | |||
591 | 3 | /** |
|
592 | * @param \LesserPhp\NodeEnv $env |
||
593 | * @param array $childQueries |
||
594 | * |
||
595 | 3 | * @return array |
|
596 | 3 | */ |
|
597 | protected function multiplyMedia(NodeEnv $env = null, array $childQueries = null) |
||
624 | 46 | ||
625 | 46 | /** |
|
626 | 46 | * @param $tag |
|
627 | * @param $replace |
||
628 | 46 | * |
|
629 | * @return int |
||
630 | 46 | */ |
|
631 | protected function expandParentSelectors(&$tag, $replace) |
||
643 | 13 | ||
644 | /** |
||
645 | 46 | * @return array|null |
|
646 | */ |
||
647 | protected function findClosestSelectors() |
||
661 | |||
662 | |||
663 | 46 | /** |
|
664 | 46 | * multiply $selectors against the nearest selectors in env |
|
665 | * |
||
666 | 46 | * @param array $selectors |
|
667 | 46 | * |
|
668 | * @return array |
||
669 | */ |
||
670 | 46 | protected function multiplySelectors(array $selectors) |
|
700 | 46 | ||
701 | /** |
||
702 | 46 | * reduces selector expressions |
|
703 | 46 | * |
|
704 | 4 | * @param array $selectors |
|
705 | 4 | * |
|
706 | * @return array |
||
707 | 46 | * @throws \LesserPhp\Exception\GeneralException |
|
708 | */ |
||
709 | protected function compileSelectors(array $selectors) |
||
724 | |||
725 | /** |
||
726 | * @param $left |
||
727 | * @param $right |
||
728 | * |
||
729 | * @return bool |
||
730 | */ |
||
731 | protected function equals($left, $right) |
||
735 | |||
736 | 21 | /** |
|
737 | 5 | * @param $block |
|
738 | 5 | * @param $orderedArgs |
|
739 | 5 | * @param $keywordArgs |
|
740 | 5 | * |
|
741 | 5 | * @return bool |
|
742 | */ |
||
743 | 5 | protected function patternMatch($block, $orderedArgs, $keywordArgs) |
|
831 | 21 | ||
832 | 21 | /** |
|
833 | * @param array $blocks |
||
834 | 21 | * @param $orderedArgs |
|
835 | 1 | * @param $keywordArgs |
|
836 | * @param array $skip |
||
837 | * |
||
838 | 21 | * @return array|null |
|
839 | 21 | */ |
|
840 | protected function patternMatchAll(array $blocks, $orderedArgs, $keywordArgs, array $skip = []) |
||
856 | |||
857 | 22 | /** |
|
858 | * attempt to find blocks matched by path and args |
||
859 | 22 | * |
|
860 | 5 | * @param $searchIn |
|
861 | * @param array $path |
||
862 | 22 | * @param $orderedArgs |
|
863 | 1 | * @param $keywordArgs |
|
864 | * @param array $seen |
||
865 | 22 | * |
|
866 | * @return array|null |
||
867 | 22 | */ |
|
868 | protected function findBlocks($searchIn, array $path, $orderedArgs, $keywordArgs, array $seen = []) |
||
916 | 16 | ||
917 | /** |
||
918 | 16 | * sets all argument names in $args to either the default value |
|
919 | * or the one passed in through $values |
||
920 | 16 | * |
|
921 | 16 | * @param array $args |
|
922 | 14 | * @param $orderedValues |
|
923 | 14 | * @param $keywordValues |
|
924 | * |
||
925 | 2 | * @throws \LesserPhp\Exception\GeneralException |
|
926 | 14 | */ |
|
927 | protected function zipSetArgs(array $args, $orderedValues, $keywordValues) |
||
967 | |||
968 | /** |
||
969 | 49 | * compile a prop and update $lines or $blocks appropriately |
|
970 | * |
||
971 | 49 | * @param $prop |
|
972 | 49 | * @param Block $block |
|
973 | 43 | * @param $out |
|
974 | 43 | * |
|
975 | 23 | * @throws \LesserPhp\Exception\GeneralException |
|
976 | */ |
||
977 | 43 | protected function compileProp($prop, Block $block, $out) |
|
1122 | |||
1123 | |||
1124 | /** |
||
1125 | * Compiles a primitive value into a CSS property value. |
||
1126 | * |
||
1127 | * Values in lessphp are typed by being wrapped in arrays, their format is |
||
1128 | * typically: |
||
1129 | * |
||
1130 | 53 | * array(type, contents [, additional_contents]*) |
|
1131 | * |
||
1132 | * The input is expected to be reduced. This function will not work on |
||
1133 | 53 | * things like expressions and variables. |
|
1134 | * |
||
1135 | * @param array $value |
||
1136 | * @param array $options |
||
1137 | 53 | * |
|
1138 | 53 | * @return string |
|
1139 | 53 | * @throws GeneralException |
|
1140 | */ |
||
1141 | public function compileValue(array $value, array $options = []) |
||
1160 | 2 | ||
1161 | 1 | /** |
|
1162 | * Helper function to get arguments for color manipulation functions. |
||
1163 | 2 | * takes a list that contains a color like thing and a percentage |
|
1164 | 2 | * |
|
1165 | 2 | * @param array $args |
|
1166 | * |
||
1167 | 2 | * @return array |
|
1168 | */ |
||
1169 | public function colorArgs(array $args) |
||
1180 | 24 | ||
1181 | 24 | /** |
|
1182 | 6 | * Convert the rgb, rgba, hsl color literals of function type |
|
1183 | * as returned by the parser into values of color type. |
||
1184 | * |
||
1185 | 24 | * @param array $func |
|
1186 | * |
||
1187 | 24 | * @return bool|mixed |
|
1188 | 1 | */ |
|
1189 | 1 | protected function funcToColor(array $func) |
|
1255 | 7 | ||
1256 | 7 | /** |
|
1257 | 7 | * @param array $value |
|
1258 | * @param bool $forExpression |
||
1259 | 7 | * |
|
1260 | 1 | * @return array|bool|mixed|null // <!-- dafuq? |
|
1261 | */ |
||
1262 | public function reduce(array $value, $forExpression = false) |
||
1410 | 2 | ||
1411 | /** |
||
1412 | * turn list of length 1 into value type |
||
1413 | 2 | * |
|
1414 | * @param array $value |
||
1415 | * |
||
1416 | * @return array |
||
1417 | */ |
||
1418 | protected function flattenList(array $value) |
||
1426 | |||
1427 | 19 | /** |
|
1428 | 19 | * evaluate an expression |
|
1429 | * |
||
1430 | 19 | * @param array $exp |
|
1431 | 19 | * |
|
1432 | 5 | * @return array |
|
1433 | */ |
||
1434 | protected function evaluate($exp) |
||
1488 | 2 | ||
1489 | 2 | /** |
|
1490 | * @param array $left |
||
1491 | 2 | * @param array $right |
|
1492 | * |
||
1493 | 2 | * @return array|null |
|
1494 | */ |
||
1495 | protected function stringConcatenate(array $left, array $right) |
||
1516 | 7 | ||
1517 | 7 | ||
1518 | /** |
||
1519 | * make sure a color's components don't go out of bounds |
||
1520 | 7 | * |
|
1521 | 7 | * @param array $c |
|
1522 | * |
||
1523 | * @return mixed |
||
1524 | */ |
||
1525 | 7 | public function fixColor(array $c) |
|
1538 | 1 | ||
1539 | 1 | /** |
|
1540 | * @param string $op |
||
1541 | * @param array $lft |
||
1542 | 1 | * @param array $rgt |
|
1543 | * |
||
1544 | * @return array|null |
||
1545 | * @throws \LesserPhp\Exception\GeneralException |
||
1546 | */ |
||
1547 | protected function op_number_color($op, array $lft, array $rgt) |
||
1555 | 2 | ||
1556 | /** |
||
1557 | * @param string $op |
||
1558 | * @param array $lft |
||
1559 | 2 | * @param array $rgt |
|
1560 | * |
||
1561 | * @return array |
||
1562 | 2 | * @throws \LesserPhp\Exception\GeneralException |
|
1563 | */ |
||
1564 | protected function op_color_number($op, array $lft, array $rgt) |
||
1576 | |||
1577 | 5 | /** |
|
1578 | 5 | * @param string $op |
|
1579 | 5 | * @param array |
|
1580 | 5 | * $left |
|
1581 | 5 | * @param array $right |
|
1582 | * |
||
1583 | 5 | * @return array |
|
1584 | 5 | * @throws \LesserPhp\Exception\GeneralException |
|
1585 | 5 | */ |
|
1586 | 1 | protected function op_color_color($op, array $left, array $right) |
|
1619 | |||
1620 | /** |
||
1621 | 15 | * operator on two numbers |
|
1622 | * |
||
1623 | 15 | * @param string $op |
|
1624 | * @param array $left |
||
1625 | 15 | * @param array $right |
|
1626 | 9 | * |
|
1627 | 9 | * @return array |
|
1628 | 12 | * @throws \LesserPhp\Exception\GeneralException |
|
1629 | 8 | */ |
|
1630 | 8 | protected function op_number_number($op, $left, $right) |
|
1668 | 49 | ||
1669 | 49 | /** |
|
1670 | 49 | * @param $type |
|
1671 | 49 | * @param null $selectors |
|
1672 | * |
||
1673 | 49 | * @return \stdClass |
|
1674 | */ |
||
1675 | protected function makeOutputBlock($type, $selectors = null) |
||
1686 | 49 | ||
1687 | 49 | /** |
|
1688 | * @param \LesserPhp\NodeEnv $parent |
||
1689 | 49 | * @param Block|null $block |
|
1690 | * |
||
1691 | 49 | * @return \LesserPhp\NodeEnv |
|
1692 | */ |
||
1693 | protected function pushEnv($parent, Block $block = null) |
||
1704 | 40 | ||
1705 | /** |
||
1706 | * pop something off the stack |
||
1707 | * |
||
1708 | * @return \LesserPhp\NodeEnv |
||
1709 | */ |
||
1710 | protected function popEnv() |
||
1717 | |||
1718 | /** |
||
1719 | * set something in the current env |
||
1720 | * |
||
1721 | * @param $name |
||
1722 | * @param $value |
||
1723 | */ |
||
1724 | protected function set($name, $value) |
||
1728 | 28 | ||
1729 | /** |
||
1730 | * get the highest occurrence entry for a name |
||
1731 | 28 | * |
|
1732 | * @param $name |
||
1733 | 28 | * |
|
1734 | 28 | * @return array |
|
1735 | 28 | * @throws \LesserPhp\Exception\GeneralException |
|
1736 | 3 | */ |
|
1737 | protected function get($name) |
||
1792 | 1 | ||
1793 | 1 | /** |
|
1794 | 1 | * inject array of unparsed strings into environment as variables |
|
1795 | 1 | * |
|
1796 | * @param string[] $args |
||
1797 | 1 | * |
|
1798 | 1 | * @throws \LesserPhp\Exception\GeneralException |
|
1799 | 1 | */ |
|
1800 | protected function injectVariables(array $args) |
||
1817 | 49 | ||
1818 | /** |
||
1819 | 49 | * @param string $string |
|
1820 | 49 | * @param string $name |
|
1821 | * |
||
1822 | 49 | * @return string |
|
1823 | 49 | * @throws \LesserPhp\Exception\GeneralException |
|
1824 | 49 | */ |
|
1825 | public function compile($string, $name = null) |
||
1853 | |||
1854 | /** |
||
1855 | * @param string $fname |
||
1856 | 1 | * @param string $outFname |
|
1857 | * |
||
1858 | 1 | * @return int|string |
|
1859 | * @throws \LesserPhp\Exception\GeneralException |
||
1860 | 1 | */ |
|
1861 | public function compileFile($fname, $outFname = null) |
||
1885 | |||
1886 | /** |
||
1887 | 1 | * Based on explicit input/output files does a full change check on cache before compiling. |
|
1888 | * |
||
1889 | * @param string $in |
||
1890 | 1 | * @param string $out |
|
1891 | * @param boolean $force |
||
1892 | * |
||
1893 | * @return string Compiled CSS results |
||
1894 | 1 | * @throws GeneralException |
|
1895 | 1 | */ |
|
1896 | 1 | public function checkedCachedCompile($in, $out, $force = false) |
|
1924 | |||
1925 | /** |
||
1926 | * compile only if changed input has changed or output doesn't exist |
||
1927 | * |
||
1928 | * @param string $in |
||
1929 | * @param string $out |
||
1930 | * |
||
1931 | * @return bool |
||
1932 | * @throws \LesserPhp\Exception\GeneralException |
||
1933 | */ |
||
1934 | public function checkedCompile($in, $out) |
||
1944 | |||
1945 | /** |
||
1946 | * Execute lessphp on a .less file or a lessphp cache structure |
||
1947 | * |
||
1948 | * The lessphp cache structure contains information about a specific |
||
1949 | * less file having been parsed. It can be used as a hint for future |
||
1950 | * calls to determine whether or not a rebuild is required. |
||
1951 | * |
||
1952 | * The cache structure contains two important keys that may be used |
||
1953 | * externally: |
||
1954 | * |
||
1955 | * compiled: The final compiled CSS |
||
1956 | * updated: The time (in seconds) the CSS was last compiled |
||
1957 | * |
||
1958 | * The cache structure is a plain-ol' PHP associative array and can |
||
1959 | 1 | * be serialized and unserialized without a hitch. |
|
1960 | * |
||
1961 | 1 | * @param mixed $in Input |
|
1962 | 1 | * @param bool $force Force rebuild? |
|
1963 | * |
||
1964 | * @return array lessphp cache structure |
||
1965 | * @throws \LesserPhp\Exception\GeneralException |
||
1966 | */ |
||
1967 | public function cachedCompile($in, $force = false) |
||
2011 | |||
2012 | /** |
||
2013 | * parse and compile buffer |
||
2014 | 37 | * This is deprecated |
|
2015 | * |
||
2016 | * @param null $str |
||
2017 | * @param null $initialVariables |
||
2018 | * |
||
2019 | 37 | * @return int|string |
|
2020 | 37 | * @throws \LesserPhp\Exception\GeneralException |
|
2021 | 1 | * @deprecated |
|
2022 | */ |
||
2023 | public function parse($str = null, $initialVariables = null) |
||
2045 | 49 | ||
2046 | /** |
||
2047 | * @param string $name |
||
2048 | * |
||
2049 | * @return \LesserPhp\Parser |
||
2050 | */ |
||
2051 | protected function makeParser($name) |
||
2058 | 14 | ||
2059 | 14 | /** |
|
2060 | * @param string $name |
||
2061 | */ |
||
2062 | public function setFormatter($name) |
||
2066 | 49 | ||
2067 | 49 | public function setFormatterClass($formatter) |
|
2071 | 1 | ||
2072 | /** |
||
2073 | * @return \LesserPhp\Formatter\FormatterInterface |
||
2074 | 49 | */ |
|
2075 | protected function newFormatter() |
||
2089 | |||
2090 | /** |
||
2091 | * @param bool $preserve |
||
2092 | */ |
||
2093 | 1 | public function setPreserveComments($preserve) |
|
2097 | |||
2098 | /** |
||
2099 | * @param string $name |
||
2100 | * @param callable $func |
||
2101 | 1 | */ |
|
2102 | 1 | public function registerFunction($name, callable $func) |
|
2106 | |||
2107 | /** |
||
2108 | * @param string $name |
||
2109 | 1 | */ |
|
2110 | 1 | public function unregisterFunction($name) |
|
2114 | |||
2115 | /** |
||
2116 | * @param array $variables |
||
2117 | */ |
||
2118 | public function setVariables(array $variables) |
||
2122 | |||
2123 | /** |
||
2124 | * @param $name |
||
2125 | 38 | */ |
|
2126 | 38 | public function unsetVariable($name) |
|
2130 | |||
2131 | /** |
||
2132 | * @param string[] $dirs |
||
2133 | */ |
||
2134 | public function setImportDirs(array $dirs) |
||
2138 | |||
2139 | /** |
||
2140 | * @param string $dir |
||
2141 | 4 | */ |
|
2142 | public function addImportDir($dir) |
||
2146 | |||
2147 | /** |
||
2148 | * @return string[] |
||
2149 | 2 | */ |
|
2150 | 2 | public function getImportDirs() |
|
2154 | |||
2155 | /** |
||
2156 | * @param string $file |
||
2157 | */ |
||
2158 | public function addParsedFile($file) |
||
2162 | |||
2163 | /** |
||
2164 | * Uses the current value of $this->count to show line and line number |
||
2165 | * |
||
2166 | * @param string $msg |
||
2167 | * |
||
2168 | * @throws GeneralException |
||
2169 | */ |
||
2170 | public function throwError($msg = null) |
||
2177 | |||
2178 | /** |
||
2179 | * compile file $in to file $out if $in is newer than $out |
||
2180 | * returns true when it compiles, false otherwise |
||
2181 | * |
||
2182 | * @param $in |
||
2183 | * @param $out |
||
2184 | * @param \LesserPhp\Compiler|null $less |
||
2185 | * |
||
2186 | * @return bool |
||
2187 | * @throws \LesserPhp\Exception\GeneralException |
||
2188 | */ |
||
2189 | public static function ccompile($in, $out, Compiler $less = null) |
||
2197 | |||
2198 | /** |
||
2199 | * @param $in |
||
2200 | * @param bool $force |
||
2201 | * @param \LesserPhp\Compiler|null $less |
||
2202 | * |
||
2203 | * @return array |
||
2204 | * @throws \LesserPhp\Exception\GeneralException |
||
2205 | */ |
||
2206 | public static function cexecute($in, $force = false, Compiler $less = null) |
||
2214 | |||
2215 | /** |
||
2216 | * Import Css |
||
2217 | * |
||
2218 | * Set allowing importing (and not compiling) |
||
2219 | * |
||
2220 | * @param bool $true (optional) Default, allow CSS. |
||
2221 | 46 | * |
|
2222 | * @return void |
||
2223 | * |
||
2224 | * @access public |
||
2225 | * |
||
2226 | * @author Michael Mulligan <[email protected]> |
||
2227 | */ |
||
2228 | public function importCss($true = null) |
||
2236 | |||
2237 | /** |
||
2238 | * prefix of abstract properties |
||
2239 | * |
||
2240 | * @return string |
||
2241 | */ |
||
2242 | public function getVPrefix() |
||
2246 | |||
2247 | /** |
||
2248 | * prefix of abstract blocks |
||
2249 | * |
||
2250 | 1 | * @return string |
|
2251 | 1 | */ |
|
2252 | public function getMPrefix() |
||
2256 | |||
2257 | /** |
||
2258 | 3 | * @return string |
|
2259 | */ |
||
2260 | 1 | public function getParentSelector() |
|
2264 | |||
2265 | /** |
||
2266 | * @param int $numberPresicion |
||
2267 | */ |
||
2268 | protected function setNumberPrecision($numberPresicion = null) |
||
2272 | |||
2273 | /** |
||
2274 | * @return \LesserPhp\Library\Coerce |
||
2275 | */ |
||
2276 | protected function getCoerce() |
||
2280 | |||
2281 | public function setImportDisabled() |
||
2285 | |||
2286 | /** |
||
2287 | * @return bool |
||
2288 | */ |
||
2289 | public function isImportDisabled() |
||
2293 | } |
||
2294 |