|
|
|
|
@ -20,7 +20,7 @@ class Encryptor extends \PhpAot\Core\Translator |
|
|
|
|
protected array $decodeMap; |
|
|
|
|
protected array $constants; |
|
|
|
|
|
|
|
|
|
function __construct(array $stmts) |
|
|
|
|
public function __construct(array $stmts) |
|
|
|
|
{ |
|
|
|
|
$confDir = __DIR__ . '/../../config'; |
|
|
|
|
$this->stmts = $stmts; |
|
|
|
|
@ -29,7 +29,7 @@ class Encryptor extends \PhpAot\Core\Translator |
|
|
|
|
$this->constants = require $confDir . '/constants.php'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function parseHeaders(): string |
|
|
|
|
public function parseHeaders(): string |
|
|
|
|
{ |
|
|
|
|
$lines = []; |
|
|
|
|
foreach ($this->headers as $header) { |
|
|
|
|
@ -38,30 +38,30 @@ class Encryptor extends \PhpAot\Core\Translator |
|
|
|
|
return implode(PHP_EOL, $lines) . PHP_EOL . PHP_EOL; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function setPhpxDir($dir): void |
|
|
|
|
public function setPhpxDir($dir): void |
|
|
|
|
{ |
|
|
|
|
$this->phpxDir = $dir; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function convert() |
|
|
|
|
public function convert() |
|
|
|
|
{ |
|
|
|
|
$this->parseStmts($this->stmts); |
|
|
|
|
$prettyPrinter = new Standard; |
|
|
|
|
$prettyPrinter = new Standard(); |
|
|
|
|
return $prettyPrinter->prettyPrintFile($this->stmts); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function save($code, $file) |
|
|
|
|
public function save($code, $file) |
|
|
|
|
{ |
|
|
|
|
file_put_contents($file, $code); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getLine($node): int |
|
|
|
|
public function getLine($node): int |
|
|
|
|
{ |
|
|
|
|
return $node->getLine(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function getType($node): string |
|
|
|
|
public function getType($node): string |
|
|
|
|
{ |
|
|
|
|
return $node->getType(); |
|
|
|
|
} |
|
|
|
|
@ -75,7 +75,7 @@ class Encryptor extends \PhpAot\Core\Translator |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($v->returnType) { |
|
|
|
|
$return =$this->parseIdentifier($v->returnType); |
|
|
|
|
$return = $this->parseIdentifier($v->returnType); |
|
|
|
|
} else { |
|
|
|
|
$return = ''; |
|
|
|
|
} |
|
|
|
|
@ -429,4 +429,3 @@ class Encryptor extends \PhpAot\Core\Translator |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|