developernaren / trip-sorter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Trip Sorter

Assumptions

It is not mentioned in the doc that the card will have departure and destination but I have assumed that and wrote the system.

Run all the commands from the root of the project

Execution

The example code is written at src/index.php.
In the example, I have added multiple flights, bus and train travels to generate the itinerary.
The result can be viewed running this file from terminal as
$ php src/index

To view it in the browser
$ php -S localhost:8888 src/index.php

Tests

Tests are written in tests/ folder. To run the tests. Run
$ ./vendor/bin/phpunit

Extending to add transportation types

We can implement interface Transportation to the new Transportation type that we add.
Currently there are 3 types of transportation.

  • Bus
  • Train
  • Flight

All of these implement the interface. To add a new mode of transportation, the added mode can implement the interface Transportation and it should work.

About


Languages

Language:PHP 100.0%