Completed
Branch master (fba866)
by Ori
04:29
created
src/SchemaValidator.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -10,6 +10,9 @@
 block discarded – undo
10 10
         $this->errors = [];
11 11
     }
12 12
 
13
+    /**
14
+     * @param string $extraDetails
15
+     */
13 16
     protected function _addError($code, $extraDetails=null)
14 17
     {
15 18
         $this->errors[] = new SchemaValidationError($code, $extraDetails);
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
         $this->errors = [];
11 11
     }
12 12
 
13
-    protected function _addError($code, $extraDetails=null)
13
+    protected function _addError($code, $extraDetails = null)
14 14
     {
15 15
         $this->errors[] = new SchemaValidationError($code, $extraDetails);
16 16
     }
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     {
20 20
         // Validate
21 21
         $validator = new \JsonSchema\Validator();
22
-        $validator->validate($this->descriptor, (object)['$ref' => 'file://' . realpath(dirname(__FILE__)).'/schemas/table-schema.json']);
22
+        $validator->validate($this->descriptor, (object)['$ref' => 'file://' . realpath(dirname(__FILE__)) . '/schemas/table-schema.json']);
23 23
         if (!$validator->isValid()) {
24 24
             foreach ($validator->getErrors() as $error) {
25 25
                 $this->_addError(SchemaValidationError::SCHEMA_VIOLATION, sprintf("[%s] %s", $error['property'], $error['message']));
Please login to merge, or discard this patch.
src/Schema.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
         if (count($this->validationErrors) == 0) {
19 19
             $this->descriptor = $descriptor;
20 20
         } else {
21
-            throw new SchemaException("descriptor failed validation: ".SchemaValidationError::getErrorMessages($this->validationErrors));
21
+            throw new SchemaException("descriptor failed validation: " . SchemaValidationError::getErrorMessages($this->validationErrors));
22 22
         };
23 23
     }
24 24
 
Please login to merge, or discard this patch.
src/SchemaValidationError.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,10 +3,10 @@  discard block
 block discarded – undo
3 3
 
4 4
 class SchemaValidationError {
5 5
 
6
-    const LOAD_FAILED=1;
7
-    const SCHEMA_VIOLATION=8;
6
+    const LOAD_FAILED = 1;
7
+    const SCHEMA_VIOLATION = 8;
8 8
 
9
-    public function __construct($code, $extraDetails=null)
9
+    public function __construct($code, $extraDetails = null)
10 10
     {
11 11
         $this->code = $code;
12 12
         $this->extraDetails = $extraDetails;
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
     public static function getErrorMessages($validationErrors)
28 28
     {
29
-        return implode(", ", array_map(function($validation_error){
29
+        return implode(", ", array_map(function($validation_error) {
30 30
             return $validation_error->getMessage();
31 31
         }, $validationErrors));
32 32
     }
Please login to merge, or discard this patch.