GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

XsdValidator   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 30
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A validate() 0 19 3
1
<?php
2
3
namespace Hautzi\SystemMailBundle\SystemMailer\XML;
4
5
class XsdValidator
6
{
7
    /**
8
     * @param string $xmlString
9
     * @param string $xsdFile
10
     *
11
     * @return bool
12
     *
13
     * @throws XsdValidationException when validation fails
14
     */
15
    public function validate($xmlString, $xsdFile)
16
    {
17
        libxml_use_internal_errors(true);
18
19
        $xml = new \DOMDocument();
20
        $xml->loadXML($xmlString);
21
22
        if (!$xml->schemaValidate($xsdFile)) {
23
            $messages = [];
24
            foreach (libxml_get_errors() as $error) {
25
                array_push($messages, sprintf('%s in line %d', $error->message, $error->line));
26
            }
27
            libxml_clear_errors();
28
29
            throw new XsdValidationException(implode(PHP_EOL, $messages));
30
        }
31
32
        return true;
33
    }
34
}
35