Adding config2json
Publish PHP Package / docker (push) Successful in 7s
Details
Publish PHP Package / docker (push) Successful in 7s
Details
This commit is contained in:
parent
a15f4f935e
commit
458b72e367
22
util.inc.php
22
util.inc.php
|
@ -122,15 +122,13 @@ function config_includes_map_find_text_origin(array $map, string $file, string $
|
|||
return $res;
|
||||
}
|
||||
|
||||
//TODO:
|
||||
//function conf2json(object $conf, int $json_flags = 0) : string
|
||||
//{
|
||||
// $arr = $conf->export(true);
|
||||
// $arr['class'] = get_class($conf);
|
||||
// unset($arr['id']);
|
||||
// unset($arr['strid']);
|
||||
// $json = json_encode($arr, $json_flags);
|
||||
// $json = str_replace(array('\\\\', '\\n', '\/'), array('\\', "\n", '/'), $json);
|
||||
// return $json;
|
||||
//}
|
||||
|
||||
function config2json(object $conf, int $json_flags = 0) : string
|
||||
{
|
||||
$arr = $conf->export(true);
|
||||
$arr['class'] = get_class($conf);
|
||||
unset($arr['id']); // @phpstan-ignore-line
|
||||
unset($arr['strid']); // @phpstan-ignore-line
|
||||
$json = json_encode($arr, $json_flags);
|
||||
$json = str_replace(array('\\\\', '\\n', '\/'), array('\\', "\n", '/'), $json);
|
||||
return $json;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue