This code demonstrates a simple discount system for an eCommerce platform using the Strategy Pattern in PHP.
- Flexible Discount Strategies: The code supports both percentage-based and fixed amount discounts.
- Extensible Design: New discount types can be added without modifying existing code, adhering to the Open/Closed Principle of SOLID.
- Usage Examples: The code includes example usage of the
DiscountService
class with different discount strategies.
- Strategy Pattern: I chose this pattern to easily swap out discount strategies, making the system more adaptable to future requirements.
- Best Practices: The code is structured to follow PSR standards and includes clear documentation to ensure maintainability.