1 | <?php |
||
2 | /** |
||
3 | * FireflyServiceProvider.php |
||
4 | * Copyright (c) 2017 [email protected] |
||
5 | * |
||
6 | * This file is part of Firefly III. |
||
7 | * |
||
8 | * Firefly III is free software: you can redistribute it and/or modify |
||
9 | * it under the terms of the GNU General Public License as published by |
||
10 | * the Free Software Foundation, either version 3 of the License, or |
||
11 | * (at your option) any later version. |
||
12 | * |
||
13 | * Firefly III is distributed in the hope that it will be useful, |
||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
16 | * GNU General Public License for more details. |
||
17 | * |
||
18 | * You should have received a copy of the GNU General Public License |
||
19 | * along with Firefly III. If not, see <http://www.gnu.org/licenses/>. |
||
20 | */ |
||
21 | declare(strict_types=1); |
||
22 | |||
23 | namespace FireflyIII\Providers; |
||
24 | |||
25 | use FireflyIII\Export\ExpandedProcessor; |
||
26 | use FireflyIII\Export\ProcessorInterface; |
||
27 | use FireflyIII\Generator\Chart\Basic\ChartJsGenerator; |
||
28 | use FireflyIII\Generator\Chart\Basic\GeneratorInterface; |
||
29 | use FireflyIII\Helpers\Attachments\AttachmentHelper; |
||
30 | use FireflyIII\Helpers\Attachments\AttachmentHelperInterface; |
||
31 | use FireflyIII\Helpers\Chart\MetaPieChart; |
||
32 | use FireflyIII\Helpers\Chart\MetaPieChartInterface; |
||
33 | use FireflyIII\Helpers\FiscalHelper; |
||
34 | use FireflyIII\Helpers\FiscalHelperInterface; |
||
35 | use FireflyIII\Helpers\Help\Help; |
||
36 | use FireflyIII\Helpers\Help\HelpInterface; |
||
37 | use FireflyIII\Helpers\Report\BalanceReportHelper; |
||
38 | use FireflyIII\Helpers\Report\BalanceReportHelperInterface; |
||
39 | use FireflyIII\Helpers\Report\BudgetReportHelper; |
||
40 | use FireflyIII\Helpers\Report\BudgetReportHelperInterface; |
||
41 | use FireflyIII\Helpers\Report\NetWorth; |
||
42 | use FireflyIII\Helpers\Report\NetWorthInterface; |
||
43 | use FireflyIII\Helpers\Report\PopupReport; |
||
44 | use FireflyIII\Helpers\Report\PopupReportInterface; |
||
45 | use FireflyIII\Helpers\Report\ReportHelper; |
||
46 | use FireflyIII\Helpers\Report\ReportHelperInterface; |
||
47 | use FireflyIII\Repositories\User\UserRepository; |
||
48 | use FireflyIII\Repositories\User\UserRepositoryInterface; |
||
49 | use FireflyIII\Services\Currency\ExchangeRateInterface; |
||
50 | use FireflyIII\Services\Currency\FixerIOv2; |
||
51 | use FireflyIII\Services\IP\IpifyOrg; |
||
52 | use FireflyIII\Services\IP\IPRetrievalInterface; |
||
53 | use FireflyIII\Services\Password\PwndVerifierV2; |
||
54 | use FireflyIII\Services\Password\Verifier; |
||
55 | use FireflyIII\Support\Amount; |
||
56 | use FireflyIII\Support\ExpandedForm; |
||
57 | use FireflyIII\Support\FireflyConfig; |
||
58 | use FireflyIII\Support\Navigation; |
||
59 | use FireflyIII\Support\Preferences; |
||
60 | use FireflyIII\Support\Steam; |
||
61 | use FireflyIII\Support\Twig\AmountFormat; |
||
62 | use FireflyIII\Support\Twig\General; |
||
63 | use FireflyIII\Support\Twig\Journal; |
||
64 | use FireflyIII\Support\Twig\Loader\AccountLoader; |
||
65 | use FireflyIII\Support\Twig\Loader\TransactionJournalLoader; |
||
66 | use FireflyIII\Support\Twig\Loader\TransactionLoader; |
||
67 | use FireflyIII\Support\Twig\Rule; |
||
68 | use FireflyIII\Support\Twig\Transaction; |
||
69 | use FireflyIII\Support\Twig\Translation; |
||
70 | use FireflyIII\Validation\FireflyValidator; |
||
71 | use Illuminate\Foundation\Application; |
||
72 | use Illuminate\Support\ServiceProvider; |
||
73 | use Twig; |
||
74 | use Twig_Extension_Debug; |
||
75 | use TwigBridge\Extension\Loader\Functions; |
||
76 | use Validator; |
||
77 | |||
78 | /** |
||
79 | * |
||
80 | * Class FireflyServiceProvider. |
||
81 | * |
||
82 | * @codeCoverageIgnore |
||
83 | * @SuppressWarnings(PHPMD.CouplingBetweenObjects) |
||
84 | */ |
||
85 | class FireflyServiceProvider extends ServiceProvider |
||
86 | { |
||
87 | /** |
||
88 | * Start provider. |
||
89 | */ |
||
90 | public function boot(): void |
||
91 | { |
||
92 | Validator::resolver( |
||
93 | /** @noinspection MoreThanThreeArgumentsInspection */ |
||
94 | function ($translator, $data, $rules, $messages) { |
||
95 | return new FireflyValidator($translator, $data, $rules, $messages); |
||
96 | } |
||
97 | ); |
||
98 | $config = app('config'); |
||
99 | Twig::addExtension(new Functions($config)); |
||
100 | Twig::addRuntimeLoader(new TransactionLoader); |
||
101 | Twig::addRuntimeLoader(new AccountLoader); |
||
102 | Twig::addRuntimeLoader(new TransactionJournalLoader); |
||
103 | Twig::addExtension(new General); |
||
104 | Twig::addExtension(new Journal); |
||
105 | Twig::addExtension(new Translation); |
||
106 | Twig::addExtension(new Transaction); |
||
107 | Twig::addExtension(new Rule); |
||
108 | Twig::addExtension(new AmountFormat); |
||
109 | Twig::addExtension(new Twig_Extension_Debug); |
||
110 | } |
||
111 | |||
112 | /** |
||
113 | * Register stuff. |
||
114 | * |
||
115 | * @SuppressWarnings(PHPMD.ExcessiveMethodLength) |
||
116 | */ |
||
117 | public function register(): void |
||
118 | { |
||
119 | $this->app->bind( |
||
120 | 'preferences', |
||
121 | function () { |
||
122 | return new Preferences; |
||
123 | } |
||
124 | ); |
||
125 | |||
126 | $this->app->bind( |
||
127 | 'fireflyconfig', |
||
128 | function () { |
||
129 | return new FireflyConfig; |
||
130 | } |
||
131 | ); |
||
132 | $this->app->bind( |
||
133 | 'navigation', |
||
134 | function () { |
||
135 | return new Navigation; |
||
136 | } |
||
137 | ); |
||
138 | $this->app->bind( |
||
139 | 'amount', |
||
140 | function () { |
||
141 | return new Amount; |
||
142 | } |
||
143 | ); |
||
144 | |||
145 | $this->app->bind( |
||
146 | 'steam', |
||
147 | function () { |
||
148 | return new Steam; |
||
149 | } |
||
150 | ); |
||
151 | $this->app->bind( |
||
152 | 'expandedform', |
||
153 | function () { |
||
154 | return new ExpandedForm; |
||
155 | } |
||
156 | ); |
||
157 | |||
158 | // chart generator: |
||
159 | $this->app->bind(GeneratorInterface::class, ChartJsGenerator::class); |
||
160 | |||
161 | // chart builder |
||
162 | $this->app->bind( |
||
163 | MetaPieChartInterface::class, |
||
164 | function (Application $app) { |
||
165 | /** @var MetaPieChart $chart */ |
||
166 | $chart = app(MetaPieChart::class); |
||
167 | if ($app->auth->check()) { |
||
168 | $chart->setUser(auth()->user()); |
||
169 | } |
||
170 | |||
171 | return $chart; |
||
172 | } |
||
173 | ); |
||
174 | |||
175 | // other generators |
||
176 | // export: |
||
177 | $this->app->bind(ProcessorInterface::class, ExpandedProcessor::class); |
||
178 | $this->app->bind(UserRepositoryInterface::class, UserRepository::class); |
||
179 | $this->app->bind(AttachmentHelperInterface::class, AttachmentHelper::class); |
||
180 | |||
181 | // more generators: |
||
182 | $this->app->bind(PopupReportInterface::class, PopupReport::class); |
||
183 | $this->app->bind(HelpInterface::class, Help::class); |
||
184 | $this->app->bind(ReportHelperInterface::class, ReportHelper::class); |
||
185 | $this->app->bind(FiscalHelperInterface::class, FiscalHelper::class); |
||
186 | $this->app->bind(BalanceReportHelperInterface::class, BalanceReportHelper::class); |
||
187 | $this->app->bind(BudgetReportHelperInterface::class, BudgetReportHelper::class); |
||
188 | $class = (string)config(sprintf('firefly.cer_providers.%s', (string)config('firefly.cer_provider'))); |
||
189 | if('' === $class) { |
||
190 | throw new FireflyException('Invalid currency exchange rate provider. Cannot continue.'); |
||
0 ignored issues
–
show
|
|||
191 | } |
||
192 | $this->app->bind(ExchangeRateInterface::class, $class); |
||
193 | |||
194 | // password verifier thing |
||
195 | $this->app->bind(Verifier::class, PwndVerifierV2::class); |
||
196 | |||
197 | // IP thing: |
||
198 | $this->app->bind(IPRetrievalInterface::class, IpifyOrg::class); |
||
199 | |||
200 | // net worth thing. |
||
201 | $this->app->bind(NetWorthInterface::class, NetWorth::class); |
||
202 | } |
||
203 | } |
||
204 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths