ICommand
in
Command pattern interface for encapsulating executable operations.
The ICommand interface defines the contract for command objects in the command pattern implementation. Commands encapsulate a request as an object, allowing you to parameterize clients with different requests, queue or log requests, and support undoable operations.
Key benefits of the Command pattern:
- Decouples the invoker from the receiver of the request
- Supports parameterization of objects with operations
- Allows queuing, logging, and undo operations
- Enables macro command composition
- Supports transactional behavior
Command implementations should:
- Encapsulate all information needed to perform an action
- Be stateless or maintain minimal state
- Handle parameter validation within the execute method
- Return appropriate results or throw exceptions on failure
Tags
Table of Contents
Methods
- execute() : mixed
Methods
execute()
public
execute([array<string|int, mixed>|null $params = null ]) : mixed
Parameters
- $params : array<string|int, mixed>|null = null