| Total Complexity | 4 |
| Total Lines | 17 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class XmlValidator implements ValidatorInterface |
||
| 8 | { |
||
| 9 | private $schema = null; |
||
| 10 | |||
| 11 | public function setSchema($schema, $additionalProperties = array()) { |
||
| 12 | $this->schema = $schema; |
||
| 13 | } |
||
| 14 | |||
| 15 | public function validate($msg) |
||
| 16 | { |
||
| 17 | $xml = new DOMDocument(); |
||
| 18 | $xml->load($msg); |
||
| 19 | return $xml->schemaValidate($this->schema) == true ? null : "XML schema validation failed."; |
||
|
|
|||
| 20 | } |
||
| 21 | |||
| 22 | public function getContentType() { |
||
| 24 | } |
||
| 25 | } |
||
| 26 |
When comparing two booleans, it is generally considered safer to use the strict comparison operator.