Company   A
last analyzed

Complexity

Total Complexity 24

Size/Duplication

Total Lines 163
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 29
dl 0
loc 163
rs 10
c 0
b 0
f 0
wmc 24

18 Methods

Rating   Name   Duplication   Size   Complexity  
A getRegAddressCode() 0 2 1
A getCompanyName() 0 2 1
A setConfig() 0 2 1
A getRUC() 0 2 1
A getBusinessName() 0 2 1
A getCity() 0 2 1
A getAddress() 0 2 1
A get() 0 12 5
A getSolUser() 0 2 1
A getRepositoryPath() 0 2 1
A getTempPath() 0 2 1
A getSolKey() 0 2 1
A getCertPath() 0 2 1
A getPdfTemplatesPath() 0 2 1
A getContactInfo() 0 2 1
A getListsPath() 0 2 1
A getEdocHeaderContent() 0 3 2
A getEdocFooterContent() 0 3 2
1
<?php
2
3
/**
4
 * MÓDULO DE EMISIÓN ELECTRÓNICA F72X
5
 * UBL 2.1
6
 * Version 1.0
7
 * 
8
 * Copyright 2019, Jaime Cruz
9
 */
10
11
namespace F72X;
12
13
use F72X\Exception\ConfigException;
14
15
class Company {
16
17
    /** @var array cache */
18
    private static $_CONFIG = [];
19
20
    /**
21
     * 
22
     * Get Configuration Value
23
     * 
24
     * @param string $key
25
     * @param boolean $nullExc
26
     * @return string
27
     */
28
    public static function get($key, $nullExc = true) {
29
        $value = null;
30
        if (empty(self::$_CONFIG)) {
31
            throw new ConfigException('Olvidaste configurar el Modulo F72X usa \F72X\F72::init($config)');
32
        }
33
        if (isset(self::$_CONFIG[$key])) {
34
            $value = self::$_CONFIG[$key];
35
        }
36
        if (is_null($value) && $nullExc) {
37
            throw new ConfigException(sprintf('La propiedad %s no ha sido definida, por favor revise su cofiguración', $key));
38
        }
39
        return $value;
40
    }
41
42
    /**
43
     * 
44
     * @param array $config
45
     */
46
    public static function setConfig($config) {
47
        self::$_CONFIG = $config;
48
    }
49
50
    /**
51
     * 
52
     * @return string
53
     */
54
    public static function getRUC() {
55
        return self::get('ruc');
56
    }
57
58
    /**
59
     * 
60
     * @return string
61
     */
62
    public static function getCompanyName() {
63
        return self::get('razonSocial');
64
    }
65
66
    /**
67
     * 
68
     * @return string
69
     */
70
    public static function getBusinessName() {
71
        return self::get('nombreComercial', false);
72
    }
73
74
    /**
75
     * 
76
     * @return string
77
     */
78
    public static function getRegAddressCode() {
79
        return self::get('codigoDomicilioFiscal');
80
    }
81
82
    /**
83
     * 
84
     * @return string
85
     */
86
    public static function getAddress() {
87
        return self::get('address');
88
    }
89
90
    /**
91
     * 
92
     * @return string
93
     */
94
    public static function getCity() {
95
        return self::get('city');
96
    }
97
98
    /**
99
     * 
100
     * @return string
101
     */
102
    public static function getContactInfo() {
103
        return self::get('contactInfo');
104
    }
105
106
    /**
107
     * 
108
     * @return string
109
     */
110
    public static function getEdocHeaderContent() {
111
        $content = self::get('edocHeaderContent', false);
112
        return $content ? $content : '';
113
    }
114
115
    /**
116
     * 
117
     * @return string
118
     */
119
    public static function getEdocFooterContent() {
120
        $content = self::get('edocFooterContent', false);
121
        return $content ? $content : '';
122
    }
123
124
    /**
125
     * 
126
     * @return string
127
     */
128
    public static function getSolUser() {
129
        return self::get('usuarioSol');
130
    }
131
132
    /**
133
     * 
134
     * @return string
135
     */
136
    public static function getSolKey() {
137
        return self::get('claveSol');
138
    }
139
140
    /**
141
     * 
142
     * @return string
143
     */
144
    public static function getCertPath() {
145
        return self::get('cconfigPath') . '/certs/' . self::get('certificate') . '.pem';
146
    }
147
148
    /**
149
     * 
150
     * @return string
151
     */
152
    public static function getRepositoryPath() {
153
        return self::get('repoPath');
154
    }
155
156
    /**
157
     * 
158
     * @return string
159
     */
160
    public static function getTempPath() {
161
        return self::get('tempPath');
162
    }
163
164
    /**
165
     * 
166
     * @return string
167
     */
168
    public static function getListsPath() {
169
        return self::get('cconfigPath') . '/lists';
170
    }
171
172
    /**
173
     * 
174
     * @return string
175
     */
176
    public static function getPdfTemplatesPath() {
177
        return self::get('cconfigPath') . '/tpls';
178
    }
179
180
}
181