Mods-for-HESK-Netsyms/api/ApplicationContext.php

51 lines
2.2 KiB
PHP
Raw Normal View History

<?php
// Responsible for loading in all necessary classes. AKA a poor man's DI solution.
2017-02-01 22:04:52 -05:00
use BusinessLogic\Categories\CategoryRetriever;
2017-01-28 01:41:29 -05:00
use BusinessLogic\Security\BanRetriever;
use BusinessLogic\Security\UserContextBuilder;
2017-02-13 22:34:15 -05:00
use BusinessLogic\Tickets\Autoassigner;
2017-01-31 22:26:46 -05:00
use BusinessLogic\Tickets\TicketRetriever;
2017-02-13 22:34:15 -05:00
use BusinessLogic\Tickets\TicketCreator;
use BusinessLogic\Tickets\NewTicketValidator;
use BusinessLogic\Tickets\TicketValidators;
use BusinessLogic\Tickets\TrackingIdGenerator;
2017-02-01 22:04:52 -05:00
use DataAccess\Categories\CategoryGateway;
2017-01-28 01:41:29 -05:00
use DataAccess\Security\BanGateway;
use DataAccess\Security\UserGateway;
2017-01-31 22:26:46 -05:00
use DataAccess\Tickets\TicketGateway;
2017-02-01 22:04:52 -05:00
2017-01-28 01:41:29 -05:00
class ApplicationContext {
public $get;
function __construct() {
$this->get = array();
2017-02-13 22:34:15 -05:00
// User Context
$this->get[UserGateway::class] = new UserGateway();
$this->get[UserContextBuilder::class] = new UserContextBuilder($this->get[UserGateway::class]);
2017-01-28 01:41:29 -05:00
2017-02-13 22:34:15 -05:00
// Categories
$this->get[CategoryGateway::class] = new CategoryGateway();
$this->get[CategoryRetriever::class] = new CategoryRetriever($this->get[CategoryGateway::class]);
2017-01-31 22:26:46 -05:00
// Bans
2017-02-13 22:34:15 -05:00
$this->get[BanGateway::class] = new BanGateway();
$this->get[BanRetriever::class] = new BanRetriever($this->get[BanGateway::class]);
2017-02-13 22:34:15 -05:00
// Tickets
$this->get[TicketGateway::class] = new TicketGateway();
$this->get[TicketRetriever::class] = new TicketRetriever($this->get[TicketGateway::class]);
$this->get[TicketValidators::class] = new TicketValidators($this->get[TicketGateway::class]);
$this->get[TrackingIdGenerator::class] = new TrackingIdGenerator($this->get[TicketGateway::class]);
$this->get[Autoassigner::class] = new Autoassigner();
$this->get[NewTicketValidator::class] = new NewTicketValidator($this->get[CategoryRetriever::class],
$this->get[BanRetriever::class],
$this->get[TicketValidators::class]);
$this->get[TicketCreator::class] = new TicketCreator($this->get[NewTicketValidator::class],
$this->get[TrackingIdGenerator::class],
$this->get[Autoassigner::class],
$this->get[TicketGateway::class]);
}
}