@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package Less |
7 | 7 | * @subpackage exception |
8 | 8 | */ |
9 | -class Less_Exception_Parser extends Exception{ |
|
9 | +class Less_Exception_Parser extends Exception { |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * The current file |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | * @param Less_FileInfo|string $currentFile The file |
37 | 37 | * @param integer $code The exception code |
38 | 38 | */ |
39 | - public function __construct($message = null, Exception $previous = null, $index = null, $currentFile = null, $code = 0){ |
|
39 | + public function __construct($message = null, Exception $previous = null, $index = null, $currentFile = null, $code = 0) { |
|
40 | 40 | |
41 | - if (PHP_VERSION_ID < 50300) { |
|
41 | + if (PHP_VERSION_ID<50300) { |
|
42 | 42 | $this->previous = $previous; |
43 | 43 | parent::__construct($message, $code); |
44 | - } else { |
|
44 | + }else { |
|
45 | 45 | parent::__construct($message, $code, $previous); |
46 | 46 | } |
47 | 47 | |
@@ -52,10 +52,10 @@ discard block |
||
52 | 52 | } |
53 | 53 | |
54 | 54 | |
55 | - protected function getInput(){ |
|
55 | + protected function getInput() { |
|
56 | 56 | |
57 | - if( !$this->input && $this->currentFile && $this->currentFile['filename'] ){ |
|
58 | - $this->input = file_get_contents( $this->currentFile['filename'] ); |
|
57 | + if (!$this->input && $this->currentFile && $this->currentFile['filename']) { |
|
58 | + $this->input = file_get_contents($this->currentFile['filename']); |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | |
@@ -66,26 +66,26 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @return string |
68 | 68 | */ |
69 | - public function genMessage(){ |
|
69 | + public function genMessage() { |
|
70 | 70 | |
71 | - if( $this->currentFile && $this->currentFile['filename'] ){ |
|
71 | + if ($this->currentFile && $this->currentFile['filename']) { |
|
72 | 72 | $this->message .= ' in '.basename($this->currentFile['filename']); |
73 | 73 | } |
74 | 74 | |
75 | - if( $this->index !== null ){ |
|
75 | + if ($this->index!==null) { |
|
76 | 76 | $this->getInput(); |
77 | - if( $this->input ){ |
|
77 | + if ($this->input) { |
|
78 | 78 | $line = self::getLineNumber(); |
79 | 79 | $this->message .= ' on line '.$line.', column '.self::getColumn(); |
80 | 80 | |
81 | - $lines = explode("\n",$this->input); |
|
81 | + $lines = explode("\n", $this->input); |
|
82 | 82 | |
83 | 83 | $count = count($lines); |
84 | 84 | $start_line = max(0, $line-3); |
85 | 85 | $last_line = min($count, $start_line+6); |
86 | 86 | $num_len = strlen($last_line); |
87 | - for( $i = $start_line; $i < $last_line; $i++ ){ |
|
88 | - $this->message .= "\n".str_pad($i+1,$num_len,'0',STR_PAD_LEFT).'| '.$lines[$i]; |
|
87 | + for ($i = $start_line; $i<$last_line; $i++) { |
|
88 | + $this->message .= "\n".str_pad($i+1, $num_len, '0', STR_PAD_LEFT).'| '.$lines[$i]; |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | } |
@@ -97,13 +97,13 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @return integer |
99 | 99 | */ |
100 | - public function getLineNumber(){ |
|
101 | - if( $this->index ){ |
|
100 | + public function getLineNumber() { |
|
101 | + if ($this->index) { |
|
102 | 102 | // https://bugs.php.net/bug.php?id=49790 |
103 | 103 | if (ini_get("mbstring.func_overload")) { |
104 | - return substr_count(substr($this->input, 0, $this->index), "\n") + 1; |
|
105 | - } else { |
|
106 | - return substr_count($this->input, "\n", 0, $this->index) + 1; |
|
104 | + return substr_count(substr($this->input, 0, $this->index), "\n")+1; |
|
105 | + }else { |
|
106 | + return substr_count($this->input, "\n", 0, $this->index)+1; |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | return 1; |
@@ -115,11 +115,11 @@ discard block |
||
115 | 115 | * |
116 | 116 | * @return integer |
117 | 117 | */ |
118 | - public function getColumn(){ |
|
118 | + public function getColumn() { |
|
119 | 119 | |
120 | 120 | $part = substr($this->input, 0, $this->index); |
121 | - $pos = strrpos($part,"\n"); |
|
122 | - return $this->index - $pos; |
|
121 | + $pos = strrpos($part, "\n"); |
|
122 | + return $this->index-$pos; |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | } |
@@ -11,18 +11,18 @@ |
||
11 | 11 | // this map is intentionally incomplete |
12 | 12 | // if you want more, install 'mime' dep |
13 | 13 | static $_types = array( |
14 | - '.htm' => 'text/html', |
|
15 | - '.html'=> 'text/html', |
|
16 | - '.gif' => 'image/gif', |
|
17 | - '.jpg' => 'image/jpeg', |
|
18 | - '.jpeg'=> 'image/jpeg', |
|
19 | - '.png' => 'image/png', |
|
20 | - '.ttf' => 'application/x-font-ttf', |
|
21 | - '.otf' => 'application/x-font-otf', |
|
22 | - '.eot' => 'application/vnd.ms-fontobject', |
|
23 | - '.woff' => 'application/x-font-woff', |
|
24 | - '.svg' => 'image/svg+xml', |
|
25 | - ); |
|
14 | + '.htm' => 'text/html', |
|
15 | + '.html'=> 'text/html', |
|
16 | + '.gif' => 'image/gif', |
|
17 | + '.jpg' => 'image/jpeg', |
|
18 | + '.jpeg'=> 'image/jpeg', |
|
19 | + '.png' => 'image/png', |
|
20 | + '.ttf' => 'application/x-font-ttf', |
|
21 | + '.otf' => 'application/x-font-otf', |
|
22 | + '.eot' => 'application/vnd.ms-fontobject', |
|
23 | + '.woff' => 'application/x-font-woff', |
|
24 | + '.svg' => 'image/svg+xml', |
|
25 | + ); |
|
26 | 26 | |
27 | 27 | public static function lookup( $filepath ){ |
28 | 28 | $parts = explode('.',$filepath); |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package Less |
7 | 7 | * @subpackage node |
8 | 8 | */ |
9 | -class Less_Mime{ |
|
9 | +class Less_Mime { |
|
10 | 10 | |
11 | 11 | // this map is intentionally incomplete |
12 | 12 | // if you want more, install 'mime' dep |
@@ -24,18 +24,18 @@ discard block |
||
24 | 24 | '.svg' => 'image/svg+xml', |
25 | 25 | ); |
26 | 26 | |
27 | - public static function lookup( $filepath ){ |
|
28 | - $parts = explode('.',$filepath); |
|
27 | + public static function lookup($filepath) { |
|
28 | + $parts = explode('.', $filepath); |
|
29 | 29 | $ext = '.'.strtolower(array_pop($parts)); |
30 | 30 | |
31 | - if( !isset(self::$_types[$ext]) ){ |
|
31 | + if (!isset(self::$_types[$ext])) { |
|
32 | 32 | return null; |
33 | 33 | } |
34 | 34 | return self::$_types[$ext]; |
35 | 35 | } |
36 | 36 | |
37 | - public static function charsets_lookup( $type = null ){ |
|
37 | + public static function charsets_lookup($type = null) { |
|
38 | 38 | // assumes all text types are UTF-8 |
39 | - return $type && preg_match('/^text\//',$type) ? 'UTF-8' : ''; |
|
39 | + return $type && preg_match('/^text\//', $type) ? 'UTF-8' : ''; |
|
40 | 40 | } |
41 | 41 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package Less |
7 | 7 | * @subpackage output |
8 | 8 | */ |
9 | -class Less_Output{ |
|
9 | +class Less_Output { |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * Output holder |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @param integer $index The index |
24 | 24 | * @param mixed $mapLines |
25 | 25 | */ |
26 | - public function add($chunk, $fileInfo = null, $index = 0, $mapLines = null){ |
|
26 | + public function add($chunk, $fileInfo = null, $index = 0, $mapLines = null) { |
|
27 | 27 | $this->strs[] = $chunk; |
28 | 28 | } |
29 | 29 | |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @return boolean |
34 | 34 | */ |
35 | - public function isEmpty(){ |
|
36 | - return count($this->strs) === 0; |
|
35 | + public function isEmpty() { |
|
36 | + return count($this->strs)===0; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @return string |
44 | 44 | */ |
45 | - public function toString(){ |
|
46 | - return implode('',$this->strs); |
|
45 | + public function toString() { |
|
46 | + return implode('', $this->strs); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | } |
50 | 50 | \ No newline at end of file |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @param array $contentsMap Array of filename to contents map |
43 | 43 | * @param Less_SourceMap_Generator $generator |
44 | 44 | */ |
45 | - public function __construct(array $contentsMap, $generator){ |
|
45 | + public function __construct(array $contentsMap, $generator) { |
|
46 | 46 | $this->contentsMap = $contentsMap; |
47 | 47 | $this->generator = $generator; |
48 | 48 | } |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | * @param integer $index |
57 | 57 | * @param mixed $mapLines |
58 | 58 | */ |
59 | - public function add($chunk, $fileInfo = null, $index = 0, $mapLines = null){ |
|
59 | + public function add($chunk, $fileInfo = null, $index = 0, $mapLines = null) { |
|
60 | 60 | |
61 | 61 | //ignore adding empty strings |
62 | - if( $chunk === '' ){ |
|
62 | + if ($chunk==='') { |
|
63 | 63 | return; |
64 | 64 | } |
65 | 65 | |
@@ -68,15 +68,15 @@ discard block |
||
68 | 68 | $sourceColumns = ' '; |
69 | 69 | |
70 | 70 | |
71 | - if( $fileInfo ){ |
|
71 | + if ($fileInfo) { |
|
72 | 72 | |
73 | 73 | $url = $fileInfo['currentUri']; |
74 | 74 | |
75 | - if( isset($this->contentsMap[$url]) ){ |
|
75 | + if (isset($this->contentsMap[$url])) { |
|
76 | 76 | $inputSource = substr($this->contentsMap[$url], 0, $index); |
77 | 77 | $sourceLines = explode("\n", $inputSource); |
78 | 78 | $sourceColumns = end($sourceLines); |
79 | - }else{ |
|
79 | + }else { |
|
80 | 80 | throw new Exception('Filename '.$url.' not in contentsMap'); |
81 | 81 | } |
82 | 82 | |
@@ -85,33 +85,33 @@ discard block |
||
85 | 85 | $lines = explode("\n", $chunk); |
86 | 86 | $columns = end($lines); |
87 | 87 | |
88 | - if($fileInfo){ |
|
88 | + if ($fileInfo) { |
|
89 | 89 | |
90 | - if(!$mapLines){ |
|
90 | + if (!$mapLines) { |
|
91 | 91 | $this->generator->addMapping( |
92 | - $this->lineNumber + 1, // generated_line |
|
93 | - $this->column, // generated_column |
|
94 | - count($sourceLines), // original_line |
|
95 | - strlen($sourceColumns), // original_column |
|
92 | + $this->lineNumber+1, // generated_line |
|
93 | + $this->column, // generated_column |
|
94 | + count($sourceLines), // original_line |
|
95 | + strlen($sourceColumns), // original_column |
|
96 | 96 | $fileInfo |
97 | 97 | ); |
98 | - }else{ |
|
99 | - for($i = 0, $count = count($lines); $i < $count; $i++){ |
|
98 | + }else { |
|
99 | + for ($i = 0, $count = count($lines); $i<$count; $i++) { |
|
100 | 100 | $this->generator->addMapping( |
101 | - $this->lineNumber + $i + 1, // generated_line |
|
102 | - $i === 0 ? $this->column : 0, // generated_column |
|
103 | - count($sourceLines) + $i, // original_line |
|
104 | - $i === 0 ? strlen($sourceColumns) : 0, // original_column |
|
101 | + $this->lineNumber+$i+1, // generated_line |
|
102 | + $i===0 ? $this->column : 0, // generated_column |
|
103 | + count($sourceLines)+$i, // original_line |
|
104 | + $i===0 ? strlen($sourceColumns) : 0, // original_column |
|
105 | 105 | $fileInfo |
106 | 106 | ); |
107 | 107 | } |
108 | 108 | } |
109 | 109 | } |
110 | 110 | |
111 | - if(count($lines) === 1){ |
|
111 | + if (count($lines)===1) { |
|
112 | 112 | $this->column += strlen($columns); |
113 | - }else{ |
|
114 | - $this->lineNumber += count($lines) - 1; |
|
113 | + }else { |
|
114 | + $this->lineNumber += count($lines)-1; |
|
115 | 115 | $this->column = strlen($columns); |
116 | 116 | } |
117 | 117 |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $inputSource = substr($this->contentsMap[$url], 0, $index); |
77 | 77 | $sourceLines = explode("\n", $inputSource); |
78 | 78 | $sourceColumns = end($sourceLines); |
79 | - }else{ |
|
79 | + } else{ |
|
80 | 80 | throw new Exception('Filename '.$url.' not in contentsMap'); |
81 | 81 | } |
82 | 82 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | strlen($sourceColumns), // original_column |
96 | 96 | $fileInfo |
97 | 97 | ); |
98 | - }else{ |
|
98 | + } else{ |
|
99 | 99 | for($i = 0, $count = count($lines); $i < $count; $i++){ |
100 | 100 | $this->generator->addMapping( |
101 | 101 | $this->lineNumber + $i + 1, // generated_line |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | if(count($lines) === 1){ |
112 | 112 | $this->column += strlen($columns); |
113 | - }else{ |
|
113 | + } else{ |
|
114 | 114 | $this->lineNumber += count($lines) - 1; |
115 | 115 | $this->column = strlen($columns); |
116 | 116 | } |
@@ -36,14 +36,14 @@ discard block |
||
36 | 36 | */ |
37 | 37 | private $charToIntMap = array( |
38 | 38 | 'A' => 0, 'B' => 1, 'C' => 2, 'D' => 3, 'E' => 4, 'F' => 5, 'G' => 6, |
39 | - 'H' => 7,'I' => 8, 'J' => 9, 'K' => 10, 'L' => 11, 'M' => 12, 'N' => 13, |
|
39 | + 'H' => 7, 'I' => 8, 'J' => 9, 'K' => 10, 'L' => 11, 'M' => 12, 'N' => 13, |
|
40 | 40 | 'O' => 14, 'P' => 15, 'Q' => 16, 'R' => 17, 'S' => 18, 'T' => 19, 'U' => 20, |
41 | 41 | 'V' => 21, 'W' => 22, 'X' => 23, 'Y' => 24, 'Z' => 25, 'a' => 26, 'b' => 27, |
42 | 42 | 'c' => 28, 'd' => 29, 'e' => 30, 'f' => 31, 'g' => 32, 'h' => 33, 'i' => 34, |
43 | 43 | 'j' => 35, 'k' => 36, 'l' => 37, 'm' => 38, 'n' => 39, 'o' => 40, 'p' => 41, |
44 | 44 | 'q' => 42, 'r' => 43, 's' => 44, 't' => 45, 'u' => 46, 'v' => 47, 'w' => 48, |
45 | 45 | 'x' => 49, 'y' => 50, 'z' => 51, 0 => 52, 1 => 53, 2 => 54, 3 => 55, 4 => 56, |
46 | - 5 => 57, 6 => 58, 7 => 59, 8 => 60, 9 => 61, '+' => 62, '/' => 63, |
|
46 | + 5 => 57, 6 => 58, 7 => 59, 8 => 60, 9 => 61, '+' => 62, '/' => 63, |
|
47 | 47 | ); |
48 | 48 | |
49 | 49 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | /** |
68 | 68 | * Constructor |
69 | 69 | */ |
70 | - public function __construct(){ |
|
70 | + public function __construct() { |
|
71 | 71 | // I leave it here for future reference |
72 | 72 | // foreach(str_split('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/') as $i => $char) |
73 | 73 | // { |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | * even on a 64 bit machine. |
86 | 86 | * @param string $aValue |
87 | 87 | */ |
88 | - public function toVLQSigned($aValue){ |
|
89 | - return 0xffffffff & ($aValue < 0 ? ((-$aValue) << 1) + 1 : ($aValue << 1) + 0); |
|
88 | + public function toVLQSigned($aValue) { |
|
89 | + return 0xffffffff&($aValue<0 ? ((-$aValue) << 1)+1 : ($aValue << 1)+0); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | * even on a 64 bit machine. |
101 | 101 | * @param integer $aValue |
102 | 102 | */ |
103 | - public function fromVLQSigned($aValue){ |
|
104 | - return $aValue & 1 ? $this->zeroFill(~$aValue + 2, 1) | (-1 - 0x7fffffff) : $this->zeroFill($aValue, 1); |
|
103 | + public function fromVLQSigned($aValue) { |
|
104 | + return $aValue&1 ? $this->zeroFill(~$aValue+2, 1)|(-1-0x7fffffff) : $this->zeroFill($aValue, 1); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -110,18 +110,18 @@ discard block |
||
110 | 110 | * @param string $aValue The value to encode |
111 | 111 | * @return string The encoded value |
112 | 112 | */ |
113 | - public function encode($aValue){ |
|
113 | + public function encode($aValue) { |
|
114 | 114 | $encoded = ''; |
115 | 115 | $vlq = $this->toVLQSigned($aValue); |
116 | 116 | do |
117 | 117 | { |
118 | - $digit = $vlq & $this->mask; |
|
118 | + $digit = $vlq&$this->mask; |
|
119 | 119 | $vlq = $this->zeroFill($vlq, $this->shift); |
120 | - if($vlq > 0){ |
|
120 | + if ($vlq>0) { |
|
121 | 121 | $digit |= $this->continuationBit; |
122 | 122 | } |
123 | 123 | $encoded .= $this->base64Encode($digit); |
124 | - } while($vlq > 0); |
|
124 | + } while ($vlq>0); |
|
125 | 125 | |
126 | 126 | return $encoded; |
127 | 127 | } |
@@ -132,15 +132,15 @@ discard block |
||
132 | 132 | * @param string $encoded The encoded value to decode |
133 | 133 | * @return integer The decoded value |
134 | 134 | */ |
135 | - public function decode($encoded){ |
|
135 | + public function decode($encoded) { |
|
136 | 136 | $vlq = 0; |
137 | 137 | $i = 0; |
138 | 138 | do |
139 | 139 | { |
140 | 140 | $digit = $this->base64Decode($encoded[$i]); |
141 | - $vlq |= ($digit & $this->mask) << ($i * $this->shift); |
|
141 | + $vlq |= ($digit&$this->mask) << ($i * $this->shift); |
|
142 | 142 | $i++; |
143 | - } while($digit & $this->continuationBit); |
|
143 | + } while ($digit&$this->continuationBit); |
|
144 | 144 | |
145 | 145 | return $this->fromVLQSigned($vlq); |
146 | 146 | } |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | * @param integer $b number of bits to shift |
153 | 153 | * @return integer |
154 | 154 | */ |
155 | - public function zeroFill($a, $b){ |
|
156 | - return ($a >= 0) ? ($a >> $b) : ($a >> $b) & (PHP_INT_MAX >> ($b - 1)); |
|
155 | + public function zeroFill($a, $b) { |
|
156 | + return ($a>=0) ? ($a >> $b) : ($a >> $b)&(PHP_INT_MAX >> ($b-1)); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | /** |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | * @return string |
164 | 164 | * @throws Exception If the number is invalid |
165 | 165 | */ |
166 | - public function base64Encode($number){ |
|
167 | - if($number < 0 || $number > 63){ |
|
166 | + public function base64Encode($number) { |
|
167 | + if ($number<0 || $number>63) { |
|
168 | 168 | throw new Exception(sprintf('Invalid number "%s" given. Must be between 0 and 63.', $number)); |
169 | 169 | } |
170 | 170 | return $this->intToCharMap[$number]; |
@@ -177,8 +177,8 @@ discard block |
||
177 | 177 | * @return number |
178 | 178 | * @throws Exception If the number is invalid |
179 | 179 | */ |
180 | - public function base64Decode($char){ |
|
181 | - if(!array_key_exists($char, $this->charToIntMap)){ |
|
180 | + public function base64Decode($char) { |
|
181 | + if (!array_key_exists($char, $this->charToIntMap)) { |
|
182 | 182 | throw new Exception(sprintf('Invalid base 64 digit "%s" given.', $char)); |
183 | 183 | } |
184 | 184 | return $this->charToIntMap[$char]; |
@@ -17,13 +17,13 @@ |
||
17 | 17 | } |
18 | 18 | |
19 | 19 | |
20 | - /** |
|
21 | - * Generate CSS by adding it to the output object |
|
22 | - * |
|
23 | - * @param Less_Output $output The output |
|
24 | - * @return void |
|
25 | - */ |
|
26 | - public function genCSS($output){} |
|
20 | + /** |
|
21 | + * Generate CSS by adding it to the output object |
|
22 | + * |
|
23 | + * @param Less_Output $output The output |
|
24 | + * @return void |
|
25 | + */ |
|
26 | + public function genCSS($output){} |
|
27 | 27 | |
28 | 28 | |
29 | 29 | /** |
@@ -6,11 +6,11 @@ discard block |
||
6 | 6 | * @package Less |
7 | 7 | * @subpackage tree |
8 | 8 | */ |
9 | -class Less_Tree{ |
|
9 | +class Less_Tree { |
|
10 | 10 | |
11 | 11 | public $cache_string; |
12 | 12 | |
13 | - public function toCSS(){ |
|
13 | + public function toCSS() { |
|
14 | 14 | $output = new Less_Output(); |
15 | 15 | $this->genCSS($output); |
16 | 16 | return $output->toString(); |
@@ -23,51 +23,51 @@ discard block |
||
23 | 23 | * @param Less_Output $output The output |
24 | 24 | * @return void |
25 | 25 | */ |
26 | - public function genCSS($output){} |
|
26 | + public function genCSS($output) {} |
|
27 | 27 | |
28 | 28 | |
29 | 29 | /** |
30 | 30 | * @param Less_Tree_Ruleset[] $rules |
31 | 31 | */ |
32 | - public static function outputRuleset( $output, $rules ){ |
|
32 | + public static function outputRuleset($output, $rules) { |
|
33 | 33 | |
34 | 34 | $ruleCnt = count($rules); |
35 | 35 | Less_Environment::$tabLevel++; |
36 | 36 | |
37 | 37 | |
38 | 38 | // Compressed |
39 | - if( Less_Parser::$options['compress'] ){ |
|
39 | + if (Less_Parser::$options['compress']) { |
|
40 | 40 | $output->add('{'); |
41 | - for( $i = 0; $i < $ruleCnt; $i++ ){ |
|
42 | - $rules[$i]->genCSS( $output ); |
|
41 | + for ($i = 0; $i<$ruleCnt; $i++) { |
|
42 | + $rules[$i]->genCSS($output); |
|
43 | 43 | } |
44 | 44 | |
45 | - $output->add( '}' ); |
|
45 | + $output->add('}'); |
|
46 | 46 | Less_Environment::$tabLevel--; |
47 | 47 | return; |
48 | 48 | } |
49 | 49 | |
50 | 50 | |
51 | 51 | // Non-compressed |
52 | - $tabSetStr = "\n".str_repeat( ' ' , Less_Environment::$tabLevel-1 ); |
|
52 | + $tabSetStr = "\n".str_repeat(' ', Less_Environment::$tabLevel-1); |
|
53 | 53 | $tabRuleStr = $tabSetStr.' '; |
54 | 54 | |
55 | - $output->add( " {" ); |
|
56 | - for($i = 0; $i < $ruleCnt; $i++ ){ |
|
57 | - $output->add( $tabRuleStr ); |
|
58 | - $rules[$i]->genCSS( $output ); |
|
55 | + $output->add(" {"); |
|
56 | + for ($i = 0; $i<$ruleCnt; $i++) { |
|
57 | + $output->add($tabRuleStr); |
|
58 | + $rules[$i]->genCSS($output); |
|
59 | 59 | } |
60 | 60 | Less_Environment::$tabLevel--; |
61 | - $output->add( $tabSetStr.'}' ); |
|
61 | + $output->add($tabSetStr.'}'); |
|
62 | 62 | |
63 | 63 | } |
64 | 64 | |
65 | - public function accept($visitor){} |
|
65 | + public function accept($visitor) {} |
|
66 | 66 | |
67 | 67 | |
68 | - public static function ReferencedArray($rules){ |
|
69 | - foreach($rules as $rule){ |
|
70 | - if( method_exists($rule, 'markReferenced') ){ |
|
68 | + public static function ReferencedArray($rules) { |
|
69 | + foreach ($rules as $rule) { |
|
70 | + if (method_exists($rule, 'markReferenced')) { |
|
71 | 71 | $rule->markReferenced(); |
72 | 72 | } |
73 | 73 | } |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | /** |
78 | 78 | * Requires php 5.3+ |
79 | 79 | */ |
80 | - public static function __set_state($args){ |
|
80 | + public static function __set_state($args) { |
|
81 | 81 | |
82 | 82 | $class = get_called_class(); |
83 | - $obj = new $class(null,null,null,null); |
|
84 | - foreach($args as $key => $val){ |
|
83 | + $obj = new $class(null, null, null, null); |
|
84 | + foreach ($args as $key => $val) { |
|
85 | 85 | $obj->$key = $val; |
86 | 86 | } |
87 | 87 | return $obj; |
@@ -6,11 +6,11 @@ discard block |
||
6 | 6 | * @package Less |
7 | 7 | * @subpackage tree |
8 | 8 | */ |
9 | -class Less_Tree_Alpha extends Less_Tree{ |
|
9 | +class Less_Tree_Alpha extends Less_Tree { |
|
10 | 10 | public $value; |
11 | 11 | public $type = 'Alpha'; |
12 | 12 | |
13 | - public function __construct($val){ |
|
13 | + public function __construct($val) { |
|
14 | 14 | $this->value = $val; |
15 | 15 | } |
16 | 16 | |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | // $this->value = $visitor->visit( $this->value ); |
19 | 19 | //} |
20 | 20 | |
21 | - public function compile($env){ |
|
21 | + public function compile($env) { |
|
22 | 22 | |
23 | - if( is_object($this->value) ){ |
|
23 | + if (is_object($this->value)) { |
|
24 | 24 | $this->value = $this->value->compile($env); |
25 | 25 | } |
26 | 26 | |
@@ -30,21 +30,21 @@ discard block |
||
30 | 30 | /** |
31 | 31 | * @see Less_Tree::genCSS |
32 | 32 | */ |
33 | - public function genCSS( $output ){ |
|
33 | + public function genCSS($output) { |
|
34 | 34 | |
35 | - $output->add( "alpha(opacity=" ); |
|
35 | + $output->add("alpha(opacity="); |
|
36 | 36 | |
37 | - if( is_string($this->value) ){ |
|
38 | - $output->add( $this->value ); |
|
39 | - }else{ |
|
40 | - $this->value->genCSS( $output); |
|
37 | + if (is_string($this->value)) { |
|
38 | + $output->add($this->value); |
|
39 | + }else { |
|
40 | + $this->value->genCSS($output); |
|
41 | 41 | } |
42 | 42 | |
43 | - $output->add( ')' ); |
|
43 | + $output->add(')'); |
|
44 | 44 | } |
45 | 45 | |
46 | - public function toCSS(){ |
|
47 | - return "alpha(opacity=" . (is_string($this->value) ? $this->value : $this->value->toCSS()) . ")"; |
|
46 | + public function toCSS() { |
|
47 | + return "alpha(opacity=".(is_string($this->value) ? $this->value : $this->value->toCSS()).")"; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 |
@@ -15,9 +15,9 @@ |
||
15 | 15 | $this->value = $value; |
16 | 16 | } |
17 | 17 | |
18 | - /** |
|
19 | - * @see Less_Tree::genCSS |
|
20 | - */ |
|
18 | + /** |
|
19 | + * @see Less_Tree::genCSS |
|
20 | + */ |
|
21 | 21 | public function genCSS( $output ){ |
22 | 22 | $output->add( $this->value ); |
23 | 23 | } |
@@ -33,7 +33,7 @@ |
||
33 | 33 | $this->$funcName( $node ); |
34 | 34 | } |
35 | 35 | |
36 | - }else{ |
|
36 | + } else{ |
|
37 | 37 | $node->accept($this); |
38 | 38 | } |
39 | 39 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | return new Less_Tree_Anonymous($this->value, $this->index, $this->currentFileInfo, $this->mapLines); |
30 | 30 | } |
31 | 31 | |
32 | - public function compare($x){ |
|
32 | + public function compare($x){ |
|
33 | 33 | if( !is_object($x) ){ |
34 | 34 | return -1; |
35 | 35 | } |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | return $left < $right ? -1 : 1; |
45 | 45 | } |
46 | 46 | |
47 | - /** |
|
48 | - * @see Less_Tree::genCSS |
|
49 | - */ |
|
47 | + /** |
|
48 | + * @see Less_Tree::genCSS |
|
49 | + */ |
|
50 | 50 | public function genCSS( $output ){ |
51 | 51 | $output->add( $this->value, $this->currentFileInfo, $this->index, $this->mapLines ); |
52 | 52 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package Less |
7 | 7 | * @subpackage tree |
8 | 8 | */ |
9 | -class Less_Tree_Anonymous extends Less_Tree{ |
|
9 | +class Less_Tree_Anonymous extends Less_Tree { |
|
10 | 10 | public $value; |
11 | 11 | public $quote; |
12 | 12 | public $index; |
@@ -18,40 +18,40 @@ discard block |
||
18 | 18 | * @param integer $index |
19 | 19 | * @param boolean $mapLines |
20 | 20 | */ |
21 | - public function __construct($value, $index = null, $currentFileInfo = null, $mapLines = null ){ |
|
21 | + public function __construct($value, $index = null, $currentFileInfo = null, $mapLines = null) { |
|
22 | 22 | $this->value = $value; |
23 | 23 | $this->index = $index; |
24 | 24 | $this->mapLines = $mapLines; |
25 | 25 | $this->currentFileInfo = $currentFileInfo; |
26 | 26 | } |
27 | 27 | |
28 | - public function compile(){ |
|
28 | + public function compile() { |
|
29 | 29 | return new Less_Tree_Anonymous($this->value, $this->index, $this->currentFileInfo, $this->mapLines); |
30 | 30 | } |
31 | 31 | |
32 | - public function compare($x){ |
|
33 | - if( !is_object($x) ){ |
|
32 | + public function compare($x) { |
|
33 | + if (!is_object($x)) { |
|
34 | 34 | return -1; |
35 | 35 | } |
36 | 36 | |
37 | 37 | $left = $this->toCSS(); |
38 | 38 | $right = $x->toCSS(); |
39 | 39 | |
40 | - if( $left === $right ){ |
|
40 | + if ($left===$right) { |
|
41 | 41 | return 0; |
42 | 42 | } |
43 | 43 | |
44 | - return $left < $right ? -1 : 1; |
|
44 | + return $left<$right ? -1 : 1; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
48 | 48 | * @see Less_Tree::genCSS |
49 | 49 | */ |
50 | - public function genCSS( $output ){ |
|
51 | - $output->add( $this->value, $this->currentFileInfo, $this->index, $this->mapLines ); |
|
50 | + public function genCSS($output) { |
|
51 | + $output->add($this->value, $this->currentFileInfo, $this->index, $this->mapLines); |
|
52 | 52 | } |
53 | 53 | |
54 | - public function toCSS(){ |
|
54 | + public function toCSS() { |
|
55 | 55 | return $this->value; |
56 | 56 | } |
57 | 57 |
@@ -12,12 +12,12 @@ discard block |
||
12 | 12 | public $value; |
13 | 13 | public $type = 'Assignment'; |
14 | 14 | |
15 | - public function __construct($key, $val) { |
|
15 | + public function __construct($key, $val) { |
|
16 | 16 | $this->key = $key; |
17 | 17 | $this->value = $val; |
18 | 18 | } |
19 | 19 | |
20 | - public function accept( $visitor ){ |
|
20 | + public function accept( $visitor ){ |
|
21 | 21 | $this->value = $visitor->visitObj( $this->value ); |
22 | 22 | } |
23 | 23 | |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | return new Less_Tree_Assignment( $this->key, $this->value->compile($env)); |
26 | 26 | } |
27 | 27 | |
28 | - /** |
|
29 | - * @see Less_Tree::genCSS |
|
30 | - */ |
|
28 | + /** |
|
29 | + * @see Less_Tree::genCSS |
|
30 | + */ |
|
31 | 31 | public function genCSS( $output ){ |
32 | 32 | $output->add( $this->key . '=' ); |
33 | 33 | $this->value->genCSS( $output ); |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @package Less |
7 | 7 | * @subpackage tree |
8 | 8 | */ |
9 | -class Less_Tree_Assignment extends Less_Tree{ |
|
9 | +class Less_Tree_Assignment extends Less_Tree { |
|
10 | 10 | |
11 | 11 | public $key; |
12 | 12 | public $value; |
@@ -17,23 +17,23 @@ discard block |
||
17 | 17 | $this->value = $val; |
18 | 18 | } |
19 | 19 | |
20 | - public function accept( $visitor ){ |
|
21 | - $this->value = $visitor->visitObj( $this->value ); |
|
20 | + public function accept($visitor) { |
|
21 | + $this->value = $visitor->visitObj($this->value); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | public function compile($env) { |
25 | - return new Less_Tree_Assignment( $this->key, $this->value->compile($env)); |
|
25 | + return new Less_Tree_Assignment($this->key, $this->value->compile($env)); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
29 | 29 | * @see Less_Tree::genCSS |
30 | 30 | */ |
31 | - public function genCSS( $output ){ |
|
32 | - $output->add( $this->key . '=' ); |
|
33 | - $this->value->genCSS( $output ); |
|
31 | + public function genCSS($output) { |
|
32 | + $output->add($this->key.'='); |
|
33 | + $this->value->genCSS($output); |
|
34 | 34 | } |
35 | 35 | |
36 | - public function toCss(){ |
|
37 | - return $this->key . '=' . $this->value->toCSS(); |
|
36 | + public function toCss() { |
|
37 | + return $this->key.'='.$this->value->toCSS(); |
|
38 | 38 | } |
39 | 39 | } |