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

Method basenameKey

src/FileRise/Domain/DiskUsageModel.php:960–971  ·  view source on GitHub ↗

* Helper: basename of a folder key. "root" -> "root", "foo/bar" -> "bar". */

(?string $key)

Source from the content-addressed store, hash-verified

958 * Helper: basename of a folder key. "root" -> "root", "foo/bar" -> "bar".
959 */
960 private static function basenameKey(?string $key): string
961 {
962 if ($key === null || $key === '' || $key === 'root') {
963 return 'root';
964 }
965 $key = trim($key, '/');
966 $pos = strrpos($key, '/');
967 if ($pos === false) {
968 return $key;
969 }
970 return substr($key, $pos + 1);
971 }
972
973 /**
974 * Helper: approximate depth of a folder key (root->0, "foo"->1, "foo/bar"->2, etc.)

Callers 1

buildSnapshotMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected