passionator / basket
taha haddane test for architech-labs-code-test
Fund package maintenance!
passionator
1.0
2025-03-20 17:25 UTC
Requires
- php: ^8.2
Requires (Dev)
- larastan/larastan: ^2.9||^3.0
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^10.0.0||^9.0.0||^8.22.0
- pestphp/pest: ^3.0
- pestphp/pest-plugin-arch: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
- phpstan/extension-installer: ^1.3||^2.0
- phpstan/phpstan-deprecation-rules: ^1.1||^2.0
- phpstan/phpstan-phpunit: ^1.3||^2.0
README
This is simple product basket implementation for the skill test.
- It is initialised with the product catalogue, delivery charge rules in constructor.
- There is an add method that takes the product code as a parameter
- There is a total method that returns the total cost of the basket, taking into account the delivery and offer rules.
Installation
You can install the package via composer:
composer require passionator/basket
Usage
use Passionator\Basket\BasketClass; $basket = new BasketClass(); // You can add among of ['R01','G01','B01'] $basket->add('B01'); $basket->add('R01'); $basket->add('G01'); // you can calculate the total price echo $basket->total();