1: <?php
2:
3: namespace LaravelUi5\Core\Infrastructure\Contracts;
4:
5: use LogicException;
6:
7: /**
8: * Manages UI5 source overrides defined in .ui5-sources.php.
9: *
10: * This service is the single authority for reading and writing
11: * workspace source overrides. It is used by:
12: *
13: * - Ui5SourceStrategyResolver (read-only)
14: * - ui5:app / ui5:lib commands (write access)
15: *
16: * The store guarantees that:
17: * - all paths are absolute and valid directories
18: * - keys are fully qualified module class names
19: * - invalid entries never reach consumers
20: */
21: interface Ui5SourceOverrideStoreInterface
22: {
23: /**
24: * Returns all resolved source overrides.
25: *
26: * @return array<class-string, string>
27: * Map of module class → absolute source path
28: */
29: public function all(): array;
30:
31: /**
32: * Returns the source override path for a module, if present.
33: *
34: * @param class-string $moduleClass
35: */
36: public function get(string $moduleClass): ?string;
37:
38: /**
39: * Adds or updates a source override for a module.
40: *
41: * Implementations MUST:
42: * - normalize the path
43: * - validate that it exists and is a directory
44: * - persist the change atomically
45: *
46: * @param class-string $moduleClass
47: * @param string $srcPath Absolute path to the workspace project directory
48: *
49: * @throws LogicException if the path is invalid
50: */
51: public function put(string $moduleClass, string $srcPath): void;
52: }
53: