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

Method sourceRoot

src/FileRise/Storage/SourceHealth.php:83–105  ·  view source on GitHub ↗
(array $source)

Source from the content-addressed store, hash-verified

81 }
82
83 private static function sourceRoot(array $source): string
84 {
85 $type = strtolower((string)($source['type'] ?? 'local'));
86 $cfg = isset($source['config']) && is_array($source['config']) ? $source['config'] : [];
87 if ($type === 'local') {
88 $path = trim((string)($cfg['path'] ?? $cfg['root'] ?? ''));
89 if ($path !== '') {
90 $trimmed = rtrim($path, "/\\");
91 return ($trimmed === '') ? (string)UPLOAD_DIR : ($trimmed . DIRECTORY_SEPARATOR);
92 }
93 }
94
95 $id = trim((string)($source['id'] ?? ''));
96 if ($id !== '' && class_exists(SourceContext::class) && method_exists(SourceContext::class, 'uploadRootForId')) {
97 $root = (string)SourceContext::uploadRootForId($id);
98 $trimmed = rtrim($root, "/\\");
99 if ($trimmed !== '') {
100 return $trimmed . DIRECTORY_SEPARATOR;
101 }
102 }
103
104 return rtrim((string)UPLOAD_DIR, "/\\") . DIRECTORY_SEPARATOR;
105 }
106
107 private static function deletePath($adapter, string $path): array
108 {

Callers 1

checkMethod · 0.95

Calls 1

uploadRootForIdMethod · 0.80

Tested by

no test coverage detected