@@ -38,7 +38,7 @@ |
||
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * @param integer $code |
| 41 | - * @param mixed $extraDetails |
|
| 41 | + * @param string $extraDetails |
|
| 42 | 42 | */ |
| 43 | 43 | protected function addError($code, $extraDetails=null) |
| 44 | 44 | { |
@@ -10,7 +10,9 @@ |
||
| 10 | 10 | { |
| 11 | 11 | public function __construct($message, $rowNum=0) |
| 12 | 12 | { |
| 13 | - if (!empty($rowNum)) $message = "row {$rowNum}: {$message}"; |
|
| 13 | + if (!empty($rowNum)) { |
|
| 14 | + $message = "row {$rowNum}: {$message}"; |
|
| 15 | + } |
|
| 14 | 16 | parent::__construct($message); |
| 15 | 17 | } |
| 16 | 18 | } |
@@ -37,7 +37,9 @@ |
||
| 37 | 37 | $i = 0; |
| 38 | 38 | try { |
| 39 | 39 | foreach ($table as $row) { |
| 40 | - if (++$i > $numPeekRows) break; |
|
| 40 | + if (++$i > $numPeekRows) { |
|
| 41 | + break; |
|
| 42 | + } |
|
| 41 | 43 | } |
| 42 | 44 | } catch (Exceptions\DataSourceException $e) { |
| 43 | 45 | // general error in getting the next row from the data source |
@@ -116,7 +116,9 @@ |
||
| 116 | 116 | try { |
| 117 | 117 | $rowNum = 0; |
| 118 | 118 | foreach ($this->inputRows as $inputRow) { |
| 119 | - if (!array_key_exists($rowNum, $this->castRows)) $this->castRows[$rowNum] = []; |
|
| 119 | + if (!array_key_exists($rowNum, $this->castRows)) { |
|
| 120 | + $this->castRows[$rowNum] = []; |
|
| 121 | + } |
|
| 120 | 122 | $this->castRows[$rowNum][$fieldName] = $inferredField->castValue($inputRow[$fieldName]); |
| 121 | 123 | $rowNum++; |
| 122 | 124 | } |
@@ -143,7 +143,9 @@ |
||
| 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) { |
@@ -118,7 +118,9 @@ |
||
| 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); |