RprtCli/app/dependencies.php

75 lines
2.5 KiB
PHP

<?php
use function DI\create;
use function DI\get;
use RprtCli\Commands\RprtCommand;
use RprtCli\Utils\Configuration\ConfigurationInterface;
use RprtCli\Utils\Configuration\ConfigurationService;
use RprtCli\Utils\CsvReport\CsvReport;
use RprtCli\Utils\CsvReport\CsvReportInterface;
use GuzzleHttp\Client;
use Mpdf\Mpdf;
use RprtCli\Utils\Mailer\MailerInterface;
use RprtCli\Utils\Mailer\MailerService;
use RprtCli\Utils\PdfExport\PdfExportInterface;
use RprtCli\Utils\PdfExport\PdfExportService;
use RprtCli\Utils\TimeTrackingServices\YoutrackInterface;
use RprtCli\Utils\TimeTrackingServices\YoutrackService;
# use Symfony\Component\Translation\Translator;
#use Symfony\Component\Translation\Loader\PoFileLoader;
return [
'config.file' => 'rprt.config.yml',
'config.path' => '~/.config/rprt-cli/',
'default_locale' => 'en',
// 'translator' => ['default_path' => '%kernel.project_dir%/translations'],
// 'guzzle' => create()->constructor(Client::class),
'guzzle' => get(Client::class),
'mpdf' => get(Mpdf::class),
ConfigurationInterface::class => get(ConfigurationService::class),
ConfigurationService::class => create()->constructor(
get('config.path'),
get('config.file')
),
'config.service' => get(ConfigurationInterface::class),
YoutrackInterface::class => get(YoutrackService::class),
YoutrackService::class => create()->constructor(
get('config.service'),
get('guzzle')
),
'youtrack.service' => get(YoutrackInterface::class),
PdfExportInterface::class => get(PdfExportService::class),
PdfExportService::class => create()->constructor(
get('config.service'),
get('mpdf')
),
'pdf_export.service' => get(PdfExportInterface::class),
// 'locale' => get('config.service')->method('get', 'en'),
// Translator::class => create()->constructor('sl')->method('addLoader', 'po', new PoFileLoader),
// 'translator' => get(Translator::class),
CsvReportInterface::class => get(CsvReport::class),
CsvReport::class => create()->constructor(
get('config.service')
),
'csv.report' => get(CsvReportInterface::class),
MailerInterface::class => get(MailerService::class),
MailerService::class => create()->constructor(
get('config.service'),
get('pdf_export.service')
),
'mailer' => get(MailerInterface::class),
RprtCommand::class => create()->constructor(
get('csv.report'),
get('config.service'),
get('youtrack.service'),
get('pdf_export.service'),
get('mailer')
),
TrackCommand::class => create()->constructor(
get('config.service'),
get('youtrack.service')
)
];