Here comes my solution for TrackTik PHP Backend challange. I have separated the main classes to make it easier to view them on screen.
- This code in compatible with PHP 7.2+
- The main file is index.php
I tried to apply the PSR-2 conceptions along with part of SOLID elements.
- There must be an extras number validation
- Controllers can have their own price
- Controller price is added to product price in "total price calculation"
- Sorting by price function returns bool value intead of the list
- Sorting by price function merges items with the same price
- Price 500
- Wired controllers 2x 25
- Remote controllers 2x 60
- Total Price 670
- Price 900
- Remote controllers 2x20
- Total Price 940
- Price 400
- Remote controllers 20
- Total Price 420
- Price 90
- Total Price 90
2120