2017-01-28 01:28:53 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// Responsible for loading in all necessary classes. AKA a poor man's DI solution.
|
2017-03-20 22:16:35 -04:00
|
|
|
use BusinessLogic\Attachments\AttachmentHandler;
|
2017-04-09 22:14:13 -04:00
|
|
|
use BusinessLogic\Attachments\AttachmentRetriever;
|
2017-02-01 22:04:52 -05:00
|
|
|
use BusinessLogic\Categories\CategoryRetriever;
|
2017-03-09 21:55:32 -05:00
|
|
|
use BusinessLogic\Emails\BasicEmailSender;
|
|
|
|
use BusinessLogic\Emails\EmailSenderHelper;
|
|
|
|
use BusinessLogic\Emails\EmailTemplateParser;
|
|
|
|
use BusinessLogic\Emails\EmailTemplateRetriever;
|
|
|
|
use BusinessLogic\Emails\MailgunEmailSender;
|
2017-05-08 21:56:30 -04:00
|
|
|
use BusinessLogic\Navigation\CustomNavElementHandler;
|
2017-01-28 01:41:29 -05:00
|
|
|
use BusinessLogic\Security\BanRetriever;
|
2017-01-28 22:35:42 -05:00
|
|
|
use BusinessLogic\Security\UserContextBuilder;
|
2017-04-05 22:13:37 -04:00
|
|
|
use BusinessLogic\Security\UserToTicketChecker;
|
2017-03-12 15:58:17 -04:00
|
|
|
use BusinessLogic\Settings\ApiChecker;
|
2017-04-28 22:15:59 -04:00
|
|
|
use BusinessLogic\Settings\SettingsRetriever;
|
2017-04-28 13:03:25 -04:00
|
|
|
use BusinessLogic\Statuses\StatusRetriever;
|
2017-02-13 22:34:15 -05:00
|
|
|
use BusinessLogic\Tickets\Autoassigner;
|
2017-04-23 22:08:48 -04:00
|
|
|
use BusinessLogic\Tickets\TicketDeleter;
|
2017-04-28 12:36:48 -04:00
|
|
|
use BusinessLogic\Tickets\TicketEditor;
|
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-03-09 21:55:32 -05:00
|
|
|
use BusinessLogic\Tickets\VerifiedEmailChecker;
|
2017-03-20 22:16:35 -04:00
|
|
|
use DataAccess\Attachments\AttachmentGateway;
|
2017-02-01 22:04:52 -05:00
|
|
|
use DataAccess\Categories\CategoryGateway;
|
2017-04-12 22:00:56 -04:00
|
|
|
use DataAccess\Files\FileDeleter;
|
2017-04-09 22:14:13 -04:00
|
|
|
use DataAccess\Files\FileReader;
|
2017-03-20 22:16:35 -04:00
|
|
|
use DataAccess\Files\FileWriter;
|
2017-03-12 20:50:54 -04:00
|
|
|
use DataAccess\Logging\LoggingGateway;
|
2017-05-08 21:56:30 -04:00
|
|
|
use DataAccess\Navigation\CustomNavElementGateway;
|
2017-01-28 01:41:29 -05:00
|
|
|
use DataAccess\Security\BanGateway;
|
2017-01-28 22:35:42 -05:00
|
|
|
use DataAccess\Security\UserGateway;
|
2017-03-12 00:44:50 -05:00
|
|
|
use DataAccess\Settings\ModsForHeskSettingsGateway;
|
2017-02-16 21:46:47 -05:00
|
|
|
use DataAccess\Statuses\StatusGateway;
|
2017-01-31 22:26:46 -05:00
|
|
|
use DataAccess\Tickets\TicketGateway;
|
2017-03-09 21:55:32 -05:00
|
|
|
use DataAccess\Tickets\VerifiedEmailGateway;
|
2017-01-28 01:28:53 -05:00
|
|
|
|
2017-02-01 22:04:52 -05:00
|
|
|
|
2017-01-28 01:41:29 -05:00
|
|
|
class ApplicationContext {
|
2017-01-28 01:28:53 -05:00
|
|
|
public $get;
|
|
|
|
|
2017-05-08 21:56:30 -04:00
|
|
|
/**
|
|
|
|
* ApplicationContext constructor.
|
|
|
|
*/
|
2017-01-28 01:28:53 -05:00
|
|
|
function __construct() {
|
|
|
|
$this->get = array();
|
|
|
|
|
2017-03-12 00:44:50 -05:00
|
|
|
// Settings
|
|
|
|
$this->get[ModsForHeskSettingsGateway::class] = new ModsForHeskSettingsGateway();
|
|
|
|
|
2017-03-12 15:58:17 -04:00
|
|
|
// API Checker
|
|
|
|
$this->get[ApiChecker::class] = new ApiChecker($this->get[ModsForHeskSettingsGateway::class]);
|
|
|
|
|
2017-05-08 21:56:30 -04:00
|
|
|
// Custom Navigation
|
|
|
|
$this->get[CustomNavElementGateway::class] = new CustomNavElementGateway();
|
|
|
|
$this->get[CustomNavElementHandler::class] = new CustomNavElementHandler($this->get[CustomNavElementGateway::class]);
|
|
|
|
|
2017-03-12 20:50:54 -04:00
|
|
|
// Logging
|
|
|
|
$this->get[LoggingGateway::class] = new LoggingGateway();
|
|
|
|
|
2017-03-09 21:55:32 -05:00
|
|
|
// Verified Email Checker
|
|
|
|
$this->get[VerifiedEmailGateway::class] = new VerifiedEmailGateway();
|
|
|
|
$this->get[VerifiedEmailChecker::class] = new VerifiedEmailChecker($this->get[VerifiedEmailGateway::class]);
|
|
|
|
|
|
|
|
// Users
|
2017-02-13 22:34:15 -05:00
|
|
|
$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
|
|
|
|
2017-01-28 22:35:42 -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-01-28 22:35:42 -05:00
|
|
|
|
2017-03-09 21:55:32 -05:00
|
|
|
// Statuses
|
2017-02-16 21:46:47 -05:00
|
|
|
$this->get[StatusGateway::class] = new StatusGateway();
|
2017-03-09 21:55:32 -05:00
|
|
|
|
|
|
|
// Email Sender
|
|
|
|
$this->get[EmailTemplateRetriever::class] = new EmailTemplateRetriever();
|
|
|
|
$this->get[EmailTemplateParser::class] = new EmailTemplateParser($this->get[StatusGateway::class],
|
|
|
|
$this->get[CategoryGateway::class],
|
|
|
|
$this->get[UserGateway::class],
|
|
|
|
$this->get[EmailTemplateRetriever::class]);
|
|
|
|
$this->get[BasicEmailSender::class] = new BasicEmailSender();
|
|
|
|
$this->get[MailgunEmailSender::class] = new MailgunEmailSender();
|
|
|
|
$this->get[EmailSenderHelper::class] = new EmailSenderHelper($this->get[EmailTemplateParser::class],
|
|
|
|
$this->get[BasicEmailSender::class],
|
|
|
|
$this->get[MailgunEmailSender::class]);
|
|
|
|
|
|
|
|
// Tickets
|
2017-04-23 22:08:48 -04:00
|
|
|
$this->get[UserToTicketChecker::class] = new UserToTicketChecker($this->get[UserGateway::class]);
|
2017-02-13 22:34:15 -05:00
|
|
|
$this->get[TicketGateway::class] = new TicketGateway();
|
2017-05-01 21:20:59 -04:00
|
|
|
$this->get[TicketRetriever::class] = new TicketRetriever($this->get[TicketGateway::class],
|
|
|
|
$this->get[UserToTicketChecker::class]);
|
2017-02-13 22:34:15 -05:00
|
|
|
$this->get[TicketValidators::class] = new TicketValidators($this->get[TicketGateway::class]);
|
|
|
|
$this->get[TrackingIdGenerator::class] = new TrackingIdGenerator($this->get[TicketGateway::class]);
|
2017-03-12 00:44:50 -05:00
|
|
|
$this->get[Autoassigner::class] = new Autoassigner($this->get[CategoryGateway::class], $this->get[UserGateway::class]);
|
2017-02-13 22:34:15 -05:00
|
|
|
$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],
|
2017-02-16 21:46:47 -05:00
|
|
|
$this->get[StatusGateway::class],
|
2017-03-09 21:55:32 -05:00
|
|
|
$this->get[TicketGateway::class],
|
|
|
|
$this->get[VerifiedEmailChecker::class],
|
|
|
|
$this->get[EmailSenderHelper::class],
|
2017-03-12 00:44:50 -05:00
|
|
|
$this->get[UserGateway::class],
|
|
|
|
$this->get[ModsForHeskSettingsGateway::class]);
|
2017-03-20 22:16:35 -04:00
|
|
|
$this->get[FileWriter::class] = new FileWriter();
|
2017-04-09 22:14:13 -04:00
|
|
|
$this->get[FileReader::class] = new FileReader();
|
2017-04-12 22:00:56 -04:00
|
|
|
$this->get[FileDeleter::class] = new FileDeleter();
|
2017-03-20 22:16:35 -04:00
|
|
|
$this->get[AttachmentGateway::class] = new AttachmentGateway();
|
|
|
|
$this->get[AttachmentHandler::class] = new AttachmentHandler($this->get[TicketGateway::class],
|
|
|
|
$this->get[AttachmentGateway::class],
|
2017-04-09 22:14:13 -04:00
|
|
|
$this->get[FileWriter::class],
|
2017-04-12 22:00:56 -04:00
|
|
|
$this->get[UserToTicketChecker::class],
|
|
|
|
$this->get[FileDeleter::class]);
|
2017-04-09 22:14:13 -04:00
|
|
|
$this->get[AttachmentRetriever::class] = new AttachmentRetriever($this->get[AttachmentGateway::class],
|
|
|
|
$this->get[FileReader::class],
|
|
|
|
$this->get[TicketGateway::class],
|
|
|
|
$this->get[UserToTicketChecker::class]);
|
2017-04-23 22:08:48 -04:00
|
|
|
$this->get[TicketDeleter::class] =
|
|
|
|
new TicketDeleter($this->get[TicketGateway::class],
|
|
|
|
$this->get[UserToTicketChecker::class],
|
|
|
|
$this->get[AttachmentHandler::class]);
|
2017-04-28 12:36:48 -04:00
|
|
|
$this->get[TicketEditor::class] =
|
|
|
|
new TicketEditor($this->get[TicketGateway::class], $this->get[UserToTicketChecker::class]);
|
2017-04-28 13:03:25 -04:00
|
|
|
|
|
|
|
// Statuses
|
|
|
|
$this->get[StatusRetriever::class] = new StatusRetriever($this->get[StatusGateway::class]);
|
2017-04-28 22:15:59 -04:00
|
|
|
|
|
|
|
// Settings
|
|
|
|
$this->get[SettingsRetriever::class] = new SettingsRetriever($this->get[ModsForHeskSettingsGateway::class]);
|
2017-01-28 01:28:53 -05:00
|
|
|
}
|
|
|
|
}
|