for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace PHPMV\utils;
class JsUtils{
static private array $removeQuote = ["start"=>"!!%","end"=>"%!!"];
public static function cleanJSONFunctions(string $json):string {
$pattern='/(("|\')'.self::$removeQuote['start'].')|('.self::$removeQuote['end'].'("|\'))/';
return \preg_replace($pattern, '', $json);
}
public static function removeQuotes(string $body):string{
return self::$removeQuote["start"].$body.self::$removeQuote["end"];
public static function generateFunction(string $body, array $params = [], bool $needRemoveQuote = true):string {
if($needRemoveQuote){
return self::removeQuotes("function(".implode(",",$params)."){".$body."}");
return "function(".implode(",",$params)."){".$body."}";
public static function declareVariable(string $type, string $name, $value):string {
return $type." ".$name." = ".$value.";\n";
public static function kebabToPascal(string $string){
$string[0] = \strtoupper($string[0]);
$pattern='/(-\w{1})/';
return \preg_replace_callback($pattern,
function ($matches) use ($string){
$string
This check looks for imports that have been defined, but are not used in the scope.
return \strtoupper($matches[1][1]);
},$string);
This check looks for imports that have been defined, but are not used in the scope.