@@ -77,12 +77,12 @@ discard block |
||
| 77 | 77 | $keys = array_keys(array_merge($this->row, $this->foreignRow)); |
| 78 | 78 | $formattedLocalRow = $this->formatRow($localRow); |
| 79 | 79 | $formattedForeignRow = $this->formatRow($foreignRow); |
| 80 | - foreach($keys as $key) { |
|
| 81 | - $conv = function (array $row) use ($key) { |
|
| 80 | + foreach ($keys as $key) { |
|
| 81 | + $conv = function(array $row) use ($key) { |
|
| 82 | 82 | $value = null; |
| 83 | - if(array_key_exists($key, $row)) { |
|
| 83 | + if (array_key_exists($key, $row)) { |
|
| 84 | 84 | $value = $row[$key]; |
| 85 | - if(array_key_exists($key, $this->converter)) { |
|
| 85 | + if (array_key_exists($key, $this->converter)) { |
|
| 86 | 86 | $value = call_user_func($this->converter[$key], $value); |
| 87 | 87 | } |
| 88 | 88 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | }; |
| 91 | 91 | $localValue = call_user_func($conv, $formattedLocalRow); |
| 92 | 92 | $foreignValue = call_user_func($conv, $formattedForeignRow); |
| 93 | - if(json_encode($localValue) !== json_encode($foreignValue)) { |
|
| 93 | + if (json_encode($localValue) !== json_encode($foreignValue)) { |
|
| 94 | 94 | $diff[$key] = ['local' => $localValue, 'foreign' => $foreignValue]; |
| 95 | 95 | } |
| 96 | 96 | } |
@@ -105,9 +105,9 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | public function getDiffFormatted(array $fields = null, $format = null) { |
| 107 | 107 | $diff = $this->getDiff($fields); |
| 108 | - if($format === null) { |
|
| 108 | + if ($format === null) { |
|
| 109 | 109 | $result = []; |
| 110 | - foreach($diff as $fieldName => $values) { |
|
| 110 | + foreach ($diff as $fieldName => $values) { |
|
| 111 | 111 | $result[] = sprintf("%s: %s -> %s", $fieldName, $values['foreign'], $values['local']); |
| 112 | 112 | } |
| 113 | 113 | return join(', ', $result); |
@@ -121,13 +121,13 @@ discard block |
||
| 121 | 121 | * @return array |
| 122 | 122 | */ |
| 123 | 123 | private function applyOptions(array $row, array $options) { |
| 124 | - if(count($options) < 1) { |
|
| 124 | + if (count($options) < 1) { |
|
| 125 | 125 | return $row; |
| 126 | 126 | } |
| 127 | - if(array_key_exists('keys', $options) && is_array($options['keys'])) { |
|
| 127 | + if (array_key_exists('keys', $options) && is_array($options['keys'])) { |
|
| 128 | 128 | $row = array_intersect_key($row, array_combine($options['keys'], $options['keys'])); |
| 129 | 129 | } |
| 130 | - if(array_key_exists('ignore', $options) && is_array($options['ignore'])) { |
|
| 130 | + if (array_key_exists('ignore', $options) && is_array($options['ignore'])) { |
|
| 131 | 131 | $row = array_diff_key($row, array_combine($options['ignore'], $options['ignore'])); |
| 132 | 132 | } |
| 133 | 133 | return $row; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | private function formatRow($row) { |
| 141 | 141 | $schema = $this->converter; |
| 142 | - $schema = array_map(function () { return null; }, $schema); |
|
| 142 | + $schema = array_map(function() { return null; }, $schema); |
|
| 143 | 143 | $row = array_merge($schema, $row); |
| 144 | 144 | return $row; |
| 145 | 145 | } |