mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-06 10:02:49 +08:00
完成打包和最小化格式化
This commit is contained in:
47
app/common/tools/phpparser/MinifyPrinterTools.php
Normal file
47
app/common/tools/phpparser/MinifyPrinterTools.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\tools\phpparser;
|
||||
|
||||
|
||||
class MinifyPrinterTools extends PrettyPrinterTools
|
||||
{
|
||||
/**
|
||||
* Reset pretty printing state.
|
||||
*/
|
||||
protected function resetState()
|
||||
{
|
||||
$this->indentLevel = 0;
|
||||
$this->nl = "";
|
||||
$this->origTokens = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set indentation level
|
||||
*
|
||||
* @param int $level Level in number of spaces
|
||||
*/
|
||||
protected function setIndentLevel(int $level)
|
||||
{
|
||||
$this->indentLevel = $level;
|
||||
$this->nl = "" . \str_repeat('', $level);
|
||||
}
|
||||
|
||||
/**
|
||||
* Increase indentation level.
|
||||
*/
|
||||
protected function indent()
|
||||
{
|
||||
$this->indentLevel += 4;
|
||||
$this->nl .= '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrease indentation level.
|
||||
*/
|
||||
protected function outdent()
|
||||
{
|
||||
assert($this->indentLevel >= 4);
|
||||
$this->indentLevel -= 4;
|
||||
$this->nl = "" . str_repeat('', $this->indentLevel);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user