Completed
Push — master ( ba7d13...90f2d9 )
by Daniel
01:57
created

Salariu   A

Complexity

Total Complexity 29

Size/Duplication

Total Lines 331
Duplicated Lines 2.11 %

Coupling/Cohesion

Components 1
Dependencies 8

Importance

Changes 24
Bugs 0 Features 2
Metric Value
wmc 29
c 24
b 0
f 2
lcom 1
cbo 8
dl 7
loc 331
rs 10

18 Methods

Rating   Name   Duplication   Size   Complexity  
A getValuesPrimary() 0 16 2
A getOvertimes() 0 12 1
A getWorkingDays() 0 10 1
A __construct() 0 20 1
A getIncomeTaxValue() 0 12 3
A getValues() 0 18 1
A setFormInput() 0 21 1
A setFormInputBottom() 0 9 1
A setFormInputElements() 0 22 1
A setFormInputIntoFieldSet() 0 8 1
A setFormInputText() 0 16 2
A setFormOutput() 0 52 1
A setFormOutputBonuses() 0 23 1
A setFormOutputHeader() 0 12 2
A setFormOutputTaxations() 7 18 4
A setFormRow() 0 18 3
A setFormRowAmount() 0 12 2
A setFrmRowTwoLbls() 0 5 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
/**
4
 *
5
 * The MIT License (MIT)
6
 *
7
 * Copyright (c) 2016 Daniel Popiniuc
8
 *
9
 * Permission is hereby granted, free of charge, to any person obtaining a copy
10
 * of this software and associated documentation files (the "Software"), to deal
11
 * in the Software without restriction, including without limitation the rights
12
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
 * copies of the Software, and to permit persons to whom the Software is
14
 * furnished to do so, subject to the following conditions:
15
 *
16
 * The above copyright notice and this permission notice shall be included in all
17
 * copies or substantial portions of the Software.
18
 *
19
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
 *  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
 * SOFTWARE.
26
 *
27
 */
28
29
namespace danielgp\salariu;
30
31
class Salariu
32
{
33
34
    use \danielgp\bank_holidays\Romanian,
35
        \danielgp\salariu\FormattingSalariu,
36
        \danielgp\salariu\Bonuses,
37
        \danielgp\salariu\ForeignCurrency,
38
        \danielgp\salariu\Taxation;
39
40
    public function __construct()
41
    {
42
        $configPath     = 'Salariu' . DIRECTORY_SEPARATOR . 'config';
43
        $inElmnts       = $this->readTypeFromJsonFileUniversal($configPath, 'interfaceElements');
44
        $this->appFlags = [
45
            'FI'   => $inElmnts['Form Input'],
46
            'TCAS' => $inElmnts['Table Cell Applied Style'],
47
            'TCSD' => $inElmnts['Table Cell Style Definitions'],
48
        ];
49
        $this->initializeSprGlbAndSession();
50
        $this->handleLocalizationSalariu($inElmnts['Application']);
51
        echo $this->setHeaderHtml();
52
        $this->establishLocalizationToDisplay();
53
        $dtR            = $this->dateRangesInScope();
54
        $ymValues       = $this->buildYMvalues($dtR);
55
        $arySts         = $this->readTypeFromJsonFileUniversal($configPath, 'valuesToCompute');
56
        echo $this->setFormInput($dtR, $ymValues, $arySts['Minimum Wage'], $inElmnts['Values Filter Rules']);
57
        echo $this->setFormOutput($dtR, $arySts, $inElmnts);
58
        echo $this->setFooterHtml($inElmnts['Application']);
59
    }
60
61
    private function getIncomeTaxValue($inDate, $lngBase, $vBA, $aryDeductions, $arySettings)
62
    {
63
        $rest = $lngBase - array_sum($aryDeductions);
64
        if ($inDate >= 20100701) {
65
            $rest += round($vBA, -4);
66
            if ($inDate >= 20101001) {
67
                $rest += round($this->tCmnSuperGlobals->request->get('gbns') * pow(10, 4), -4);
68
            }
69
        }
70
        $rest += $this->tCmnSuperGlobals->request->get('afet') * pow(10, 4);
71
        return $this->setIncomeTax($inDate, $rest, $arySettings['Income Tax']);
72
    }
73
74
    private function getOvertimes($aryStngs)
75
    {
76
        $pcToBoolean = [0 => true, 1 => false];
77
        $pcBoolean   = $pcToBoolean[$this->tCmnSuperGlobals->request->get('pc')];
78
        $ymVal       = (string) $this->tCmnSuperGlobals->request->get('ym');
79
        $snVal       = $this->tCmnSuperGlobals->request->get('sn');
80
        $mnth        = $this->setMonthlyAverageWorkingHours($ymVal, $aryStngs, $pcBoolean);
81
        return [
82
            'os175' => ceil($this->tCmnSuperGlobals->request->get('os175') * 1.75 * $snVal / $mnth),
83
            'os200' => ceil($this->tCmnSuperGlobals->request->get('os200') * 2 * $snVal / $mnth),
84
        ];
85
    }
86
87
    private function getValues($dtR, $lngBase, $aStngs, $shLabels)
88
    {
89
        $inDate             = $this->tCmnSuperGlobals->request->get('ym');
90
        $aReturn            = $this->getValuesPrimary($dtR, $inDate, $lngBase, $aStngs, $shLabels);
91
        $pdV                = [
92
            ($lngBase + $aReturn['ba']),
93
            $this->tCmnSuperGlobals->request->get('pi'),
94
        ];
95
        $aReturn['pd']      = $this->setPersonalDeduction($inDate, $pdV[0], $pdV[1], $aStngs['Personal Deduction']);
96
        $aryDeductions      = [
97
            $this->txLvl['cas'],
98
            $this->txLvl['snt'],
99
            $this->txLvl['smj'],
100
            $aReturn['pd'],
101
        ];
102
        $aReturn['impozit'] = $this->getIncomeTaxValue($inDate, $lngBase, $aReturn['ba'], $aryDeductions, $aStngs);
103
        return $aReturn;
104
    }
105
106
    private function getValuesPrimary($dtR, $inDate, $lngBase, $aStngs, $shLbl)
107
    {
108
        $this->setHealthFundTax($inDate, $lngBase, $aStngs[$shLbl['HFP']], $aStngs[$shLbl['HFUL']]);
109
        $this->setHealthTax($inDate, $lngBase, $aStngs[$shLbl['HTP']], $aStngs[$shLbl['HFUL']]);
110
        $nMealDays        = $this->tCmnSuperGlobals->request->get('nDays');
111
        $unemploymentBase = $lngBase;
112
        if ($this->tCmnSuperGlobals->request->get('ym') < 20080101) {
113
            $unemploymentBase = $this->tCmnSuperGlobals->request->get('sn');
114
        }
115
        $this->setUnemploymentTax($inDate, $unemploymentBase);
116
        return [
117
            'b1'   => $this->setFoodTicketsValue($dtR, $inDate, $aStngs[$shLbl['MTV']]),
118
            'ba'   => $this->setFoodTicketsValue($dtR, $inDate, $aStngs[$shLbl['MTV']]) * $nMealDays,
119
            'gbns' => $this->tCmnSuperGlobals->request->get('gbns') * pow(10, 4),
120
        ];
121
    }
122
123
    private function getWorkingDays()
124
    {
125
        $components = [
126
            \DateTime::createFromFormat('Ymd', $this->tCmnSuperGlobals->request->get('ym')),
127
            $this->tCmnSuperGlobals->request->get('pc'),
128
        ];
129
        $this->tCmnSuperGlobals->request->set('wkDays', $this->setWorkingDaysInMonth($components[0], $components[1]));
0 ignored issues
show
Security Bug introduced by
It seems like $components[0] can also be of type false; however, danielgp\bank_holidays\R...setWorkingDaysInMonth() does only seem to accept object<DateTime>, did you maybe forget to handle an error condition?
Loading history...
130
        $vDays      = $this->tCmnSuperGlobals->request->get('wkDays') - $this->tCmnSuperGlobals->request->get('zfb');
131
        $this->tCmnSuperGlobals->request->set('nDays', max($vDays, 0));
132
    }
133
134
    private function setFormInput($dtR, $ymValues, $inMW, $inVFR)
135
    {
136
        $this->applyYMvalidations($this->tCmnSuperGlobals, $ymValues, $dtR);
137
        $minWage   = $this->determineCrtMinWage($this->tCmnSuperGlobals, [
138
            'EMW'      => $inMW,
139
            'YM range' => $dtR
140
        ]);
141
        $this->processFormInputDefaults($this->tCmnSuperGlobals, [
142
            'VFR'               => $inVFR,
143
            'Year Month Values' => $ymValues,
144
            'MW'                => $minWage,
145
            'YM range'          => $dtR,
146
        ]);
147
        $sReturn   = $this->setFormInputElements($ymValues, $minWage);
148
        $sReturn[] = $this->setFormInputBottom();
149
        $frm       = $this->setStringIntoTag($this->setStringIntoTag(implode('', $sReturn), 'table'), 'form', [
150
            'method' => 'get',
151
            'action' => $this->tCmnSuperGlobals->getScriptName()
152
        ]);
153
        return $this->setFormInputIntoFieldSet($frm);
154
    }
155
156
    private function setFormInputBottom()
157
    {
158
        $btn = $this->setStringIntoShortTag('input', [
159
            'type'  => 'submit',
160
            'id'    => 'submit',
161
            'value' => $this->tApp->gettext('i18n_Form_Button_Recalculate')
162
        ]);
163
        return $this->setFormRow($this->setLabel('fd'), $btn, 1) . '</tbody>';
164
    }
165
166
    private function setFormInputElements($ymValues, $crtMinWage)
167
    {
168
        $sReturn   = [];
169
        $sReturn[] = '<thead><tr><th>' . $this->tApp->gettext('i18n_Form_Label_InputElements')
170
            . '</th><th>' . $this->tApp->gettext('i18n_Form_Label_InputValues') . '</th></tr></thead><tbody>';
171
        $sReturn[] = $this->setFormRow($this->setLabel('ym'), $this->setFormInputSelectYM($ymValues), 1);
172
        $sReturn[] = $this->setFormRow($this->setLabel('sm'), $this->setFormInputText('sm', 10, 'RON', $crtMinWage), 1);
173
        $sReturn[] = $this->setFormRow($this->setLabel('sn'), $this->setFormInputText('sn', 10, 'RON'), 1);
174
        $sReturn[] = $this->setFormRow($this->setLabel('sc'), $this->setFormInputText('sc', 7, '%'), 1);
175
        $sReturn[] = $this->setFormRow($this->setLabel('pb'), $this->setFormInputText('pb', 10, 'RON'), 1);
176
        $sReturn[] = $this->setFormRow($this->setLabel('pn'), $this->setFormInputText('pn', 10, 'RON'), 1);
177
        $sReturn[] = $this->setFormRow($this->setLabel('os175'), $this->setFormInputText('os175', 2, 'ore'), 1);
178
        $sReturn[] = $this->setFormRow($this->setLabel('os200'), $this->setFormInputText('os200', 2, 'ore'), 1);
179
        $sReturn[] = $this->setFormRow($this->setLabel('pi'), $this->setFormInputSelectPI(), 1);
180
        $sReturn[] = $this->setFormRow($this->setLabel('pc'), $this->setFormInputSelectPC(), 1);
181
        $sReturn[] = $this->setFormRow($this->setLabel('szamnt'), $this->setFormInputText('szamnt', 10, 'RON'), 1);
182
        $sReturn[] = $this->setFormRow($this->setLabel('zfb'), $this->setFormInputText('zfb', 2, 'zile'), 1);
183
        $sReturn[] = $this->setFormRow($this->setLabel('zfs'), $this->setFormInputText('zfs', 2, 'zile'), 1);
184
        $sReturn[] = $this->setFormRow($this->setLabel('gbns'), $this->setFormInputText('gbns', 10, 'RON'), 1);
185
        $sReturn[] = $this->setFormRow($this->setLabel('afet'), $this->setFormInputText('afet', 10, 'RON'), 1);
186
        return $sReturn;
187
    }
188
189
    private function setFormInputIntoFieldSet($frm)
190
    {
191
        $aryFieldSet = [
192
            $this->setStringIntoTag($this->tApp->gettext('i18n_FieldsetLabel_Inputs'), 'legend'),
193
            $frm
194
        ];
195
        return $this->setStringIntoTag(implode('', $aryFieldSet), 'fieldset', ['style' => 'float: left;']);
196
    }
197
198
    private function setFormInputText($inName, $inSize, $inAfterLabel, $crtMinWage = 0)
199
    {
200
        $inputParameters = [
201
            'type'      => 'text',
202
            'name'      => $inName,
203
            'value'     => $this->tCmnSuperGlobals->request->get($inName),
204
            'size'      => $inSize,
205
            'maxlength' => $inSize,
206
        ];
207
        if ($inName == 'sm') {
208
            $inputParameters['readonly'] = 'readonly';
209
            $inputParameters['value']    = $crtMinWage;
210
            $this->tCmnSuperGlobals->request->set('sm', $crtMinWage);
211
        }
212
        return $this->setStringIntoShortTag('input', $inputParameters) . ' ' . $inAfterLabel;
213
    }
214
215
    private function setFormOutput($dtR, $aryStngs, $inElements)
216
    {
217
        $sReturn     = [];
218
        $this->setExchangeRateValues($inElements['Application'], $inElements['Relevant Currencies']);
219
        $sReturn[]   = $this->setFormOutputHeader();
220
        $ovTimeVal   = $this->getOvertimes($aryStngs['Monthly Average Working Hours']);
221
        $additions   = $this->tCmnSuperGlobals->request->get('pb') + $ovTimeVal['os175'] + $ovTimeVal['os200'];
222
        $this->getWorkingDays();
223
        $bComponents = [
224
            'sc'   => $this->tCmnSuperGlobals->request->get('sc'),
225
            'sn'   => $this->tCmnSuperGlobals->request->get('sn'),
226
            'zile' => $this->tCmnSuperGlobals->request->get('wkDays'),
227
        ];
228
        $xDate       = '<span style="font-size:smaller;">' . date('d.m.Y', $this->currencyDetails['CXD']) . '</span>';
229
        $sReturn[]   = $this->setFrmRowTwoLbls($this->setLabel('xrate@Date'), $xDate, pow(10, 7));
230
        $snValue     = $this->tCmnSuperGlobals->request->get('sn') * pow(10, 4);
231
        $amntLAA     = round(($this->tCmnSuperGlobals->request->get('zfs') / $bComponents['zile']) * $snValue, -4);
232
        $sReturn[]   = $this->setFormOutputBonuses($snValue, $bComponents['zile'], $amntLAA, $ovTimeVal);
233
        $brut        = ($bComponents['sn'] * (1 + $bComponents['sc'] / 100) + $additions) * pow(10, 4) - $amntLAA;
234
        $sReturn[]   = $this->setFrmRowTwoLbls($this->setLabel('sb'), '&nbsp;', $brut);
235
        $brut2       = $brut + $this->tCmnSuperGlobals->request->get('afet') * pow(10, 4);
236
        $amnt        = $this->getValues($dtR, $brut2, $aryStngs, $inElements['Short Labels']);
237
        $sReturn[]   = $this->setFormOutputTaxations($brut2, $amnt);
238
        $pnValue     = $this->tCmnSuperGlobals->request->get('pn') * pow(10, 4);
239
        $sReturn[]   = $this->setFrmRowTwoLbls($this->setLabel('pn'), '&nbsp;', $pnValue);
240
        $retineri    = $this->txLvl['cas'] + $this->txLvl['smj'] + $this->txLvl['snt'] + $amnt['impozit'];
241
        $net         = $brut2 - $retineri + $this->tCmnSuperGlobals->request->get('pn') * pow(10, 4);
242
        $sReturn[]   = $this->setFrmRowTwoLbls($this->setLabel('ns'), '&nbsp;', $net);
243
        $szamntValue = $this->tCmnSuperGlobals->request->get('szamnt') * pow(10, 4);
244
        $sReturn[]   = $this->setFrmRowTwoLbls($this->setLabel('szamnt'), '&nbsp;', $szamntValue);
245
        $nsc         = $net - $this->tCmnSuperGlobals->request->get('szamnt') * pow(10, 4);
246
        $sReturn[]   = $this->setFrmRowTwoLbls($this->setLabel('nsc'), '&nbsp;', $nsc);
247
        $fBonus      = [
248
            'main'   => $this->setLabel('gb'),
249
            'value'  => $this->tApp->gettext('i18n_Form_Label_FoodBonusesChoiceValue'),
250
            'mtDays' => $this->tCmnSuperGlobals->request->get('nDays') . '&nbsp;/&nbsp;' . $bComponents['zile']
251
        ];
252
        $fBonusTxt   = sprintf($fBonus['main'], $fBonus['value']);
253
        $sReturn[]   = $this->setFrmRowTwoLbls($fBonusTxt, $fBonus['mtDays'], $amnt['ba']);
254
        $sReturn[]   = $this->setFrmRowTwoLbls($this->setLabel('gbns'), '&nbsp;', $amnt['gbns']);
255
        $total       = ($net + $amnt['ba'] + $amnt['gbns'] - $this->tCmnSuperGlobals->request->get('szamnt') * 10000);
256
        $sReturn[]   = $this->setFrmRowTwoLbls($this->setLabel('total'), '&nbsp;', $total);
257
        $sReturn[]   = '</tbody>';
258
        $tDate       = \DateTime::createFromFormat('Ymd', $this->tCmnSuperGlobals->request->get('ym'));
259
        $legentText  = sprintf($this->tApp->gettext('i18n_FieldsetLabel_Results')
260
            . '', strftime('%B', mktime(0, 0, 0, $tDate->format('n'), 1, $tDate->format('Y'))), $tDate->format('Y'));
261
        $fieldsetC   = $this->setStringIntoTag($legentText, 'legend')
262
            . $this->setStringIntoTag(implode('', $sReturn), 'table');
263
        return $this->setStringIntoTag($fieldsetC, 'fieldset', [
264
                'style' => 'float: left;'
265
        ]);
266
    }
267
268
    private function setFormOutputBonuses($snValue, $wkDays, $amntLAA, $ovTimeVal)
269
    {
270
        $sRt      = [];
271
        $sMin     = $this->tCmnSuperGlobals->request->get('sm') * pow(10, 4);
272
        $sRt[]    = $this->setFrmRowTwoLbls($this->setLabel('sm'), '&nbsp;', $sMin);
273
        $sRt[]    = $this->setFrmRowTwoLbls($this->setLabel('sn'), '&nbsp;', $snValue);
274
        $scValue  = $this->tCmnSuperGlobals->request->get('sc');
275
        $prima    = $this->tCmnSuperGlobals->request->get('sn') * $scValue * 100;
276
        $sRt[]    = $this->setFrmRowTwoLbls($this->setLabel('sc'), $scValue . '%', $prima);
277
        $pbValue  = $this->tCmnSuperGlobals->request->get('pb') * pow(10, 4);
278
        $sRt[]    = $this->setFrmRowTwoLbls($this->setLabel('pb'), '&nbsp;', $pbValue);
279
        $ovTime   = [
280
            'o1' => $this->tCmnSuperGlobals->request->get('os175'),
281
            'o2' => $this->tCmnSuperGlobals->request->get('os200'),
282
        ];
283
        $sRt[]    = $this->setFrmRowTwoLbls($this->setLabel('ovAmount1'), '<span style="font-size:smaller;">'
284
            . $ovTime['o1'] . 'h&nbsp;x&nbsp;175%</span>', $ovTimeVal['os175'] * pow(10, 4));
285
        $sRt[]    = $this->setFrmRowTwoLbls($this->setLabel('ovAmount2'), '<span style="font-size:smaller;">'
286
            . $ovTime['o2'] . 'h&nbsp;x&nbsp;200%</span>', $ovTimeVal['os200'] * pow(10, 4));
287
        $fLeaveAA = $this->tCmnSuperGlobals->request->get('zfs') . '&nbsp;/&nbsp;' . $wkDays;
288
        $sRt[]    = $this->setFrmRowTwoLbls($this->setLabel('zfsa'), $fLeaveAA, $amntLAA);
289
        return implode('', $sRt);
290
    }
291
292
    private function setFormOutputHeader()
293
    {
294
        $sReturn   = [];
295
        $sReturn[] = '<thead><tr><th>' . $this->tApp->gettext('i18n_Form_Label_ResultedElements') . '</th>';
296
        $sReturn[] = '<th><i class="fa fa-map-signs floatRight" style="font-size:2em;">&nbsp;</i></th>';
297
        foreach ($this->currencyDetails['CX'] as $value) {
298
            $sReturn[] = '<th style="text-align:center;"><span class="flag-icon flag-icon-' . $value['country']
299
                . '" style="font-size:2em;" title="'
300
                . $this->tApp->gettext('i18n_CountryName_' . strtoupper($value['country'])) . '">&nbsp;</span></th>';
301
        }
302
        return implode('', $sReturn) . '</tr></thead></tbody>';
303
    }
304
305
    private function setFormOutputTaxations($brut, $amnt)
306
    {
307
        $sRn              = [];
308
        $limitDisplayBase = false;
309 View Code Duplication
        if ($brut > $this->txLvl['casP_base']) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
310
            $limitDisplayBase = true;
311
            $sRn[]            = $this->setFrmRowTwoLbls($this->setLabel('cas_base'), '', $this->txLvl['casP_base']);
312
        }
313
        $sRn[] = $this->setFrmRowTwoLbls($this->setLabel('cas'), $this->txLvl['casP'] . '%', $this->txLvl['cas']);
314
        $sRn[] = $this->setFrmRowTwoLbls($this->setLabel('somaj'), $this->txLvl['smjP'] . '%', $this->txLvl['smj']);
315 View Code Duplication
        if ($limitDisplayBase && array_key_exists('sntP_base', $this->txLvl)) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
316
            $sRn[] = $this->setFrmRowTwoLbls($this->setLabel('sntP_base'), '', $this->txLvl['sntP_base']);
317
        }
318
        $sRn[] = $this->setFrmRowTwoLbls($this->setLabel('sanatate'), $this->txLvl['sntP'] . '%', $this->txLvl['snt']);
319
        $sRn[] = $this->setFrmRowTwoLbls($this->setLabel('pd'), '&nbsp;', $amnt['pd']);
320
        $sRn[] = $this->setFrmRowTwoLbls($this->setLabel('impozit'), $this->txLvl['inTaxP'] . '%', $amnt['impozit']);
321
        return implode('', $sRn);
322
    }
323
324
    private function setFormRow($text, $value, $type = 'amount')
325
    {
326
        $defaultCellStyle = $this->setFormatRow($text, $value);
327
        switch ($type) {
328
            case 'amount':
329
                $value2show = $this->setFormRowAmount(($value / pow(10, 4)), $defaultCellStyle);
330
                break;
331
            case 'value':
332
                $value2show = $this->setStringIntoTag($value, 'td', array_merge($defaultCellStyle, [
333
                    'colspan' => count($this->currencyDetails['CX'])
334
                ]));
335
                break;
336
            default:
337
                $value2show = $this->setStringIntoTag($value, 'td');
338
                break;
339
        }
340
        return $this->setStringIntoTag($this->setStringIntoTag($text, 'td', $defaultCellStyle) . $value2show, 'tr');
341
    }
342
343
    private function setFormRowAmount($value, $defaultCellStyle)
344
    {
345
        $cellValue                 = [];
346
        $defaultCellStyle['style'] .= 'text-align:right;';
347
        foreach ($this->currencyDetails['CX'] as $key2 => $value2) {
348
            $fmt         = new \NumberFormatter($value2['locale'], \NumberFormatter::CURRENCY);
349
            $fmt->setAttribute(\NumberFormatter::FRACTION_DIGITS, $value2['decimals']);
350
            $finalValue  = $fmt->formatCurrency($value / $this->currencyDetails['CXV'][$key2], $key2);
351
            $cellValue[] = $this->setStringIntoTag($finalValue, 'td', $defaultCellStyle);
352
        }
353
        return implode('', $cellValue);
354
    }
355
356
    private function setFrmRowTwoLbls($text1, $text2, $value)
357
    {
358
        return str_replace(':</td>', ':</td><td class="labelS" style="text-align:right;">'
359
            . $text2 . '</td>', $this->setFormRow($text1, $value, 'amount'));
360
    }
361
}
362