Completed
Push — master ( be8c82...d7ae84 )
by Roberto
04:38 queued 02:37
created

SoapCode   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 11
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A info() 0 8 2
1
<?php
2
3
namespace NFePHP\eSocial\Common\Soap;
4
5
/**
6
 * SoapCode return a description os HTTP Codes returned from server
7
 * useful to help identify the cause of the communication problem,
8
 * either with a SOAP server or a server RESTFUL
9
 * The codes and their descriptions are stored in a json file in the same folder
10
 *
11
 * @category  library
12
 * @package   NFePHP\eSocial
13
 * @copyright NFePHP Copyright (c) 2016
14
 * @license   http://www.gnu.org/licenses/lgpl.txt LGPLv3+
15
 * @license   https://opensource.org/licenses/MIT MIT
16
 * @license   http://www.gnu.org/licenses/gpl.txt GPLv3+
17
 * @author    Roberto L. Machado <linux.rlm at gmail dot com>
18
 * @link      http://github.com/nfephp-org/sped-common for the canonical source repository
19
 */
20
21
class SoapCode
22
{
23
    public static function info($code)
24
    {
25
        $codes = (array) json_decode(file_get_contents(__DIR__.'/httpcodes.json'), true);
26
        if (array_key_exists($code, $codes)) {
27
            return $codes[$code];
28
        }
29
        return ['level' => 'Desconhecido', 'description' => 'Desconhecido', 'means' => 'Desconhecido'];
30
    }
31
}