A small API that takes a list of unordered boarding passes, sorts them and output in a readable format.
To install TripSorter, run the composer install command from the root directory of the project (make sure you have Composer installed):
php composer.phar install --prefer-dist
- Input is read from a json file.
- A train and a flight must have a seat assignment.
The input file used for the application is "data/cards.json". To run the application:
php index.php
Unit tests are located in the test folder. To run the tests:
./vendor/phpunit/phpunit/phpunit
In order to introduce a new type of transportation with different characteristics, you only have to extend AbstractBoardingCard
class.
The sorting algorithm has a linear complexity of O(n).