Vat::toArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace XoopsModules\Oledrion;
4
5
/*
6
 You may not change or alter any portion of this comment or credits
7
 of supporting developers from this source code or any supporting source code
8
 which is considered copyrighted (c) material of the original comment or credit authors.
9
10
 This program is distributed in the hope that it will be useful,
11
 but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
*/
14
15
/**
16
 * oledrion
17
 *
18
 * @copyright   {@link https://xoops.org/ XOOPS Project}
19
 * @license     {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
20
 * @author      Hervé Thouzard (http://www.herve-thouzard.com/)
21
 */
22
23
use XoopsModules\Oledrion;
24
25
/**
26
 * Gestion des TVA
27
 */
28
29
/**
30
 * Class Vat
31
 */
32
class Vat extends OledrionObject
33
{
34
    /**
35
     * constructor
36
     *
37
     * normally, this is called from child classes only
38
     */
39
    public function __construct()
40
    {
41
        $this->initVar('vat_id', XOBJ_DTYPE_INT, null, false);
42
        $this->initVar('vat_rate', XOBJ_DTYPE_TXTBOX, null, false);
43
        $this->initVar('vat_country', XOBJ_DTYPE_TXTBOX, null, false);
44
    }
45
46
    /**
47
     * @param  string $format
48
     * @return array
49
     */
50
    public function toArray($format = 's')
51
    {
52
        $ret                      = [];
0 ignored issues
show
Unused Code introduced by
The assignment to $ret is dead and can be removed.
Loading history...
53
        $ret                      = parent::toArray($format);
54
        $oledrionCurrency         = Oledrion\Currency::getInstance();
55
        $ret['vat_rate_formated'] = $oledrionCurrency->amountInCurrency((float)$this->getVar('vat_rate', 'e'));
56
57
        return $ret;
58
    }
59
}
60