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

Method setColor

src/FileRise/Domain/FolderMeta.php:71–85  ·  view source on GitHub ↗

Set or clear a color for one folder */

(string $folder, ?string $hex)

Source from the content-addressed store, hash-verified

69
70 /** Set or clear a color for one folder */
71 public static function setColor(string $folder, ?string $hex): array
72 {
73 $folder = self::normalizeFolder($folder);
74 $hex = self::normalizeHex($hex);
75 $map = self::getMap();
76
77 if ($hex === null) {
78 unset($map[$folder]);
79 } else {
80 $map[$folder] = $hex;
81 }
82
83 self::writeMap($map);
84 return ['folder' => $folder, 'color' => $map[$folder] ?? null];
85 }
86
87 /** Migrate color entries for a whole subtree (used by move/rename) */
88 public static function migrateSubtree(string $source, string $target): array

Callers 1

saveFolderColorMethod · 0.80

Calls 4

normalizeFolderMethod · 0.95
normalizeHexMethod · 0.95
getMapMethod · 0.95
writeMapMethod · 0.95

Tested by

no test coverage detected