| 1: | <?php |
| 2: | |
| 3: | namespace LaravelUi5\Core\Ui5\Contracts; |
| 4: | |
| 5: | |
| 6: | use LaravelUi5\Core\Contracts\Ui5Args; |
| 7: | |
| 8: | /** |
| 9: | * Contract for classes that accept declarative, resolved request parameters. |
| 10: | * |
| 11: | * Implementations must support an immutable "wither" to inject a typed |
| 12: | * argument bag (Ui5Args) and expose a read accessor for usage in domain code. |
| 13: | * |
| 14: | * Rules: |
| 15: | * - withArgs(Ui5Args) MUST NOT mutate the instance; return a cloned instance. |
| 16: | * - args() MUST always return a Ui5Args (empty bag if nothing was injected). |
| 17: | * |
| 18: | * Typical implementers: |
| 19: | * - Report data providers |
| 20: | * - Resource data providers |
| 21: | * - Action handlers |
| 22: | */ |
| 23: | interface ParameterizableInterface |
| 24: | { |
| 25: | /** |
| 26: | * Immutable injection of resolved parameters. |
| 27: | * |
| 28: | * @return static cloned instance carrying the provided arguments |
| 29: | */ |
| 30: | public function withArgs(Ui5Args $args): static; |
| 31: | |
| 32: | /** |
| 33: | * Accessor for the resolved arguments. |
| 34: | * Should return an empty Ui5Args when no arguments were injected. |
| 35: | */ |
| 36: | public function args(): Ui5Args; |
| 37: | } |
| 38: |