Passed
Push — master ( 914b45...07a2fd )
by Roberto
55s
created

ValidatorException::xmlErrors()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 1
crap 2
1
<?php
2
3
namespace NFePHP\Common\Exception;
4
5
/**
6
 * @category   NFePHP
7
 * @package    NFePHP\Common\Exception
8
 * @copyright  Copyright (c) 2008-2017
9
 * @license    http://www.gnu.org/licenses/lesser.html LGPL v3
10
 * @author     Roberto L. Machado <linux.rlm at gmail dot com>
11
 * @link       http://github.com/nfephp-org/sped-common for the canonical source repository
12
 */
13
14
class ValidatorException extends \RuntimeException implements ExceptionInterface
15
{
16 1
    public static function xmlErrors(array $errors)
17
    {
18 1
        $msg = '';
19 1
        foreach ($errors as $error) {
20 1
            $msg .= $error."\n";
21
        }
22 1
        return new static('This XML is not valid. '.$msg);
23
    }
24
    
25 1
    public static function isNotXml()
26
    {
27 1
        return new static('This string is not an XML');
28
    }
29
}
30