value * Will be pushed as new array entry int log * Main key is the set Id for this run * * @param array $data Any array data to store in the log * @return void */ public static function writeLog(array $data): void { if (self::$debug === false) { return; } self::$log[self::getId()][] = $data; } /** * get all logs written since first class run * or get all log entries for given ID * * @param string|null $id If set returns only this id logs * or empty array if not found * @return array Always array, empty if not data or not found */ public static function getLog(?string $id = null): array { if ($id === null) { return self::$log; } else { return self::$log[$id] ?? []; } } } // __END__