Completed
Push — master ( abae97...fc5d0c )
by Breno
03:37 queued 01:48
created

XmlValidator::valid()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 14
ccs 10
cts 10
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 10
nc 2
nop 1
crap 2
1
<?php
2
3
namespace XmlSigner\Validator;
4
5
class XmlValidator
6
{
7 6
    public static function valid($content)
8
    {
9 6
        $content = trim($content);
10 6
        if (empty($content)) {
11 2
            return false;
12
        }
13
        
14 4
        libxml_use_internal_errors(true);
15 4
        libxml_clear_errors();
16 4
        simplexml_load_string($content);
17 4
        $errors = libxml_get_errors();
18 4
        libxml_clear_errors();
19 4
        return empty($errors);
20
    }
21
}
22