@@ -69,7 +69,7 @@ |
||
| 69 | 69 | */ |
| 70 | 70 | public static function getErrorMessages($validationErrors) |
| 71 | 71 | { |
| 72 | - return implode(', ', array_map(function ($validationError) { |
|
| 72 | + return implode(', ', array_map(function($validationError) { |
|
| 73 | 73 | /* @var SchemaValidationError $validationError */ |
| 74 | 74 | return $validationError->getMessage(); |
| 75 | 75 | }, $validationErrors)); |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | { |
| 10 | 10 | public function __construct($descriptor = null) |
| 11 | 11 | { |
| 12 | - $this->descriptor = empty($descriptor) ? (object) [] : $descriptor; |
|
| 12 | + $this->descriptor = empty($descriptor) ? (object)[] : $descriptor; |
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | public function descriptor() |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | if (!$this->constraintsDisabled && isset($this->descriptor()->constraints)) { |
| 42 | 42 | return $this->descriptor()->constraints; |
| 43 | 43 | } else { |
| 44 | - return (object) []; |
|
| 44 | + return (object)[]; |
|
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | |
| 282 | 282 | protected function checkPatternConstraint($val, $pattern) |
| 283 | 283 | { |
| 284 | - return preg_match('/^'.$pattern.'$/', $val) === 1; |
|
| 284 | + return preg_match('/^' . $pattern . '$/', $val) === 1; |
|
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | protected function checkMinimumConstraint($val, $minConstraint) |
@@ -17,8 +17,8 @@ |
||
| 17 | 17 | if (!is_numeric($val)) { |
| 18 | 18 | throw $this->getValidationException('value must be numeric', $val); |
| 19 | 19 | } else { |
| 20 | - $intVal = (int) $val; |
|
| 21 | - if ($intVal != (float) $val) { |
|
| 20 | + $intVal = (int)$val; |
|
| 21 | + if ($intVal != (float)$val) { |
|
| 22 | 22 | throw $this->getValidationException('value must be an integer', $val); |
| 23 | 23 | } else { |
| 24 | 24 | return $intVal; |
@@ -94,7 +94,7 @@ |
||
| 94 | 94 | { |
| 95 | 95 | $rowFields = []; |
| 96 | 96 | foreach ($row as $k => $v) { |
| 97 | - $rowFields[$k] = FieldsFactory::infer($v, (object) ['name' => $k], $this->lenient); |
|
| 97 | + $rowFields[$k] = FieldsFactory::infer($v, (object)['name' => $k], $this->lenient); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | return $rowFields; |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | ])]; |
| 56 | 56 | } catch (Exceptions\FieldValidationException $e) { |
| 57 | 57 | // validation error in one of the fields |
| 58 | - return array_map(function ($validationError) use ($i) { |
|
| 58 | + return array_map(function($validationError) use ($i) { |
|
| 59 | 59 | return new SchemaValidationError(SchemaValidationError::ROW_FIELD_VALIDATION, [ |
| 60 | 60 | 'row' => $i + 1, |
| 61 | 61 | 'field' => $validationError->extraDetails['field'], |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | public function __construct($validationErrors) |
| 22 | 22 | { |
| 23 | - parent::__construct('Schema failed validation: '.SchemaValidationError::getErrorMessages($validationErrors)); |
|
| 23 | + parent::__construct('Schema failed validation: ' . SchemaValidationError::getErrorMessages($validationErrors)); |
|
| 24 | 24 | $this->validationErrors = $validationErrors; |
| 25 | 25 | } |
| 26 | 26 | } |
@@ -15,12 +15,12 @@ |
||
| 15 | 15 | public function __construct($descriptor, $descriptorSource, $errorMessage) |
| 16 | 16 | { |
| 17 | 17 | if (!empty($descriptor) && empty($descriptorSource)) { |
| 18 | - $message = 'error decoding descriptor '.json_encode($descriptor).": {$errorMessage}"; |
|
| 18 | + $message = 'error decoding descriptor ' . json_encode($descriptor) . ": {$errorMessage}"; |
|
| 19 | 19 | } elseif (!empty($descriptor) && !empty($descriptorSource)) { |
| 20 | - $message = 'error decoding descriptor from source '.json_encode($descriptorSource) |
|
| 21 | - .' - '.json_encode($descriptor).": {$errorMessage}"; |
|
| 20 | + $message = 'error decoding descriptor from source ' . json_encode($descriptorSource) |
|
| 21 | + .' - ' . json_encode($descriptor) . ": {$errorMessage}"; |
|
| 22 | 22 | } elseif (empty($descriptor) && !empty($descriptorSource)) { |
| 23 | - $message = 'error loading descriptor from source '.json_encode($descriptorSource) |
|
| 23 | + $message = 'error loading descriptor from source ' . json_encode($descriptorSource) |
|
| 24 | 24 | .": {$errorMessage}"; |
| 25 | 25 | } else { |
| 26 | 26 | $message = "unexpected load error: {$errorMessage}"; |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function __construct($descriptor = null, $lenient = false) |
| 17 | 17 | { |
| 18 | - $this->descriptor = empty($descriptor) ? (object) ['fields' => []] : $descriptor; |
|
| 18 | + $this->descriptor = empty($descriptor) ? (object)['fields' => []] : $descriptor; |
|
| 19 | 19 | $this->fieldsInferer = new Fields\FieldsInferrer(null, $lenient); |
| 20 | 20 | } |
| 21 | 21 | |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | throw $this->getValidationException("couldn't parse date/time according to given strptime format '{$this->format()}''", $val); |
| 33 | 33 | } else { |
| 34 | 34 | return Carbon::create( |
| 35 | - (int) $date['tm_year'] + 1900, (int) $date['tm_mon'] + 1, (int) $date['tm_mday'], |
|
| 35 | + (int)$date['tm_year'] + 1900, (int)$date['tm_mon'] + 1, (int)$date['tm_mday'], |
|
| 36 | 36 | 0, 0, 0 |
| 37 | 37 | ); |
| 38 | 38 | } |