* * @throws FilesystemException */ public function findDumpsForRequestId(string $requestId): array { if ('' === $requestId || '-' === $requestId) { return []; } $pattern = '/^'.preg_quote($requestId, '/').'(_\d+)?_(request|response)\.xml$/'; $matches = []; foreach ($this->xmlDump->listContents('.') as $item) { if ($item->isFile() && 1 === preg_match($pattern, $item->path(), $typeMatch)) { $matches[] = [ 'filename' => $item->path(), 'type' => $typeMatch[2], 'size' => $this->xmlDump->fileSize($item->path()), ]; } } usort($matches, static fn (array $a, array $b): int => strcmp($a['filename'], $b['filename'])); return $matches; } /** * Reads the content of a dump file. * * @throws FilesystemException */ public function getContent(string $filename): string { return $this->xmlDump->read($filename); } /** * Checks if a dump file exists. * * @throws FilesystemException */ public function fileExists(string $filename): bool { return $this->xmlDump->fileExists($filename); } }