]> BookStack Code Mirror - bookstack/blobdiff - tests/Exports/ZipResultData.php
ZIP Imports: Added API examples, finished testing
[bookstack] / tests / Exports / ZipResultData.php
index b5cc2b4ca61a84adfa4bc72cd0c78692ed3e745a..7725004c7be66c00e1198e78dca53cdf40e9ad40 100644 (file)
@@ -10,4 +10,13 @@ class ZipResultData
         public array $data,
     ) {
     }
+
+    /**
+     * Build a path to a location the extracted content, using the given relative $path.
+     */
+    public function extractPath(string $path): string
+    {
+        $relPath = implode(DIRECTORY_SEPARATOR, explode('/', $path));
+        return $this->extractedDirPath . DIRECTORY_SEPARATOR . ltrim($relPath, DIRECTORY_SEPARATOR);
+    }
 }