Completed
Push — master ( 92bae4...b4e17e )
by Daniel
01:59
created

Salariu   A

Complexity

Total Complexity 25

Size/Duplication

Total Lines 298
Duplicated Lines 2.68 %

Coupling/Cohesion

Components 1
Dependencies 10

Importance

Changes 20
Bugs 0 Features 2
Metric Value
wmc 25
c 20
b 0
f 2
lcom 1
cbo 10
dl 8
loc 298
rs 10

15 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 19 1
A getIncomeTaxValue() 0 12 3
A getOvertimes() 0 12 1
A getValues() 0 19 1
A getValuesPrimary() 0 17 2
A getWorkingDays() 0 10 1
A setFormInput() 0 19 1
A setFormInputElements() 0 20 1
A setFormInputText() 0 11 1
A setFormOutput() 0 65 1
A setFormOutputHeader() 0 12 2
B setFormOutputTaxations() 8 22 4
A setFormRow() 0 18 3
A setFormRowAmount() 0 12 2
A setFormRowTwoLabels() 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\InputValidation,
36
        \danielgp\salariu\FormattingSalariu,
37
        \danielgp\salariu\Bonuses,
38
        \danielgp\salariu\ForeignCurrency,
39
        \danielgp\salariu\Taxation;
40
41
    public function __construct()
42
    {
43
        $configPath        = 'Salariu' . DIRECTORY_SEPARATOR . 'config';
44
        $interfaceElements = $this->readTypeFromJsonFileUniversal($configPath, 'interfaceElements');
45
        $this->appFlags    = [
46
            'FI'   => $interfaceElements['Form Input'],
47
            'TCAS' => $interfaceElements['Table Cell Applied Style'],
48
            'TCSD' => $interfaceElements['Table Cell Style Definitions'],
49
        ];
50
        $this->initializeSprGlbAndSession();
51
        $this->handleLocalizationSalariu($interfaceElements['Application']);
52
        echo $this->setHeaderHtml();
53
        $ymValues          = $this->buildYMvalues();
54
        $this->processFormInputDefaults($this->tCmnSuperGlobals, $interfaceElements['Values Filter Rules'], $ymValues);
55
        echo $this->setFormInput($ymValues);
56
        $this->setExchangeRateValues($interfaceElements['Application'], $interfaceElements['Relevant Currencies']);
57
        echo $this->setFormOutput($configPath, $interfaceElements['Short Labels']);
58
        echo $this->setFooterHtml($interfaceElements['Application']);
59
    }
60
61
    private function getIncomeTaxValue($inDate, $lngBase, $vBA, $aryDeductions, $arySettings)
62
    {
63
        $rest = $lngBase - array_sum($aryDeductions);
64
        if ($inDate >= mktime(0, 0, 0, 7, 1, 2010)) {
65
            $rest += round($vBA, -4);
66
            if ($inDate >= mktime(0, 0, 0, 10, 1, 2010)) {
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       = $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($lngBase, $aStngs, $shLabels)
88
    {
89
        $inDate             = $this->tCmnSuperGlobals->request->get('ym');
90
        $this->getWorkingDays();
91
        $aReturn            = $this->getValuesPrimary($inDate, $lngBase, $aStngs, $shLabels);
92
        $pdV                = [
93
            ($lngBase + $aReturn['ba']),
94
            $this->tCmnSuperGlobals->request->get('pi'),
95
        ];
96
        $aReturn['pd']      = $this->setPersonalDeduction($inDate, $pdV[0], $pdV[1], $aStngs['Personal Deduction']);
97
        $aryDeductions      = [
98
            $this->txLvl['cas'],
99
            $this->txLvl['snt'],
100
            $this->txLvl['smj'],
101
            $aReturn['pd'],
102
        ];
103
        $aReturn['impozit'] = $this->getIncomeTaxValue($inDate, $lngBase, $aReturn['ba'], $aryDeductions, $aStngs);
104
        return $aReturn;
105
    }
106
107
    private function getValuesPrimary($inDate, $lngBase, $aStngs, $shLbl)
108
    {
109
        $this->setHealthFundTax($inDate, $lngBase, $aStngs[$shLbl['HFP']], $aStngs[$shLbl['HFUL']]);
110
        $this->setHealthTax($inDate, $lngBase, $aStngs[$shLbl['HTP']], $aStngs[$shLbl['HFUL']]);
111
        $nMealDays        = $this->tCmnSuperGlobals->request->get('nDays');
112
        $unemploymentBase = $lngBase;
113
        if ($this->tCmnSuperGlobals->request->get('ym') < mktime(0, 0, 0, 1, 1, 2008)) {
114
            $unemploymentBase = $this->tCmnSuperGlobals->request->get('sn');
115
        }
116
        $this->setUnemploymentTax($inDate, $unemploymentBase);
117
        return [
118
            'b1'   => $this->setFoodTicketsValue($inDate, $aStngs[$shLbl['MTV']]),
119
            'ba'   => $this->setFoodTicketsValue($inDate, $aStngs[$shLbl['MTV']]) * $nMealDays,
120
            'gbns' => $this->tCmnSuperGlobals->request->get('gbns') * pow(10, 4),
121
            'zile' => $this->tCmnSuperGlobals->request->get('wkDays'),
122
        ];
123
    }
124
125
    private function getWorkingDays()
126
    {
127
        $components = [
128
            new \DateTime(date('Y/m/d', $this->tCmnSuperGlobals->request->get('ym'))),
129
            $this->tCmnSuperGlobals->request->get('pc'),
130
        ];
131
        $this->tCmnSuperGlobals->request->set('wkDays', $this->setWorkingDaysInMonth($components[0], $components[1]));
132
        $vDays      = $this->tCmnSuperGlobals->request->get('wkDays') - $this->tCmnSuperGlobals->request->get('zfb');
133
        $this->tCmnSuperGlobals->request->set('nDays', max($vDays, 0));
134
    }
135
136
    private function setFormInput($ymValues)
137
    {
138
        $sReturn     = $this->setFormInputElements($ymValues);
139
        $btn         = $this->setStringIntoShortTag('input', [
140
            'type'  => 'submit',
141
            'id'    => 'submit',
142
            'value' => $this->tApp->gettext('i18n_Form_Button_Recalculate')
143
        ]);
144
        $sReturn[]   = $this->setFormRow($this->setLabel('fd'), $btn, 1) . '</tbody>';
145
        $frm         = $this->setStringIntoTag($this->setStringIntoTag(implode('', $sReturn), 'table'), 'form', [
146
            'method' => 'get',
147
            'action' => $this->tCmnSuperGlobals->getScriptName()
148
        ]);
149
        $aryFieldSet = [
150
            $this->setStringIntoTag($this->tApp->gettext('i18n_FieldsetLabel_Inputs'), 'legend'),
151
            $frm
152
        ];
153
        return $this->setStringIntoTag(implode('', $aryFieldSet), 'fieldset', ['style' => 'float: left;']);
154
    }
155
156
    private function setFormInputElements($ymValues)
157
    {
158
        $sReturn   = [];
159
        $sReturn[] = '<thead><tr><th>' . $this->tApp->gettext('i18n_Form_Label_InputElements')
160
            . '</th><th>' . $this->tApp->gettext('i18n_Form_Label_InputValues') . '</th></tr></thead><tbody>';
161
        $sReturn[] = $this->setFormRow($this->setLabel('ym'), $this->setFormInputSelectYM($ymValues), 1);
162
        $sReturn[] = $this->setFormRow($this->setLabel('sn'), $this->setFormInputText('sn', 10, 'RON'), 1);
163
        $sReturn[] = $this->setFormRow($this->setLabel('sc'), $this->setFormInputText('sc', 7, '%'), 1);
164
        $sReturn[] = $this->setFormRow($this->setLabel('pb'), $this->setFormInputText('pb', 10, 'RON'), 1);
165
        $sReturn[] = $this->setFormRow($this->setLabel('pn'), $this->setFormInputText('pn', 10, 'RON'), 1);
166
        $sReturn[] = $this->setFormRow($this->setLabel('os175'), $this->setFormInputText('os175', 2, 'ore'), 1);
167
        $sReturn[] = $this->setFormRow($this->setLabel('os200'), $this->setFormInputText('os200', 2, 'ore'), 1);
168
        $sReturn[] = $this->setFormRow($this->setLabel('pi'), $this->setFormInputSelectPI(), 1);
169
        $sReturn[] = $this->setFormRow($this->setLabel('pc'), $this->setFormInputSelectPC(), 1);
170
        $sReturn[] = $this->setFormRow($this->setLabel('szamnt'), $this->setFormInputText('szamnt', 10, 'RON'), 1);
171
        $sReturn[] = $this->setFormRow($this->setLabel('zfb'), $this->setFormInputText('zfb', 2, 'zile'), 1);
172
        $sReturn[] = $this->setFormRow($this->setLabel('gbns'), $this->setFormInputText('gbns', 10, 'RON'), 1);
173
        $sReturn[] = $this->setFormRow($this->setLabel('afet'), $this->setFormInputText('afet', 10, 'RON'), 1);
174
        return $sReturn;
175
    }
176
177
    private function setFormInputText($inName, $inSize, $inAfterLabel)
178
    {
179
        $inputParameters = [
180
            'type'      => 'text',
181
            'name'      => $inName,
182
            'value'     => $this->tCmnSuperGlobals->request->get($inName),
183
            'size'      => $inSize,
184
            'maxlength' => $inSize,
185
        ];
186
        return $this->setStringIntoShortTag('input', $inputParameters) . ' ' . $inAfterLabel;
187
    }
188
189
    private function setFormOutput($configPath, $shLabels)
190
    {
191
        $aryStngs    = $this->readTypeFromJsonFileUniversal($configPath, 'valuesToCompute');
192
        $sReturn     = [];
193
        $sReturn[]   = $this->setFormOutputHeader();
194
        $ovTimeVal   = $this->getOvertimes($aryStngs['Monthly Average Working Hours']);
195
        $additions   = $this->tCmnSuperGlobals->request->get('pb') + $ovTimeVal['os175'] + $ovTimeVal['os200'];
196
        $bComponents = [
197
            'sc' => $this->tCmnSuperGlobals->request->get('sc'),
198
            'sn' => $this->tCmnSuperGlobals->request->get('sn'),
199
        ];
200
        $brut        = ($bComponents['sn'] * (1 + $bComponents['sc'] / 100) + $additions) * pow(10, 4);
201
        $xDate       = '<span style="font-size:smaller;">' . date('d.m.Y', $this->currencyDetails['CXD']) . '</span>';
202
        $sReturn[]   = $this->setFormRowTwoLabels($this->setLabel('xrate@Date'), $xDate, 10000000);
203
        $snValue     = $this->tCmnSuperGlobals->request->get('sn') * 10000;
204
        $sReturn[]   = $this->setFormRowTwoLabels($this->setLabel('sn'), '&nbsp;', $snValue);
205
        $scValue     = $this->tCmnSuperGlobals->request->get('sc');
206
        $prima       = $this->tCmnSuperGlobals->request->get('sn') * $scValue * 100;
207
        $sReturn[]   = $this->setFormRowTwoLabels($this->setLabel('sc'), $scValue . '%', $prima);
208
        $pbValue     = $this->tCmnSuperGlobals->request->get('pb') * 10000;
209
        $sReturn[]   = $this->setFormRowTwoLabels($this->setLabel('pb'), '&nbsp;', $pbValue);
210
        $ovTime      = [
211
            11   => $ovTimeVal['os175'] * pow(10, 4),
212
            22   => $ovTimeVal['os200'] * pow(10, 4),
213
            'o1' => $this->tCmnSuperGlobals->request->get('os175'),
214
            'o2' => $this->tCmnSuperGlobals->request->get('os200'),
215
        ];
216
        $sReturn[]   = $this->setFormRowTwoLabels($this->setLabel('ovAmount1'), ''
217
            . '<span style="font-size:smaller;">' . $ovTime['o1'] . 'h&nbsp;x&nbsp;175%</span>', $ovTime[11]);
218
        $sReturn[]   = $this->setFormRowTwoLabels($this->setLabel('ovAmount2'), ''
219
            . '<span style="font-size:smaller;">' . $ovTime['o2'] . 'h&nbsp;x&nbsp;200%</span>', $ovTime[22]);
220
        $sReturn[]   = $this->setFormRowTwoLabels($this->setLabel('sb'), '&nbsp;', $brut);
221
        $brut        += $this->tCmnSuperGlobals->request->get('afet') * pow(10, 4);
222
        $amnt        = $this->getValues($brut, $aryStngs, $shLabels);
223
        $sReturn[]   = $this->setFormOutputTaxations($brut, $amnt);
224
        $pnValue     = $this->tCmnSuperGlobals->request->get('pn') * 10000;
225
        $sReturn[]   = $this->setFormRowTwoLabels($this->setLabel('pn'), '&nbsp;', $pnValue);
226
        $retineri    = $this->txLvl['cas'] + $this->txLvl['smj'] + $this->txLvl['snt'] + $amnt['impozit'];
227
        $net         = $brut - $retineri + $this->tCmnSuperGlobals->request->get('pn') * 10000;
228
        $sReturn[]   = $this->setFormRowTwoLabels($this->setLabel('ns'), '&nbsp;', $net);
229
        $szamntValue = $this->tCmnSuperGlobals->request->get('szamnt') * 10000;
230
        $sReturn[]   = $this->setFormRowTwoLabels($this->setLabel('szamnt'), '&nbsp;', $szamntValue);
231
        $nsc         = $net - $this->tCmnSuperGlobals->request->get('szamnt') * 10000;
232
        $sReturn[]   = $this->setFormRowTwoLabels($this->setLabel('nsc'), '&nbsp;', $nsc);
233
        $fBonus      = [
234
            'main'   => $this->setLabel('gb'),
235
            'value'  => $this->tApp->gettext('i18n_Form_Label_FoodBonusesChoiceValue'),
236
            'mtDays' => $this->tCmnSuperGlobals->request->get('nDays') . '&nbsp;/&nbsp;' . $amnt['zile']
237
        ];
238
        $fBonusTxt   = sprintf($fBonus['main'], $fBonus['value']);
239
        $sReturn[]   = $this->setFormRowTwoLabels($fBonusTxt, $fBonus['mtDays'], $amnt['ba']);
240
        $sReturn[]   = $this->setFormRowTwoLabels($this->setLabel('gbns'), '&nbsp;', $amnt['gbns']);
241
        $total       = ($net + $amnt['ba'] + $amnt['gbns'] - $this->tCmnSuperGlobals->request->get('szamnt') * 10000);
242
        $sReturn[]   = $this->setFormRowTwoLabels($this->setLabel('total'), '&nbsp;', $total);
243
        $sReturn[]   = '</tbody>';
244
        setlocale(LC_TIME, explode('_', $this->tCmnSession->get('lang'))[0]);
245
        $crtMonth    = strftime('%B', $this->tCmnSuperGlobals->request->get('ym'));
246
        $legentText  = sprintf($this->tApp->gettext('i18n_FieldsetLabel_Results')
247
            . '', $crtMonth, date('Y', $this->tCmnSuperGlobals->request->get('ym')));
248
        $legend      = $this->setStringIntoTag($legentText, 'legend');
249
        return $this->setStringIntoTag($legend
250
                . $this->setStringIntoTag(implode('', $sReturn), 'table'), 'fieldset', [
251
                'style' => 'float: left;'
252
        ]);
253
    }
254
255
    private function setFormOutputHeader()
256
    {
257
        $sReturn   = [];
258
        $sReturn[] = '<thead><tr><th>' . $this->tApp->gettext('i18n_Form_Label_ResultedElements') . '</th>';
259
        $sReturn[] = '<th><i class="fa fa-map-signs floatRight" style="font-size:2em;">&nbsp;</i></th>';
260
        foreach ($this->currencyDetails['CX'] as $value) {
261
            $sReturn[] = '<th style="text-align:center;"><span class="flag-icon flag-icon-' . $value['country']
262
                . '" style="font-size:2em;" title="'
263
                . $this->tApp->gettext('i18n_CountryName_' . strtoupper($value['country'])) . '">&nbsp;</span></th>';
264
        }
265
        return implode('', $sReturn) . '</tr></thead></tbody>';
266
    }
267
268
    private function setFormOutputTaxations($brut, $amnt)
269
    {
270
        $limitDisplayBase = false;
271 View Code Duplication
        if ($brut > $this->txLvl['base_casP']) {
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...
272
            $limitDisplayBase = true;
273
            $sReturn[]        = $this->setFormRowTwoLabels($this->setLabel('cas_base')
0 ignored issues
show
Coding Style Comprehensibility introduced by
$sReturn was never initialized. Although not strictly required by PHP, it is generally a good practice to add $sReturn = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
274
                . '', '&nbsp;', $this->txLvl['base_casP']);
275
        }
276
        $sReturn[] = $this->setFormRowTwoLabels($this->setLabel('cas'), ''
0 ignored issues
show
Bug introduced by
The variable $sReturn does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
277
            . $this->txLvl['casP'] . '%', $this->txLvl['cas']);
278
        $sReturn[] = $this->setFormRowTwoLabels($this->setLabel('somaj'), $this->txLvl['smjP']
279
            . '%', $this->txLvl['smj']);
280 View Code Duplication
        if (array_key_exists('sntP_base', $this->txLvl) && $limitDisplayBase) {
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...
281
            $sReturn[] = $this->setFormRowTwoLabels($this->setLabel('sntP_base'), '', $this->txLvl['sntP_base']);
282
        }
283
        $sReturn[] = $this->setFormRowTwoLabels($this->setLabel('sanatate'), $this->txLvl['sntP'] . '%', ''
284
            . $this->txLvl['snt']);
285
        $sReturn[] = $this->setFormRowTwoLabels($this->setLabel('pd'), '&nbsp;', $amnt['pd']);
286
        $sReturn[] = $this->setFormRowTwoLabels($this->setLabel('impozit'), $this->txLvl['inTaxP']
287
            . '%', $amnt['impozit']);
288
        return implode('', $sReturn);
289
    }
290
291
    private function setFormRow($text, $value, $type = 'amount')
292
    {
293
        $defaultCellStyle = $this->setFormatRow($text, $value);
294
        switch ($type) {
295
            case 'amount':
296
                $value2show = $this->setFormRowAmount(($value / pow(10, 4)), $defaultCellStyle);
297
                break;
298
            case 'value':
299
                $value2show = $this->setStringIntoTag($value, 'td', array_merge($defaultCellStyle, [
300
                    'colspan' => count($this->currencyDetails['CX'])
301
                ]));
302
                break;
303
            default:
304
                $value2show = $this->setStringIntoTag($value, 'td');
305
                break;
306
        }
307
        return $this->setStringIntoTag($this->setStringIntoTag($text, 'td', $defaultCellStyle) . $value2show, 'tr');
308
    }
309
310
    private function setFormRowAmount($value, $defaultCellStyle)
311
    {
312
        $cellValue                 = [];
313
        $defaultCellStyle['style'] .= 'text-align:right;';
314
        foreach ($this->currencyDetails['CX'] as $key2 => $value2) {
315
            $fmt         = new \NumberFormatter($value2['locale'], \NumberFormatter::CURRENCY);
316
            $fmt->setAttribute(\NumberFormatter::FRACTION_DIGITS, $value2['decimals']);
317
            $finalValue  = $fmt->formatCurrency($value / $this->currencyDetails['CXV'][$key2], $key2);
318
            $cellValue[] = $this->setStringIntoTag($finalValue, 'td', $defaultCellStyle);
319
        }
320
        return implode('', $cellValue);
321
    }
322
323
    private function setFormRowTwoLabels($text1, $text2, $value)
324
    {
325
        return str_replace(':</td>', ':</td><td class="labelS" style="text-align:right;">'
326
            . $text2 . '</td>', $this->setFormRow($text1, $value, 'amount'));
327
    }
328
}
329