Fee is a php app using composer to handles operations provided in CSV format and calculates a commission fee based on defined rules.
for the tree of main files of app
├── composer.json
├── composer.lock
├── csv
│ └── csv.csv
├── Readme.md
├── script.php
├── src
│ └── Service
│ ├── CalculeTransaction.php
│ ├── ClientPrivateRule.php
│ ├── Currencies.php
│ └── NewCSV.php
├── tests
│ └── Service
│ └── NewCSVTest.php
└── vendor
├── autoload.php
├── bin
│ ├── php-parse -> ../nikic/php-parser/bin/php-parse
│ └── phpunit -> ../phpunit/phpunit/phpunit
├── composer
│ ├── autoload_classmap.php
│ ├── autoload_files.php
│ ├── autoload_namespaces.php
│ ├── autoload_psr4.php
│ ├── autoload_real.php
│ ├── autoload_static.php
│ ├── ClassLoader.php
│ ├── installed.json
│ ├── installed.php
│ ├── InstalledVersions.php
│ └── LICENSE
csv: directory that contains CSV files.
src: directory that contains that contains php classes .
tests: directory that contains that contains php test classes for PHPunit
root Files:
"script.php": main file to lunch the app from the command line , it takes 1 arg which is the path of csv file.
src/ Files:
"CalculeTransaction.php": it contains the class InfoTransaction and child class CalculeTransaction .
"ClientPrivateRule.php": it contains the class ClientPrivateRule .
"Currencies.php": it contains the class Currencies .
"NewCSV.php": it contains the class NewCSV .
tests/ Files:
"NewCSVTest.php": it contains the class NewCSVTest and an extended class from phpunit .
PHP => 7.0
The difficulty of this project to understand is in the class ClientPrivateRule , where the logic of the rule is a little complicalted.
cd /to/path/where_composer_json
php script.php csv/csv.csv
cd /to/path/where_composer_json
./vendor/bin/phpunit --testdox tests
Please , contact me for any bug from my website https://mehdi.contact or by my address [email protected].
Belhadj Mehdi