-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
25 lines (19 loc) · 981 Bytes
/
index.php
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
<?php
use App\Repository\CampaignRepository;
use App\Repository\CustomerRepository;
use App\Repository\InMemoryCollection;
use App\Repository\OrderRepository;
use App\Service\Mapper\OrderListMapper;
use App\Service\ProcessDeliveryOrder\ProcessDeliveryOrder;
use App\Service\Reader\JsonReader;
use App\Service\Reader\JsonReaderToArrayDecorator;
require __DIR__ . '/vendor/autoload.php';
// Read Json File
$jsonConvertedToArray = new JsonReaderToArrayDecorator(new JsonReader(__ROOT__ . 'orders.json'));
// Initiating repositories
$orderRepository = new OrderRepository(new InMemoryCollection());
$customerRepository = new CustomerRepository(new InMemoryCollection());
$campaignRepository = new CampaignRepository(new InMemoryCollection());
$orderListMapper = new OrderListMapper($customerRepository, $campaignRepository, $orderRepository);
$processDeliveryOrderFacade = new ProcessDeliveryOrder($jsonConvertedToArray, $orderListMapper);
$processDeliveryOrderFacade->process();