-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
executable file
·67 lines (58 loc) · 2.02 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
Running application:
1- Extract files and put the donloaded files into project folder.
2- run index.php file as localhost/tripSortet/index.php in my case.
Triggering test
----------------------------------------------
$ php test/index.php
//** Example Usage
----------------------------------------------
//** Include bootstrap file.
require_once 'vendor/autoload.php';
//** Include classes.
use TripSorter\CardFactory\CardFactory;
use TripSorter\CardAbstract\CardAbstract;
use TripSorter\Person\Person;
use TripSorter\TransportableAbstract\TransportableAbstract;
use TripSorter\modules\travel\Travel;
//** Create two tickets
$tickets = array(
CardFactory::create(array(
'source' => 'Madrid Metro Station',
'destination' => 'Barcelona Metro Station ',
'vehicle' => '78A train',
'seat' => '45B',
'gate' => null
)),
CardFactory::create(array(
'source' => 'Barcelona',
'destination' => 'Gerona Airport',
'vehicle' => 'Airport Bus',
'seat' => null,
'gate' => null
)),
CardFactory::create(array(
'source' => 'Gerona Airport',
'destination' => 'Stockholm Airport',
'vehicle' => 'Flight SK455',
'seat' => '3A',
'gate' => '45B'
)),
CardFactory::create(array(
'source' => 'Stockholm Airport',
'destination' => 'New York JFKS Airport',
'vehicle' => 'Flight SK22',
'seat' => '7B',
'gate' => '22'
))
);
//** Create three passengers
$passengers = array(
new Person('Deb'),
new Person('Prasad'),
new Person('Bhattarai')
);
//** Give the correct order to the crowd
$travel = new Travel($passengers, $tickets);
$route = $travel->sortTickets()->getTickets();
$passenger = $travel->getPassengers();
//***route will be an array of the ordered tickets. If you would like you can also get passengers by calling getPassengers() method like above.