@@ -38,17 +38,17 @@ discard block |
||
| 38 | 38 | { |
| 39 | 39 | $data = json_decode($response->getBody()); |
| 40 | 40 | if ($data === null) { |
| 41 | - throw new ValidationFailedException("The given JSON data can not be validated (last error: '" . $this->json_errors[json_last_error()] . "')."); |
|
| 41 | + throw new ValidationFailedException("The given JSON data can not be validated (last error: '".$this->json_errors[json_last_error()]."')."); |
|
| 42 | 42 | } |
| 43 | 43 | else { |
| 44 | 44 | $error = false; |
| 45 | 45 | $messageParts = array(); |
| 46 | 46 | |
| 47 | 47 | foreach ($this->jsonSchemaFiles AS $jsonSchemaFile) { |
| 48 | - $factory = new Factory( null, null, Constraint::CHECK_MODE_TYPE_CAST | Constraint::CHECK_MODE_COERCE ); |
|
| 48 | + $factory = new Factory(null, null, Constraint::CHECK_MODE_TYPE_CAST | Constraint::CHECK_MODE_COERCE); |
|
| 49 | 49 | $validator = new Validator($factory); |
| 50 | 50 | |
| 51 | - $jsonSchemaObject = (object)json_decode(file_get_contents($jsonSchemaFile['jsonschemafileurl'])); |
|
| 51 | + $jsonSchemaObject = (object) json_decode(file_get_contents($jsonSchemaFile['jsonschemafileurl'])); |
|
| 52 | 52 | |
| 53 | 53 | $validator->check($data, $jsonSchemaObject); |
| 54 | 54 | |
@@ -56,14 +56,14 @@ discard block |
||
| 56 | 56 | $error = true; |
| 57 | 57 | $errorMessage = ''; |
| 58 | 58 | foreach ($validator->getErrors() as $error) { |
| 59 | - $errorMessage = $errorMessage . sprintf("[%s] %s\n", $error['property'], $error['message']); |
|
| 59 | + $errorMessage = $errorMessage.sprintf("[%s] %s\n", $error['property'], $error['message']); |
|
| 60 | 60 | } |
| 61 | - $messageParts[] = $jsonSchemaFile['jsonschemafilename'] . ' - ' . $jsonSchemaFile['jsonschemafileurl'] . '(last error: ' . $errorMessage . ').'; |
|
| 61 | + $messageParts[] = $jsonSchemaFile['jsonschemafilename'].' - '.$jsonSchemaFile['jsonschemafileurl'].'(last error: '.$errorMessage.').'; |
|
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | if ($error == true) { |
| 66 | - $message = 'JSON file (' . (string)$response->getUri() . ') does not validate against the following JSON Schema files: ' . implode(", ", $messageParts); |
|
| 66 | + $message = 'JSON file ('.(string) $response->getUri().') does not validate against the following JSON Schema files: '.implode(", ", $messageParts); |
|
| 67 | 67 | throw new ValidationFailedException($message); |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -39,8 +39,7 @@ |
||
| 39 | 39 | $data = json_decode($response->getBody()); |
| 40 | 40 | if ($data === null) { |
| 41 | 41 | throw new ValidationFailedException("The given JSON data can not be validated (last error: '" . $this->json_errors[json_last_error()] . "')."); |
| 42 | - } |
|
| 43 | - else { |
|
| 42 | + } else { |
|
| 44 | 43 | $error = false; |
| 45 | 44 | $messageParts = array(); |
| 46 | 45 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | $dom = new \DOMDocument(); |
| 28 | 28 | @$dom->loadXML($body); |
| 29 | 29 | |
| 30 | - $filename = (string)$response->getUri(); |
|
| 30 | + $filename = (string) $response->getUri(); |
|
| 31 | 31 | |
| 32 | 32 | $error = false; |
| 33 | 33 | $messageParts = array(); |
@@ -39,12 +39,12 @@ discard block |
||
| 39 | 39 | $error = true; |
| 40 | 40 | $lastError = libxml_get_last_error(); |
| 41 | 41 | |
| 42 | - $messageParts[] = $xsdFile['xsdfilename'] . ' - ' . $xsdFile['xsdfileurl'] . '(last error: ' . str_replace("\n", '', $lastError->message) . ').'; |
|
| 42 | + $messageParts[] = $xsdFile['xsdfilename'].' - '.$xsdFile['xsdfileurl'].'(last error: '.str_replace("\n", '', $lastError->message).').'; |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | if ($error === true) { |
| 47 | - $message = 'XML file (' . $filename . ') does not validate against the following XSD files: ' . implode(", ", $messageParts); |
|
| 47 | + $message = 'XML file ('.$filename.') does not validate against the following XSD files: '.implode(", ", $messageParts); |
|
| 48 | 48 | throw new ValidationFailedException($message); |
| 49 | 49 | } |
| 50 | 50 | } |