aboutsummaryrefslogtreecommitdiff
path: root/index.php
blob: 3e770fe26b2de5f30869374460ddf35c5eb744c7 (plain) (blame)
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
<?php

namespace AugustOffensive;

include 'private/view/Result.php';
include 'private/model/Connection.php';

use AugustOffensive\view;
use AugustOffensive\model;

/**
 * Constructive controller and initializer API for the service.
 */
class Api 
{
    /** @var \Connection $connection the model database interface */
    private $connection;

    /** @var \Result $view the view interface that outputs result of the query */
    private $view;

    /**
     * Initiates database connection and forwards environment to the view.
     *
     * @return Api 
     */
    public function __construct ()
    {
        $connection = new model\Connection();
        $view = new view\Result($connection);

        // Provide hook for connecting through controller to justify query
        $result = $view->collect();

        // Leak the data
        echo $result;
    }
}

new Api();