@@ -130,6 +130,10 @@ discard block |
||
130 | 130 | } |
131 | 131 | |
132 | 132 | // attempts to find the path of an import url, returns null for css files |
133 | + |
|
134 | + /** |
|
135 | + * @param string $url |
|
136 | + */ |
|
133 | 137 | protected function findImport($url) |
134 | 138 | { |
135 | 139 | foreach ((array)$this->importDir as $dir) { |
@@ -142,6 +146,9 @@ discard block |
||
142 | 146 | return null; |
143 | 147 | } |
144 | 148 | |
149 | + /** |
|
150 | + * @param string $name |
|
151 | + */ |
|
145 | 152 | protected function fileExists($name) |
146 | 153 | { |
147 | 154 | return is_file($name); |
@@ -345,6 +352,9 @@ discard block |
||
345 | 352 | return $scope; |
346 | 353 | } |
347 | 354 | |
355 | + /** |
|
356 | + * @param string[] $selectors |
|
357 | + */ |
|
348 | 358 | protected function compileNestedBlock($block, $selectors) |
349 | 359 | { |
350 | 360 | $this->pushEnv($this->env, $block); |
@@ -365,6 +375,9 @@ discard block |
||
365 | 375 | $this->popEnv(); |
366 | 376 | } |
367 | 377 | |
378 | + /** |
|
379 | + * @param \stdClass $out |
|
380 | + */ |
|
368 | 381 | protected function compileProps($block, $out) |
369 | 382 | { |
370 | 383 | foreach ($this->sortProps($block->props) as $prop) { |
@@ -1102,6 +1115,11 @@ discard block |
||
1102 | 1115 | return $out; |
1103 | 1116 | } |
1104 | 1117 | |
1118 | + /** |
|
1119 | + * @param double $comp |
|
1120 | + * @param double $temp1 |
|
1121 | + * @param double $temp2 |
|
1122 | + */ |
|
1105 | 1123 | protected function toRGB_helper($comp, $temp1, $temp2) |
1106 | 1124 | { |
1107 | 1125 | if ($comp < 0) { |
@@ -1405,6 +1423,9 @@ discard block |
||
1405 | 1423 | return $value; |
1406 | 1424 | } |
1407 | 1425 | |
1426 | + /** |
|
1427 | + * @param boolean $a |
|
1428 | + */ |
|
1408 | 1429 | public function toBool($a) |
1409 | 1430 | { |
1410 | 1431 | if ($a) { |
@@ -1621,6 +1642,10 @@ discard block |
||
1621 | 1642 | } |
1622 | 1643 | |
1623 | 1644 | // the state of execution |
1645 | + |
|
1646 | + /** |
|
1647 | + * @param NodeEnv $parent |
|
1648 | + */ |
|
1624 | 1649 | protected function pushEnv($parent, $block = null) |
1625 | 1650 | { |
1626 | 1651 | $e = new \LesserPhp\NodeEnv(); |
@@ -1932,6 +1957,9 @@ discard block |
||
1932 | 1957 | return $out; |
1933 | 1958 | } |
1934 | 1959 | |
1960 | + /** |
|
1961 | + * @param string|null $name |
|
1962 | + */ |
|
1935 | 1963 | protected function makeParser($name) |
1936 | 1964 | { |
1937 | 1965 | $parser = new \LesserPhp\Parser($this, $name); |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | // attempts to find the path of an import url, returns null for css files |
133 | 133 | protected function findImport($url) |
134 | 134 | { |
135 | - foreach ((array)$this->importDir as $dir) { |
|
135 | + foreach ((array) $this->importDir as $dir) { |
|
136 | 136 | $full = $dir . (substr($dir, -1) !== '/' ? '/' : '') . $url; |
137 | 137 | if ($this->fileExists($file = $full . '.less') || $this->fileExists($file = $full)) { |
138 | 138 | return $file; |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | $oldImport = $this->importDir; |
235 | 235 | |
236 | 236 | // TODO: this is because the importDir api is stupid |
237 | - $this->importDir = (array)$this->importDir; |
|
237 | + $this->importDir = (array) $this->importDir; |
|
238 | 238 | array_unshift($this->importDir, $importDir); |
239 | 239 | |
240 | 240 | foreach ($props as $prop) { |
@@ -830,7 +830,7 @@ discard block |
||
830 | 830 | |
831 | 831 | $orderedArgs = []; |
832 | 832 | $keywordArgs = []; |
833 | - foreach ((array)$args as $arg) { |
|
833 | + foreach ((array) $args as $arg) { |
|
834 | 834 | switch ($arg[0]) { |
835 | 835 | case "arg": |
836 | 836 | if (!isset($arg[2])) { |
@@ -927,8 +927,7 @@ discard block |
||
927 | 927 | $result = $this->tryImport($importPath, $block, $out); |
928 | 928 | |
929 | 929 | $this->env->addImports($importId, $result === false ? |
930 | - [false, "@import " . $this->compileValue($importPath) . ";"] : |
|
931 | - $result); |
|
930 | + [false, "@import " . $this->compileValue($importPath) . ";"] : $result); |
|
932 | 931 | |
933 | 932 | break; |
934 | 933 | case "import_mixin": |
@@ -1050,7 +1049,7 @@ discard block |
||
1050 | 1049 | } |
1051 | 1050 | list($color, $delta) = $args[2]; |
1052 | 1051 | $color = $this->assertions->assertColor($color); |
1053 | - $delta = (float)$delta[1]; |
|
1052 | + $delta = (float) $delta[1]; |
|
1054 | 1053 | |
1055 | 1054 | return [$color, $delta]; |
1056 | 1055 | } |
@@ -1145,8 +1144,7 @@ discard block |
||
1145 | 1144 | $r = $g = $b = $L; |
1146 | 1145 | } else { |
1147 | 1146 | $temp2 = $L < 0.5 ? |
1148 | - $L * (1.0 + $S) : |
|
1149 | - $L + $S - $L * $S; |
|
1147 | + $L * (1.0 + $S) : $L + $S - $L * $S; |
|
1150 | 1148 | |
1151 | 1149 | $temp1 = 2.0 * $L - $temp2; |
1152 | 1150 | |
@@ -1191,7 +1189,7 @@ discard block |
||
1191 | 1189 | $i = 0; |
1192 | 1190 | foreach ($rawComponents as $c) { |
1193 | 1191 | $val = $this->reduce($c); |
1194 | - $val = isset($val[1]) ? (float)$val[1] : 0; |
|
1192 | + $val = isset($val[1]) ? (float) $val[1] : 0; |
|
1195 | 1193 | |
1196 | 1194 | if ($i === 0) { |
1197 | 1195 | $clamp = 360; |
@@ -1220,13 +1218,13 @@ discard block |
||
1220 | 1218 | if ($c[0] === "number" && $c[2] === "%") { |
1221 | 1219 | $components[] = 255 * ($c[1] / 100); |
1222 | 1220 | } else { |
1223 | - $components[] = (float)$c[1]; |
|
1221 | + $components[] = (float) $c[1]; |
|
1224 | 1222 | } |
1225 | 1223 | } elseif ($i === 4) { |
1226 | 1224 | if ($c[0] === "number" && $c[2] === "%") { |
1227 | 1225 | $components[] = 1.0 * ($c[1] / 100); |
1228 | 1226 | } else { |
1229 | - $components[] = (float)$c[1]; |
|
1227 | + $components[] = (float) $c[1]; |
|
1230 | 1228 | } |
1231 | 1229 | } else { |
1232 | 1230 | break; |
@@ -1269,7 +1267,7 @@ discard block |
||
1269 | 1267 | $key = $this->vPrefix . $this->compileValue($this->functions->e($key)); |
1270 | 1268 | } |
1271 | 1269 | |
1272 | - $seen =& $this->env->seenNames; |
|
1270 | + $seen = & $this->env->seenNames; |
|
1273 | 1271 | |
1274 | 1272 | if (!empty($seen[$key])) { |
1275 | 1273 | $this->throwError("infinite loop detected: $key"); |
@@ -1716,7 +1714,7 @@ discard block |
||
1716 | 1714 | $name = '@' . $name; |
1717 | 1715 | } |
1718 | 1716 | $parser->count = 0; |
1719 | - $parser->buffer = (string)$strValue; |
|
1717 | + $parser->buffer = (string) $strValue; |
|
1720 | 1718 | if (!$parser->propertyValue($value)) { |
1721 | 1719 | throw new GeneralException("failed to parse passed in variable $name: $strValue"); |
1722 | 1720 | } |
@@ -1770,7 +1768,7 @@ discard block |
||
1770 | 1768 | |
1771 | 1769 | $oldImport = $this->importDir; |
1772 | 1770 | |
1773 | - $this->importDir = (array)$this->importDir; |
|
1771 | + $this->importDir = (array) $this->importDir; |
|
1774 | 1772 | $this->importDir[] = $pi['dirname'] . '/'; |
1775 | 1773 | |
1776 | 1774 | $this->addParsedFile($fname); |
@@ -1990,12 +1988,12 @@ discard block |
||
1990 | 1988 | |
1991 | 1989 | public function setImportDir($dirs) |
1992 | 1990 | { |
1993 | - $this->importDir = (array)$dirs; |
|
1991 | + $this->importDir = (array) $dirs; |
|
1994 | 1992 | } |
1995 | 1993 | |
1996 | 1994 | public function addImportDir($dir) |
1997 | 1995 | { |
1998 | - $this->importDir = (array)$this->importDir; |
|
1996 | + $this->importDir = (array) $this->importDir; |
|
1999 | 1997 | $this->importDir[] = $dir; |
2000 | 1998 | } |
2001 | 1999 |
@@ -726,6 +726,9 @@ |
||
726 | 726 | return null; |
727 | 727 | } |
728 | 728 | |
729 | + /** |
|
730 | + * @param string $name |
|
731 | + */ |
|
729 | 732 | public function fileExists($name) |
730 | 733 | { |
731 | 734 | return is_file($name); |
@@ -716,7 +716,7 @@ |
||
716 | 716 | // attempts to find the path of an import url, returns null for css files |
717 | 717 | public function findImport($url) |
718 | 718 | { |
719 | - foreach ((array)$this->compiler->importDir as $dir) { |
|
719 | + foreach ((array) $this->compiler->importDir as $dir) { |
|
720 | 720 | $full = $dir . (substr($dir, -1) !== '/' ? '/' : '') . $url; |
721 | 721 | if ($this->fileExists($file = $full . '.less') || $this->fileExists($file = $full)) { |
722 | 722 | return $file; |
@@ -114,6 +114,9 @@ discard block |
||
114 | 114 | } |
115 | 115 | } |
116 | 116 | |
117 | + /** |
|
118 | + * @param string $buffer |
|
119 | + */ |
|
117 | 120 | public function parse($buffer) |
118 | 121 | { |
119 | 122 | $this->count = 0; |
@@ -478,6 +481,7 @@ discard block |
||
478 | 481 | |
479 | 482 | /** |
480 | 483 | * recursively parse infix equation with $lhs at precedence $minP |
484 | + * @param integer $minP |
|
481 | 485 | */ |
482 | 486 | protected function expHelper($lhs, $minP) |
483 | 487 | { |
@@ -770,6 +774,11 @@ discard block |
||
770 | 774 | } |
771 | 775 | |
772 | 776 | // an unbounded string stopped by $end |
777 | + |
|
778 | + /** |
|
779 | + * @param string $end |
|
780 | + * @param string[] $rejectStrs |
|
781 | + */ |
|
773 | 782 | protected function openString($end, &$out, $nestingOpen = null, $rejectStrs = null) |
774 | 783 | { |
775 | 784 | $oldWhite = $this->eatWhiteDefault; |
@@ -1424,6 +1433,9 @@ discard block |
||
1424 | 1433 | |
1425 | 1434 | /* raw parsing functions */ |
1426 | 1435 | |
1436 | + /** |
|
1437 | + * @param boolean $eatWhitespace |
|
1438 | + */ |
|
1427 | 1439 | protected function literal($what, $eatWhitespace = null) |
1428 | 1440 | { |
1429 | 1441 | if ($eatWhitespace === null) { |
@@ -1451,6 +1463,9 @@ discard block |
||
1451 | 1463 | return $this->match(self::$literalCache[$what], $m, $eatWhitespace); |
1452 | 1464 | } |
1453 | 1465 | |
1466 | + /** |
|
1467 | + * @param string $parseItem |
|
1468 | + */ |
|
1454 | 1469 | protected function genericList(&$out, $parseItem, $delim = "", $flatten = true) |
1455 | 1470 | { |
1456 | 1471 | $s = $this->seek(); |
@@ -1544,6 +1559,10 @@ discard block |
||
1544 | 1559 | } |
1545 | 1560 | |
1546 | 1561 | // match something without consuming it |
1562 | + |
|
1563 | + /** |
|
1564 | + * @param string $regex |
|
1565 | + */ |
|
1547 | 1566 | protected function peek($regex, &$out = null, $from = null) |
1548 | 1567 | { |
1549 | 1568 | if ($from === null) { |
@@ -1616,6 +1635,10 @@ discard block |
||
1616 | 1635 | } |
1617 | 1636 | |
1618 | 1637 | // push a block that doesn't multiply tags |
1638 | + |
|
1639 | + /** |
|
1640 | + * @param string $type |
|
1641 | + */ |
|
1619 | 1642 | protected function pushSpecialBlock($type) |
1620 | 1643 | { |
1621 | 1644 | return $this->pushBlock(null, $type); |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require __DIR__.'/vendor/autoload.php'; |
|
3 | +require __DIR__ . '/vendor/autoload.php'; |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * lesserphp |