17 lines
358 B
PHP
17 lines
358 B
PHP
<?php
|
|
|
|
namespace App\Support;
|
|
|
|
final class PowerShellEscaper
|
|
{
|
|
public static function singleQuote(string $value): string
|
|
{
|
|
return "'" . str_replace("'", "''", $value) . "'";
|
|
}
|
|
|
|
public static function encodedCommand(string $script): string
|
|
{
|
|
return base64_encode(mb_convert_encoding($script, 'UTF-16LE', 'UTF-8'));
|
|
}
|
|
}
|