Passed
Pull Request — master (#174)
by
unknown
05:42
created

SignerException   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 80%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 25
ccs 8
cts 10
cp 0.8
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A digestComparisonFailed() 0 5 1
A signatureComparisonFailed() 0 5 1
A tagNotFound() 0 4 1
A isNotXml() 0 4 1
1
<?php
2
namespace NFePHP\Common\Exception;
3
4
/**
5
 * @category   NFePHP
6
 * @package    NFePHP\Common\Exception
7
 * @copyright  Copyright (c) 2008-2014
8
 * @license    http://www.gnu.org/licenses/lesser.html LGPL v3
9
 * @author     Roberto L. Machado <linux.rlm at gmail dot com>
10
 * @link       http://github.com/nfephp-org/sped-common for the canonical source repository
11
 */
12
13
class SignerException extends \RuntimeException implements ExceptionInterface
14
{
15
    public static function isNotXml()
16
    {
17
        return new static('The content not is a valid XML.');
18
    }
19
    
20 1
    public static function digestComparisonFailed()
21
    {
22 1
        return new static('The XML content does not match the Digest Value. '
23 1
           . 'Probably modified after it was signed');
24
    }
25
    
26 1
    public static function signatureComparisonFailed()
27
    {
28 1
        return new static('The XML SIGNATURE does not match. '
29 1
           . 'Probably modified after it was signed.');
30
    }
31
    
32
    
33 1
    public static function tagNotFound($tagname)
34
    {
35 1
        return new static("The specified tag &lt;$tagname&gt; was not found in xml.");
36
    }
37
}
38