1- <?php declare (strict_types=1 );
1+ <?php
2+
3+ declare (strict_types=1 );
24/**
35 * @copyright Copyright (c) 2018 Robin Appelman <[email protected] > 46 *
2123
2224namespace OCA \LogReader \Log ;
2325
24-
2526class Formatter {
2627 private $ root ;
2728
@@ -84,7 +85,7 @@ private function formatArgument($argument, int $whiteSpace, int $depth = 0, bool
8485 $ className = $ argument ['__class__ ' ];
8586 unset($ argument ['__class__ ' ]);
8687 return $ leadingSpace . $ className . ' ' . trim ($ this ->formatArgument ($ argument , $ whiteSpace , $ depth , true ));
87- } else if (is_array ($ argument )) {
88+ } elseif (is_array ($ argument )) {
8889 if (count ($ argument ) === 0 ) {
8990 return $ leadingSpace . ($ forceObject ? '{} ' : '[] ' );
9091 }
@@ -93,13 +94,13 @@ private function formatArgument($argument, int $whiteSpace, int $depth = 0, bool
9394 $ keyWhitespace = str_repeat (' ' , $ whiteSpace * ($ depth + 1 ));
9495 return $ leadingSpace . "{ \n" .
9596 implode ($ glue , array_map (function ($ key , $ value ) use ($ whiteSpace , $ depth , $ keyWhitespace ) {
96- return $ keyWhitespace . $ key . ': ' . trim ($ this ->formatArgument ($ value , $ whiteSpace , $ depth + 1 ));
97- }, array_keys ($ argument ), array_values ($ argument ))) . ($ whiteSpace ? "\n" : '' ) . $ leadingSpace . '} ' ;
97+ return $ keyWhitespace . $ key . ': ' . trim ($ this ->formatArgument ($ value , $ whiteSpace , $ depth + 1 ));
98+ }, array_keys ($ argument ), array_values ($ argument ))) . ($ whiteSpace ? "\n" : '' ) . $ leadingSpace . '} ' ;
9899 } else {
99100 return $ leadingSpace . "[ \n" .
100101 implode ($ glue , array_map (function ($ value ) use ($ whiteSpace , $ depth ) {
101- return $ this ->formatArgument ($ value , $ whiteSpace , $ depth + 1 );
102- }, $ argument )) . ($ whiteSpace ? "\n" : '' ) . $ leadingSpace . '] ' ;
102+ return $ this ->formatArgument ($ value , $ whiteSpace , $ depth + 1 );
103+ }, $ argument )) . ($ whiteSpace ? "\n" : '' ) . $ leadingSpace . '] ' ;
103104 }
104105 } else {
105106 $ value = json_encode ($ argument , $ whiteSpace ? JSON_PRETTY_PRINT : 0 );
0 commit comments