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