Passed
Push — master ( 8a423f...9c95d4 )
by Joe Nilson
01:52
created

BusinessDocTypeOperation   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 83
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 44
dl 0
loc 83
rs 10
c 1
b 0
f 0
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A all() 0 28 3
A defaultValue() 0 3 2
1
<?php
2
3
/*
4
 * Copyright (C) 2020 joenilson.
5
 *
6
 * This library is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Lesser General Public
8
 * License as published by the Free Software Foundation; either
9
 * version 3 of the License, or (at your option) any later version.
10
 *
11
 * This library is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 * Lesser General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Lesser General Public
17
 * License along with this library; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA 02110-1301  USA
20
 */
21
22
namespace FacturaScripts\Plugins\fsRepublicaDominicana\Lib;
23
24
use FacturaScripts\Core\Base\Translator;
0 ignored issues
show
Bug introduced by
The type FacturaScripts\Core\Base\Translator was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
25
use FacturaScripts\Core\Lib\BusinessDocTypeOperation as ParentClass;
0 ignored issues
show
Bug introduced by
The type FacturaScripts\Core\Lib\BusinessDocTypeOperation was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
26
27
/**
28
 * Description of BusinessDocTypeOperation
29
 *
30
 * @author joenilson
31
 */
32
class BusinessDocTypeOperation extends ParentClass
33
{
34
    /**
35
     * Standard
36
     *
37
     * @var string
38
     */
39
    const TYPE_OPERATION_DOCUMENT_SALES_IPO = '1';
40
    const TYPE_OPERATION_DOCUMENT_SALES_IF = '2';
41
    const TYPE_OPERATION_DOCUMENT_SALES_IE = '3';
42
    const TYPE_OPERATION_DOCUMENT_SALES_IA = '4';
43
    const TYPE_OPERATION_DOCUMENT_SALES_IVAD = '5';
44
    const TYPE_OPERATION_DOCUMENT_SALES_OI = '6';
45
    
46
    const TYPE_OPERATION_DOCUMENT_PURCHASES_GP = '01';
47
    const TYPE_OPERATION_DOCUMENT_PURCHASES_GTSS = '02';
48
    const TYPE_OPERATION_DOCUMENT_PURCHASES_A = '03';
49
    const TYPE_OPERATION_DOCUMENT_PURCHASES_GAF = '04';
50
    const TYPE_OPERATION_DOCUMENT_PURCHASES_GR = '05';
51
    const TYPE_OPERATION_DOCUMENT_PURCHASES_ODA = '06';
52
    const TYPE_OPERATION_DOCUMENT_PURCHASES_GF = '07';
53
    const TYPE_OPERATION_DOCUMENT_PURCHASES_GE = '08';
54
    const TYPE_OPERATION_DOCUMENT_PURCHASES_CGCV = '09';
55
    const TYPE_OPERATION_DOCUMENT_PURCHASES_AA = '10';
56
    const TYPE_OPERATION_DOCUMENT_PURCHASES_GS = '11';
57
    
58
    /**
59
     * Determinates the list to return sales or purchases
60
     * by default is sales
61
     * @var string 
62
     */
63
    public static $type_operation = 'sales';
64
    /**
65
     *
66
     * @var Translator
67
     */
68
    public static $i18n;
69
70
    /**
71
     * Returns all the available options
72
     *
73
     * @return array
74
     */
75
    public static function all()
76
    {
77
        if (!isset(self::$i18n)) {
78
            self::$i18n = new Translator();
79
        }
80
        
81
        if(self::$type_operation === 'sales') {
82
            return [
83
                self::TYPE_OPERATION_DOCUMENT_SALES_IPO => self::$i18n->trans('ncf-sales-income-type-ipo'),
84
                self::TYPE_OPERATION_DOCUMENT_SALES_IF => self::$i18n->trans('ncf-sales-income-type-if'),
85
                self::TYPE_OPERATION_DOCUMENT_SALES_IE => self::$i18n->trans('ncf-sales-income-type-ie'),
86
                self::TYPE_OPERATION_DOCUMENT_SALES_IA => self::$i18n->trans('ncf-sales-income-type-ia'),
87
                self::TYPE_OPERATION_DOCUMENT_SALES_IVAD => self::$i18n->trans('ncf-sales-income-type-ivad'),
88
                self::TYPE_OPERATION_DOCUMENT_SALES_OI => self::$i18n->trans('ncf-sales-income-type-oi'),
89
            ];
90
        } else {
91
            return [
92
                self::TYPE_OPERATION_DOCUMENT_PURCHASES_GP => self::$i18n->trans('ncf-purchase-outcome-type-gp'),
93
                self::TYPE_OPERATION_DOCUMENT_PURCHASES_GTSS => self::$i18n->trans('ncf-purchase-outcome-type-gtss'),
94
                self::TYPE_OPERATION_DOCUMENT_PURCHASES_A => self::$i18n->trans('ncf-purchase-outcome-type-a'),
95
                self::TYPE_OPERATION_DOCUMENT_PURCHASES_GAF => self::$i18n->trans('ncf-purchase-outcome-type-gaf'),
96
                self::TYPE_OPERATION_DOCUMENT_PURCHASES_GR => self::$i18n->trans('ncf-purchase-outcome-type-gr'),
97
                self::TYPE_OPERATION_DOCUMENT_PURCHASES_ODA => self::$i18n->trans('ncf-purchase-outcome-type-oda'),
98
                self::TYPE_OPERATION_DOCUMENT_PURCHASES_GF => self::$i18n->trans('ncf-purchase-outcome-type-gf'),
99
                self::TYPE_OPERATION_DOCUMENT_PURCHASES_GE => self::$i18n->trans('ncf-purchase-outcome-type-ge'),
100
                self::TYPE_OPERATION_DOCUMENT_PURCHASES_CGCV => self::$i18n->trans('ncf-purchase-outcome-type-cgcv'),
101
                self::TYPE_OPERATION_DOCUMENT_PURCHASES_AA => self::$i18n->trans('ncf-purchase-outcome-type-aa'),
102
                self::TYPE_OPERATION_DOCUMENT_PURCHASES_GS => self::$i18n->trans('ncf-purchase-outcome-type-gs'),
103
            ];
104
        }
105
    }
106
107
    /**
108
     * Returns the default value
109
     *
110
     * @return string
111
     */
112
    public static function defaultValue()
113
    {
114
        return (self::$type_operation === 'sales')?self::TYPE_OPERATION_DOCUMENT_SALES_IPO:self::TYPE_OPERATION_DOCUMENT_PURCHASES_GP;
115
    }
116
}
117