Completed
Pull Request — master (#183)
by Luke
08:50 queued 06:47
created
src/CSVelte/Sniffer/SniffHeaderByDataType.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -18,19 +18,19 @@
 block discarded – undo
18 18
 
19 19
 class SniffHeaderByDataType extends AbstractSniffer
20 20
 {
21
-     /**
22
-     * Guess whether there is a header row
23
-     *
24
-     * Guesses whether the data has a header row by comparing the data types of the first row with the types of
25
-     * corresponding columns in other rows.
26
-     *
27
-     * @note Unlike the original version of this method, this one will be used to ALSO determine HOW MANY header rows
28
-     *       there likely are. So, compare the header to rows at the END of the sample.
29
-     *
30
-     * @param string $data The data to analyze
31
-     *
32
-     * @return bool
33
-     */
21
+        /**
22
+         * Guess whether there is a header row
23
+         *
24
+         * Guesses whether the data has a header row by comparing the data types of the first row with the types of
25
+         * corresponding columns in other rows.
26
+         *
27
+         * @note Unlike the original version of this method, this one will be used to ALSO determine HOW MANY header rows
28
+         *       there likely are. So, compare the header to rows at the END of the sample.
29
+         *
30
+         * @param string $data The data to analyze
31
+         *
32
+         * @return bool
33
+         */
34 34
     public function sniff($data)
35 35
     {
36 36
         $delimiter = $this->getOption('delimiter');
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
                 return s($this->replaceQuotedSpecialChars($line, $delimiter));
41 41
             });
42 42
         $header = collect($lines->shift()->split($delimiter))
43
-            ->map(function($val){ return $this->unQuote($val); })
43
+            ->map(function($val) { return $this->unQuote($val); })
44 44
             ->map(function($val) {
45 45
                 return [
46 46
                     'type' => $this->getType($val),
Please login to merge, or discard this patch.
src/CSVelte/Reader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -159,7 +159,7 @@
 block discarded – undo
159 159
         $d = $this->getDialect();
160 160
         $fields = collect(s($line)
161 161
             ->trimRight($d->getLineTerminator())
162
-            ->split($d->getDelimiter() . "(?=([^\"]*\"[^\"]*\")*[^\"]*$)"));
162
+            ->split($d->getDelimiter()."(?=([^\"]*\"[^\"]*\")*[^\"]*$)"));
163 163
         if (!is_null($this->header)) {
164 164
             // @todo there may be cases where this gives a false positive...
165 165
             if (count($fields) == count($this->header)) {
Please login to merge, or discard this patch.
src/CSVelte/Writer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@
 block discarded – undo
120 120
                         $field = s($field);
121 121
                         if ($field->contains($d->getQuoteChar())) {
122 122
                             $escapeChar = $d->isDoubleQuote() ? $d->getQuoteChar() : '\\' /*$d->getEscapeChar()*/;
123
-                            $field = $field->replace($d->getQuoteChar(), $d->getQuoteChar() . $d->getQuoteChar());
123
+                            $field = $field->replace($d->getQuoteChar(), $d->getQuoteChar().$d->getQuoteChar());
124 124
                         }
125 125
                         $field = $field->surround($d->getQuoteChar());
126 126
                     }
Please login to merge, or discard this patch.