|
|
@@ -0,0 +1,18 @@
|
|
|
+<?php
|
|
|
+declare(strict_types=1);
|
|
|
+
|
|
|
+namespace App\Service\Utils;
|
|
|
+
|
|
|
+use Path\Path;
|
|
|
+
|
|
|
+class DebugUtils
|
|
|
+{
|
|
|
+ public static function dumpToFile(mixed $var, bool $append = false): void {
|
|
|
+ $debugFile = (new Path(PathUtils::getProjectDir()))->append('var', 'dump.log');
|
|
|
+
|
|
|
+ $datetime = date('Y-m-d H:i:s');
|
|
|
+ $content = json_encode($var, JSON_PRETTY_PRINT);
|
|
|
+
|
|
|
+ $debugFile->putContent("$datetime - $content\n", $append);
|
|
|
+ }
|
|
|
+}
|