SoapCode::info()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 8
rs 10
cc 2
nc 2
nop 1
1
<?php
2
3
namespace NFePHP\eFinanc\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  API
12
 * @package   NFePHP\eFinanc
13
 * @copyright NFePHP Copyright (c) 2018
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-efinanceira 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
}
32