@@ -56,7 +56,7 @@ |
||
56 | 56 | public function __construct($fields) |
57 | 57 | { |
58 | 58 | $this->setFields($fields) |
59 | - ->rewind(); |
|
59 | + ->rewind(); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | protected function setFields($fields) |
@@ -91,8 +91,8 @@ |
||
91 | 91 | public function __construct($input, $flavor = null) |
92 | 92 | { |
93 | 93 | $this->setSource($input) |
94 | - ->setFlavor($flavor) |
|
95 | - ->rewind(); |
|
94 | + ->setFlavor($flavor) |
|
95 | + ->rewind(); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -19,7 +19,6 @@ |
||
19 | 19 | if (if $file->hasHeader()) { |
20 | 20 | $header = $file->getHeader() |
21 | 21 | } |
22 | - |
|
23 | 22 | * you can instead simply call $header->getHeader() and handle this exception if |
24 | 23 | * said file has no header |
25 | 24 | * |
@@ -290,20 +290,20 @@ discard block |
||
290 | 290 | throw new TasterException("quoteChar and delimiter cannot be determined", TasterException::ERR_QUOTE_AND_DELIM); |
291 | 291 | } |
292 | 292 | |
293 | - /** |
|
294 | - * Take a list of likely delimiter characters and find the one that occurs |
|
295 | - * the most consistent amount of times within the provided data. |
|
296 | - * |
|
297 | - * @param string The character(s) used for newlines |
|
298 | - * @return string One of four Flavor::QUOTING_* constants |
|
299 | - * @see \CSVelte\Flavor for possible quote style constants |
|
300 | - * @todo Refactor this method--It needs more thorough testing against a wider |
|
301 | - * variety of CSV data to be sure it works reliably. And I'm sure there |
|
302 | - * are many performance and logic improvements that could be made. This |
|
303 | - * is essentially a first draft. |
|
304 | - * @todo Can't use replaceQuotedSpecialChars rather than removeQuotedStrings |
|
305 | - * because the former requires u to know the delimiter |
|
306 | - */ |
|
293 | + /** |
|
294 | + * Take a list of likely delimiter characters and find the one that occurs |
|
295 | + * the most consistent amount of times within the provided data. |
|
296 | + * |
|
297 | + * @param string The character(s) used for newlines |
|
298 | + * @return string One of four Flavor::QUOTING_* constants |
|
299 | + * @see \CSVelte\Flavor for possible quote style constants |
|
300 | + * @todo Refactor this method--It needs more thorough testing against a wider |
|
301 | + * variety of CSV data to be sure it works reliably. And I'm sure there |
|
302 | + * are many performance and logic improvements that could be made. This |
|
303 | + * is essentially a first draft. |
|
304 | + * @todo Can't use replaceQuotedSpecialChars rather than removeQuotedStrings |
|
305 | + * because the former requires u to know the delimiter |
|
306 | + */ |
|
307 | 307 | protected function lickDelimiter($eol = "\n") |
308 | 308 | { |
309 | 309 | $frequencies = []; |
@@ -381,16 +381,16 @@ discard block |
||
381 | 381 | * which one has the best distribution, return that one. |
382 | 382 | */ |
383 | 383 | |
384 | - $decision = $dups->get($max); |
|
385 | - try { |
|
386 | - $delim = $this->guessDelimByDistribution($decision, $eol); |
|
387 | - } catch (TasterException $e) { |
|
388 | - // if somehow we STILL can't come to a consensus, then fall back to a |
|
389 | - // "preferred delimiters" list... |
|
390 | - foreach ($this->delims as $key => $val) { |
|
384 | + $decision = $dups->get($max); |
|
385 | + try { |
|
386 | + $delim = $this->guessDelimByDistribution($decision, $eol); |
|
387 | + } catch (TasterException $e) { |
|
388 | + // if somehow we STILL can't come to a consensus, then fall back to a |
|
389 | + // "preferred delimiters" list... |
|
390 | + foreach ($this->delims as $key => $val) { |
|
391 | 391 | if ($delim = array_search($val, $decision)) return $delim; |
392 | - } |
|
393 | - } |
|
392 | + } |
|
393 | + } |
|
394 | 394 | } |
395 | 395 | return $delims |
396 | 396 | ->sort() |
@@ -447,8 +447,8 @@ discard block |
||
447 | 447 | })->map(function($dists) { |
448 | 448 | return $dists->average(); |
449 | 449 | })->sort() |
450 | - ->reverse() |
|
451 | - ->getKeyAtPosition(0)]; |
|
450 | + ->reverse() |
|
451 | + ->getKeyAtPosition(0)]; |
|
452 | 452 | } catch (Exception $e) { |
453 | 453 | throw new TasterException("delimiter cannot be determined by distribution", TasterException::ERR_DELIMITER); |
454 | 454 | } |
@@ -190,17 +190,17 @@ discard block |
||
190 | 190 | // set all this manually |
191 | 191 | $meta = stream_get_meta_data($handle); |
192 | 192 | $this->setUri($meta['uri']) |
193 | - ->setMode($meta['mode']); |
|
193 | + ->setMode($meta['mode']); |
|
194 | 194 | $this->conn = $handle; |
195 | 195 | return; |
196 | 196 | } |
197 | 197 | |
198 | 198 | // ok we're opening a new stream resource handle |
199 | 199 | $this->setUri($uri) |
200 | - ->setMode($mode) |
|
201 | - ->setLazy($lazy) |
|
202 | - ->setUseIncludePath($use_include_path) |
|
203 | - ->setContext($context_options, $context_params); |
|
200 | + ->setMode($mode) |
|
201 | + ->setLazy($lazy) |
|
202 | + ->setUseIncludePath($use_include_path) |
|
203 | + ->setContext($context_options, $context_params); |
|
204 | 204 | if (!$this->isLazy()) { |
205 | 205 | $this->connect(); |
206 | 206 | } |
@@ -339,9 +339,9 @@ discard block |
||
339 | 339 | |
340 | 340 | $this->flag = ''; |
341 | 341 | $this->setBaseMode($base) |
342 | - ->setIsPlus($plus == '+') |
|
343 | - ->setIsText($flag == 't') |
|
344 | - ->setIsBinary($flag == 'b'); |
|
342 | + ->setIsPlus($plus == '+') |
|
343 | + ->setIsText($flag == 't') |
|
344 | + ->setIsBinary($flag == 'b'); |
|
345 | 345 | |
346 | 346 | return $this; |
347 | 347 | } |
@@ -267,16 +267,16 @@ |
||
267 | 267 | return strlen($data); |
268 | 268 | } |
269 | 269 | |
270 | - /** |
|
271 | - * Seekability accessor. |
|
272 | - * |
|
273 | - * Despite the fact that any class that implements this interface must also |
|
274 | - * define methods such as seek, that is no guarantee that an |
|
275 | - * object will necessarily be seekable. This method should tell the user |
|
276 | - * whether a stream is, in fact, seekable. |
|
277 | - * |
|
278 | - * @return boolean True if seekable, false otherwise |
|
279 | - */ |
|
270 | + /** |
|
271 | + * Seekability accessor. |
|
272 | + * |
|
273 | + * Despite the fact that any class that implements this interface must also |
|
274 | + * define methods such as seek, that is no guarantee that an |
|
275 | + * object will necessarily be seekable. This method should tell the user |
|
276 | + * whether a stream is, in fact, seekable. |
|
277 | + * |
|
278 | + * @return boolean True if seekable, false otherwise |
|
279 | + */ |
|
280 | 280 | public function isSeekable() |
281 | 281 | { |
282 | 282 | return $this->seekable; |
@@ -267,16 +267,16 @@ |
||
267 | 267 | return strlen($data); |
268 | 268 | } |
269 | 269 | |
270 | - /** |
|
271 | - * Seekability accessor. |
|
272 | - * |
|
273 | - * Despite the fact that any class that implements this interface must also |
|
274 | - * define methods such as seek, that is no guarantee that an |
|
275 | - * object will necessarily be seekable. This method should tell the user |
|
276 | - * whether a stream is, in fact, seekable. |
|
277 | - * |
|
278 | - * @return boolean True if seekable, false otherwise |
|
279 | - */ |
|
270 | + /** |
|
271 | + * Seekability accessor. |
|
272 | + * |
|
273 | + * Despite the fact that any class that implements this interface must also |
|
274 | + * define methods such as seek, that is no guarantee that an |
|
275 | + * object will necessarily be seekable. This method should tell the user |
|
276 | + * whether a stream is, in fact, seekable. |
|
277 | + * |
|
278 | + * @return boolean True if seekable, false otherwise |
|
279 | + */ |
|
280 | 280 | public function isSeekable() |
281 | 281 | { |
282 | 282 | return $this->seekable; |
@@ -267,16 +267,16 @@ |
||
267 | 267 | return strlen($data); |
268 | 268 | } |
269 | 269 | |
270 | - /** |
|
271 | - * Seekability accessor. |
|
272 | - * |
|
273 | - * Despite the fact that any class that implements this interface must also |
|
274 | - * define methods such as seek, that is no guarantee that an |
|
275 | - * object will necessarily be seekable. This method should tell the user |
|
276 | - * whether a stream is, in fact, seekable. |
|
277 | - * |
|
278 | - * @return boolean True if seekable, false otherwise |
|
279 | - */ |
|
270 | + /** |
|
271 | + * Seekability accessor. |
|
272 | + * |
|
273 | + * Despite the fact that any class that implements this interface must also |
|
274 | + * define methods such as seek, that is no guarantee that an |
|
275 | + * object will necessarily be seekable. This method should tell the user |
|
276 | + * whether a stream is, in fact, seekable. |
|
277 | + * |
|
278 | + * @return boolean True if seekable, false otherwise |
|
279 | + */ |
|
280 | 280 | public function isSeekable() |
281 | 281 | { |
282 | 282 | return $this->seekable; |