/** * For each extracted database, dump a JSON file with the detected structure. * * @param $path Output folder in which to dump the output * @throws InvalidPathException when file does not exist or is invalid * @return bool */ public function output($path, $databases = []) { $fileExists = System::file_exists($path); if (!$fileExists || $fileExists && !System::is_dir($path)) { throw new InvalidPathException($path); } foreach ($databases as $database) { $filename = $path . DIRECTORY_SEPARATOR . $database->Name . '-' . date('Y-m-d') . '-' . time() . '.json'; System::file_put_contents($filename, json_encode($database, JSON_PRETTY_PRINT)); } return true; }