| @@ 225-231 (lines=7) @@ | ||
| 222 | { |
|
| 223 | // PHP only supports $this inside anonymous functions since 5.4 |
|
| 224 | $minifier = $this; |
|
| 225 | $callback = function ($match) use ($minifier) { |
|
| 226 | $count = count($minifier->extracted); |
|
| 227 | $placeholder = '"'.$count.'"'; |
|
| 228 | $minifier->extracted[$placeholder] = $match[0]; |
|
| 229 | ||
| 230 | return $placeholder; |
|
| 231 | }; |
|
| 232 | ||
| 233 | // match all chars except `/` and `\` |
|
| 234 | // `\` is allowed though, along with whatever char follows (which is the |
|
| @@ 265-271 (lines=7) @@ | ||
| 262 | // First extract comments we want to keep, so they can be restored later |
|
| 263 | // PHP only supports $this inside anonymous functions since 5.4 |
|
| 264 | $minifier = $this; |
|
| 265 | $callback = function ($match) use ($minifier) { |
|
| 266 | $count = count($minifier->extracted); |
|
| 267 | $placeholder = '/*'.$count.'*/'; |
|
| 268 | $minifier->extracted[$placeholder] = $match[0]; |
|
| 269 | ||
| 270 | return $placeholder; |
|
| 271 | }; |
|
| 272 | $this->registerPattern('/ |
|
| 273 | # optional newline |
|
| 274 | \n? |
|