firefly-iii/app/Providers/FireflyServiceProvider.php

113 lines
3.6 KiB
PHP
Raw Normal View History

2015-02-06 13:43:19 -06:00
<?php
/**
* FireflyServiceProvider.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International License.
*
* See the LICENSE file for details.
*/
2016-02-05 05:08:25 -06:00
declare(strict_types = 1);
2015-02-06 13:43:19 -06:00
namespace FireflyIII\Providers;
2015-02-11 00:35:10 -06:00
use FireflyIII\Support\Amount;
use FireflyIII\Support\ExpandedForm;
use FireflyIII\Support\FireflyConfig;
2015-02-11 00:35:10 -06:00
use FireflyIII\Support\Navigation;
use FireflyIII\Support\Preferences;
use FireflyIII\Support\Steam;
2015-05-01 15:44:35 -05:00
use FireflyIII\Support\Twig\General;
2015-05-02 04:32:45 -05:00
use FireflyIII\Support\Twig\Journal;
use FireflyIII\Support\Twig\PiggyBank;
2016-01-15 01:10:22 -06:00
use FireflyIII\Support\Twig\Rule;
use FireflyIII\Support\Twig\Transaction;
2016-10-10 00:49:55 -05:00
use FireflyIII\Support\Twig\Translation;
2015-02-11 00:35:10 -06:00
use FireflyIII\Validation\FireflyValidator;
2015-02-06 13:43:19 -06:00
use Illuminate\Support\ServiceProvider;
2015-05-01 01:29:41 -05:00
use Twig;
use TwigBridge\Extension\Loader\Functions;
use Validator;
2015-02-06 13:43:19 -06:00
/**
* Class FireflyServiceProvider
*
* @package FireflyIII\Providers
*/
2015-02-06 13:43:19 -06:00
class FireflyServiceProvider extends ServiceProvider
{
2015-02-11 00:35:10 -06:00
public function boot()
{
Validator::resolver(
2015-06-06 16:09:12 -05:00
function ($translator, $data, $rules, $messages) {
2015-02-11 00:35:10 -06:00
return new FireflyValidator($translator, $data, $rules, $messages);
}
);
2015-07-07 12:09:45 -05:00
$config = app('config');
2015-05-01 11:44:49 -05:00
Twig::addExtension(new Functions($config));
2015-05-02 04:32:45 -05:00
Twig::addExtension(new PiggyBank);
2015-05-01 15:44:35 -05:00
Twig::addExtension(new General);
2015-05-02 04:32:45 -05:00
Twig::addExtension(new Journal);
2015-05-09 15:42:45 -05:00
Twig::addExtension(new Translation);
Twig::addExtension(new Transaction);
2016-01-15 01:10:22 -06:00
Twig::addExtension(new Rule);
}
2015-02-11 00:35:10 -06:00
2015-05-17 03:30:18 -05:00
/**
2016-01-02 09:31:14 -06:00
*
2015-05-17 03:30:18 -05:00
*/
2015-02-06 13:43:19 -06:00
public function register()
{
$this->app->bind(
2015-06-06 16:09:12 -05:00
'preferences', function () {
2015-02-11 00:35:10 -06:00
return new Preferences;
2015-02-06 13:43:19 -06:00
}
);
$this->app->bind(
'fireflyconfig', function () {
return new FireflyConfig;
}
);
2015-02-06 14:23:14 -06:00
$this->app->bind(
2015-06-06 16:09:12 -05:00
'navigation', function () {
2015-02-11 00:35:10 -06:00
return new Navigation;
2015-02-06 14:23:14 -06:00
}
);
2015-02-06 23:49:24 -06:00
$this->app->bind(
2015-06-06 16:09:12 -05:00
'amount', function () {
2015-02-11 00:35:10 -06:00
return new Amount;
2015-02-06 23:49:24 -06:00
}
);
$this->app->bind(
2015-06-06 16:09:12 -05:00
'steam', function () {
2015-02-11 00:35:10 -06:00
return new Steam;
}
);
$this->app->bind(
2015-06-06 16:09:12 -05:00
'expandedform', function () {
2015-02-11 00:35:10 -06:00
return new ExpandedForm;
}
);
2015-02-09 00:23:39 -06:00
2016-12-11 09:02:04 -06:00
// chart generator:
$this->app->bind('FireflyIII\Generator\Chart\Basic\GeneratorInterface', 'FireflyIII\Generator\Chart\Basic\ChartJsGenerator');
2016-12-11 09:25:46 -06:00
// other generators
2016-12-11 11:34:18 -06:00
$this->app->bind('FireflyIII\Export\ProcessorInterface', 'FireflyIII\Export\Processor');
2016-12-25 05:55:22 -06:00
$this->app->bind('FireflyIII\Import\ImportProcedureInterface', 'FireflyIII\Import\ImportProcedure');
2016-03-12 07:18:28 -06:00
$this->app->bind('FireflyIII\Repositories\User\UserRepositoryInterface', 'FireflyIII\Repositories\User\UserRepository');
2015-07-18 02:49:59 -05:00
$this->app->bind('FireflyIII\Helpers\Attachments\AttachmentHelperInterface', 'FireflyIII\Helpers\Attachments\AttachmentHelper');
2016-12-25 05:55:22 -06:00
2015-04-07 12:58:49 -05:00
$this->app->bind('FireflyIII\Helpers\Help\HelpInterface', 'FireflyIII\Helpers\Help\Help');
2015-02-23 13:25:48 -06:00
$this->app->bind('FireflyIII\Helpers\Report\ReportHelperInterface', 'FireflyIII\Helpers\Report\ReportHelper');
$this->app->bind('FireflyIII\Helpers\FiscalHelperInterface', 'FireflyIII\Helpers\FiscalHelper');
2016-01-27 14:35:59 -06:00
$this->app->bind('FireflyIII\Helpers\Report\BalanceReportHelperInterface', 'FireflyIII\Helpers\Report\BalanceReportHelper');
$this->app->bind('FireflyIII\Helpers\Report\BudgetReportHelperInterface', 'FireflyIII\Helpers\Report\BudgetReportHelper');
2015-02-06 13:43:19 -06:00
}
2015-03-29 01:14:32 -05:00
}