Skip to content
Snippets Groups Projects
Commit d37d28ad authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

simplify indentation shortener via regexp, re #2470

parent 08e2d254
No related branches found
No related tags found
No related merge requests found
......@@ -206,9 +206,7 @@ class Jsonapi extends \Codeception\Module
$json = json_encode($jsonBody, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
// This converts the default indentation of 4 spaces to 2 spaces
$json = preg_replace_callback('/^( +)(?=\S)/m', function ($match) {
return str_pad('', strlen($match[1]) / 2, ' ');
}, $json);
$json = preg_replace('/^( +)\1/m', '$1', $json);
$dirname = codecept_output_dir() . 'json-for-slate/';
if (!file_exists($dirname)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment