1: <?php
2:
3: namespace LaravelUi5\Core\Contracts;
4:
5: /**
6: * Contract for classes that consume declarative settings/configuration.
7: *
8: * Implementations must support an immutable "wither" to inject a typed
9: * configuration bag (Ui5Config) and expose a read accessor for usage
10: * in domain code.
11: *
12: * Notes:
13: * - In Core, the resolver may provide defaults only.
14: * - In the SDK, a database-backed resolver can supply effective values
15: * (scope precedence, casting).
16: *
17: * Rules:
18: * - withConfig(Ui5Config) MUST NOT mutate the instance; return a clone.
19: * - config() MUST always return a Ui5Config (empty bag if nothing injected).
20: *
21: * Typical implementers:
22: * - Resource/Report providers that read feature flags or limits
23: * - Action handlers with tunable behavior
24: */
25: interface ConfigurableInterface
26: {
27: /**
28: * Immutable injection of resolved configuration.
29: *
30: * @return static cloned instance carrying the provided arguments
31: */
32: public function withConfig(Ui5Config $config): static;
33:
34: /**
35: * Accessor for the resolved configuration.
36: * Should return an empty Ui5Config when no config was injected.
37: */
38: public function config(): Ui5Config;
39: }
40: