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

XmlValidator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 17
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A valid() 0 14 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