-
Notifications
You must be signed in to change notification settings - Fork 0
/
export.php
28 lines (24 loc) · 996 Bytes
/
export.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
26
27
28
<?php
/**
* Refactor this code to be the tidiest, 'best practice' design you can come up with
* The point of this exercise is not to find minor bugs in the code, but to focus on the architecture of
* this piece of software and ensure it is very well designed - easy to maintain, extend, refactor over
* time as required.
*
* This code uses a standalone implementation of Laravel Collections which provides the global 'collect'
* method and various methods which operate on the resulting Collection object.
* https://laravel.com/docs/5.8/collections
*/
use Illuminate\Support;
// prepare the request & process the arguments
require_once('vendor/autoload.php');
require_once('classes/Controller.php');
// process the args
$args = collect($_REQUEST);
$format = $args->pull('format') ?: 'html';
$type = $args->pull('type');
if (!$type) {
exit('Please specify a type');
}
$controller = new Controller($args);
echo $controller->export($type, $format);