ProcessException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 1
cbo 0
dl 0
loc 25
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A wrongArgument() 0 5 1
A replaceMsg() 0 4 1
1
<?php
2
namespace NFePHP\eFinanc\Exception;
3
4
/**
5
 * Class ProcessesException
6
 *
7
 * @category  API
8
 * @package   NFePHP\eFinanc
9
 * @copyright Copyright (c) 2018
10
 * @license   http://www.gnu.org/licenses/lesser.html LGPL v3
11
 * @author    Roberto L. Machado <linux.rlm at gmail dot com>
12
 * @link      http://github.com/nfephp-org/sped-efinanceira for the canonical source repository
13
 */
14
use NFePHP\eFinanc\Exception\ExceptionInterface;
15
16
class ProcessException extends \InvalidArgumentException implements ExceptionInterface
17
{
18
    public static $list = [
19
        2000 => "O numero máximo de eventos em um lote é 100, você está tentando "
20
            . "enviar {{msg}} eventos !",
21
        2001 => "Não temos um certificado disponível!",
22
        2002 => "Não foi passado um evento válido.",
23
        2003 => "O certificado do servidor não foi passado para a classe então "
24
            . "não é possivel a encriptação da mensagem.",
25
        2004 => "O certificado do servidor está vencido e deve ser substituido.",
26
        2005 => "O certificado do servidor fornecido não pertence ao commonName requerido. {{msg}}",
27
        2999 => ""
28
    ];
29
    
30
    public static function wrongArgument($code, $msg = '')
31
    {
32
        $msg = self::replaceMsg(self::$list[$code], $msg);
33
        return new static($msg);
34
    }
35
    
36
    private static function replaceMsg($input, $msg)
37
    {
38
        return str_replace('{{msg}}', $msg, $input);
39
    }
40
}
41