Completed
Push — master ( 29cde4...77c4c6 )
by Ori
03:02
created
src/Schema.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -143,7 +143,9 @@
 block discarded – undo
143 143
         $validationErrors = [];
144 144
         foreach ($this->fields() as $fieldName => $field) {
145 145
             $value = array_key_exists($fieldName, $row) ? $row[$fieldName] : null;
146
-            if (in_array($value, $this->missingValues())) $value = null;
146
+            if (in_array($value, $this->missingValues())) {
147
+                $value = null;
148
+            }
147 149
             try {
148 150
                 $outRow[$fieldName] = $field->castValue($value);
149 151
             } catch (Exceptions\FieldValidationException $e) {
Please login to merge, or discard this patch.
src/Fields/BaseField.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 
7 7
 abstract class BaseField
8 8
 {
9
-    public function __construct($descriptor=null)
9
+    public function __construct($descriptor = null)
10 10
     {
11 11
         $this->descriptor = empty($descriptor) ? (object)[] : $descriptor;
12 12
     }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      * @param bool @lenient
92 92
      * @return bool|BaseField
93 93
      */
94
-    public static function infer($val, $descriptor=null, $lenient=false)
94
+    public static function infer($val, $descriptor = null, $lenient = false)
95 95
     {
96 96
         $field = new static($descriptor);
97 97
         try {
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
      * @param bool @lenient
143 143
      * @return string
144 144
      */
145
-    public function getInferIdentifier($lenient=false)
145
+    public function getInferIdentifier($lenient = false)
146 146
     {
147 147
         return $this->type();
148 148
     }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
     protected $descriptor;
160 160
     protected $constraintsDisabled = false;
161 161
 
162
-    protected function getValidationException($errorMsg, $val=null)
162
+    protected function getValidationException($errorMsg, $val = null)
163 163
     {
164 164
         return new FieldValidationException([
165 165
             new SchemaValidationError(SchemaValidationError::FIELD_VALIDATION, [
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 
261 261
     protected function checkPatternConstraint($val, $pattern)
262 262
     {
263
-        return preg_match("/^".$pattern."\$/", $val) === 1;
263
+        return preg_match("/^" . $pattern . "\$/", $val) === 1;
264 264
     }
265 265
 
266 266
     protected function checkMinimumConstraint($val, $minConstraint)
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -118,7 +118,9 @@
 block discarded – undo
118 118
     final public function castValue($val)
119 119
     {
120 120
         if ($this->isEmptyValue($val)) {
121
-            if ($this->required()) throw $this->getValidationException("field is required", $val);
121
+            if ($this->required()) {
122
+                throw $this->getValidationException("field is required", $val);
123
+            }
122 124
             return null;
123 125
         } else {
124 126
             return $this->validateCastValue($val);
Please login to merge, or discard this patch.
src/Fields/StringField.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 
6 6
 class StringField extends BaseField
7 7
 {
8
-    public function inferProperties($val, $lenient=false)
8
+    public function inferProperties($val, $lenient = false)
9 9
     {
10 10
         parent::inferProperties($val, $lenient);
11 11
         if (!$lenient) {
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
35 35
         return "string";
36 36
     }
37 37
 
38
-    public function getInferIdentifier($lenient=false)
38
+    public function getInferIdentifier($lenient = false)
39 39
     {
40 40
         $inferId = parent::getInferIdentifier();
41 41
         $format = $this->format();
42 42
         if (!$lenient && !empty($format)) {
43
-            $inferId .= ":".$this->format();
43
+            $inferId .= ":" . $this->format();
44 44
         };
45 45
         return $inferId;
46 46
     }
Please login to merge, or discard this patch.