MCPcopy Create free account
hub / github.com/error311/FileRise / getSharedFolderData

Method getSharedFolderData

src/FileRise/Domain/FolderModel.php:2688–2716  ·  view source on GitHub ↗

* Retrieves shared folder data based on a share token. */

(string $token, ?string $providedPass, int $page = 1, int $itemsPerPage = 10, string $subPath = '')

Source from the content-addressed store, hash-verified

2686 * Retrieves shared folder data based on a share token.
2687 */
2688 public static function getSharedFolderData(string $token, ?string $providedPass, int $page = 1, int $itemsPerPage = 10, string $subPath = ''): array
2689 {
2690 $ctx = self::resolveSharedFolderContext($token, $providedPass, $subPath);
2691 if (isset($ctx['error']) || isset($ctx['needs_password'])) {
2692 return $ctx;
2693 }
2694
2695 if (!empty($ctx['hideListing'])) {
2696 $ctx['entries'] = [];
2697 $ctx['currentPage'] = 1;
2698 $ctx['totalPages'] = 1;
2699 $ctx['totalEntries'] = 0;
2700 return $ctx;
2701 }
2702
2703 $allEntries = $ctx['entries'] ?? [];
2704
2705 $totalEntries = count($allEntries);
2706 $totalPages = max(1, (int)ceil($totalEntries / max(1, $itemsPerPage)));
2707 $currentPage = min(max(1, $page), $totalPages);
2708 $startIndex = ($currentPage - 1) * $itemsPerPage;
2709 $entriesOnPage = array_slice($allEntries, $startIndex, $itemsPerPage);
2710
2711 $ctx['entries'] = $entriesOnPage;
2712 $ctx['currentPage'] = $currentPage;
2713 $ctx['totalPages'] = $totalPages;
2714 $ctx['totalEntries'] = $totalEntries;
2715 return $ctx;
2716 }
2717
2718 public static function getSharedUploadContext(string $token, ?string $providedPass, string $subPath = ''): array
2719 {

Callers 2

shareFolderMethod · 0.80

Calls 1

Tested by

no test coverage detected