@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | /** |
147 | 147 | * Close stream resource. |
148 | 148 | * |
149 | - * @return boolean True on success or false on failure |
|
149 | + * @return boolean|null True on success or false on failure |
|
150 | 150 | */ |
151 | 151 | public function close() |
152 | 152 | { |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | * |
228 | 228 | * Returns the internal stream resource pointer |
229 | 229 | * |
230 | - * @return resource The open stream resource pointer |
|
230 | + * @return Resource The open stream resource pointer |
|
231 | 231 | */ |
232 | 232 | public function getResource() |
233 | 233 | { |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | * |
266 | 266 | * After the stream has been detached, the stream is in an unusable state. |
267 | 267 | * |
268 | - * @return Resource|null Underlying PHP stream, if any |
|
268 | + * @return Resource Underlying PHP stream, if any |
|
269 | 269 | */ |
270 | 270 | public function detach() |
271 | 271 | { |
@@ -19,7 +19,6 @@ |
||
19 | 19 | use CSVelte\Contract\Readable; |
20 | 20 | use CSVelte\Contract\Writable; |
21 | 21 | use CSVelte\Contract\Seekable; |
22 | - |
|
23 | 22 | use CSVelte\Exception\NotYetImplementedException; |
24 | 23 | |
25 | 24 | /** |
@@ -329,7 +329,7 @@ |
||
329 | 329 | * @param string $str The string to unescape |
330 | 330 | * @param string $esc The escape character used |
331 | 331 | * @param string $quo The quote character used |
332 | - * @return mixed The string with characters unescaped |
|
332 | + * @return string The string with characters unescaped |
|
333 | 333 | * @todo This actually shouldn't even be necessary. Characters should be read |
334 | 334 | * in one at a time and a quote that follows another should just be ignored |
335 | 335 | * deeming this unnecessary. |
@@ -14,11 +14,9 @@ |
||
14 | 14 | namespace CSVelte; |
15 | 15 | |
16 | 16 | use CSVelte\Contract\Streamable; |
17 | - |
|
18 | 17 | use CSVelte\Table\Row; |
19 | 18 | use CSVelte\Table\HeaderRow; |
20 | 19 | use CSVelte\Reader\FilteredIterator as FilteredReader; |
21 | - |
|
22 | 20 | use CSVelte\Exception\EndOfFileException; |
23 | 21 | |
24 | 22 | use function |
@@ -562,7 +562,7 @@ |
||
562 | 562 | * Determine whether a particular string of data has quotes around it. |
563 | 563 | * |
564 | 564 | * @param string $data The data to check |
565 | - * @return boolean Whether the data is quoted or not |
|
565 | + * @return integer Whether the data is quoted or not |
|
566 | 566 | */ |
567 | 567 | protected function isQuoted($data) |
568 | 568 | { |
@@ -292,20 +292,20 @@ discard block |
||
292 | 292 | throw new TasterException("quoteChar and delimiter cannot be determined", TasterException::ERR_QUOTE_AND_DELIM); |
293 | 293 | } |
294 | 294 | |
295 | - /** |
|
296 | - * Take a list of likely delimiter characters and find the one that occurs |
|
297 | - * the most consistent amount of times within the provided data. |
|
298 | - * |
|
299 | - * @param string $eol The character(s) used for newlines |
|
300 | - * @return string One of four Flavor::QUOTING_* constants |
|
301 | - * @see Flavor for possible quote style constants |
|
302 | - * @todo Refactor this method--It needs more thorough testing against a wider |
|
303 | - * variety of CSV data to be sure it works reliably. And I'm sure there |
|
304 | - * are many performance and logic improvements that could be made. This |
|
305 | - * is essentially a first draft. |
|
306 | - * @todo Can't use replaceQuotedSpecialChars rather than removeQuotedStrings |
|
307 | - * because the former requires u to know the delimiter |
|
308 | - */ |
|
295 | + /** |
|
296 | + * Take a list of likely delimiter characters and find the one that occurs |
|
297 | + * the most consistent amount of times within the provided data. |
|
298 | + * |
|
299 | + * @param string $eol The character(s) used for newlines |
|
300 | + * @return string One of four Flavor::QUOTING_* constants |
|
301 | + * @see Flavor for possible quote style constants |
|
302 | + * @todo Refactor this method--It needs more thorough testing against a wider |
|
303 | + * variety of CSV data to be sure it works reliably. And I'm sure there |
|
304 | + * are many performance and logic improvements that could be made. This |
|
305 | + * is essentially a first draft. |
|
306 | + * @todo Can't use replaceQuotedSpecialChars rather than removeQuotedStrings |
|
307 | + * because the former requires u to know the delimiter |
|
308 | + */ |
|
309 | 309 | protected function lickDelimiter($eol = "\n") |
310 | 310 | { |
311 | 311 | $frequencies = []; |
@@ -382,16 +382,16 @@ discard block |
||
382 | 382 | * which one has the best distribution, return that one. |
383 | 383 | */ |
384 | 384 | |
385 | - $decision = $dups->get($max); |
|
386 | - try { |
|
387 | - return $this->guessDelimByDistribution($decision, $eol); |
|
388 | - } catch (TasterException $e) { |
|
389 | - // if somehow we STILL can't come to a consensus, then fall back to a |
|
390 | - // "preferred delimiters" list... |
|
391 | - foreach ($this->delims as $key => $val) { |
|
385 | + $decision = $dups->get($max); |
|
386 | + try { |
|
387 | + return $this->guessDelimByDistribution($decision, $eol); |
|
388 | + } catch (TasterException $e) { |
|
389 | + // if somehow we STILL can't come to a consensus, then fall back to a |
|
390 | + // "preferred delimiters" list... |
|
391 | + foreach ($this->delims as $key => $val) { |
|
392 | 392 | if ($delim = array_search($val, $decision)) return $delim; |
393 | - } |
|
394 | - } |
|
393 | + } |
|
394 | + } |
|
395 | 395 | } |
396 | 396 | return $delims |
397 | 397 | ->sort() |
@@ -450,8 +450,8 @@ discard block |
||
450 | 450 | })->map(function($dists) { |
451 | 451 | return $dists->average(); |
452 | 452 | })->sort() |
453 | - ->reverse() |
|
454 | - ->getKeyAtPosition(0)]; |
|
453 | + ->reverse() |
|
454 | + ->getKeyAtPosition(0)]; |
|
455 | 455 | } catch (Exception $e) { |
456 | 456 | throw new TasterException("delimiter cannot be determined by distribution", TasterException::ERR_DELIMITER); |
457 | 457 | } |
@@ -171,7 +171,7 @@ |
||
171 | 171 | * This means taking an array of data, and converting it to a Row object |
172 | 172 | * |
173 | 173 | * @param \Iterator $row of data items |
174 | - * @return AbstractRow |
|
174 | + * @return string |
|
175 | 175 | */ |
176 | 176 | protected function prepareRow(Iterator $row) |
177 | 177 | { |
@@ -19,7 +19,6 @@ |
||
19 | 19 | use CSVelte\Contract\Readable; |
20 | 20 | use CSVelte\Contract\Writable; |
21 | 21 | use CSVelte\Contract\Seekable; |
22 | - |
|
23 | 22 | use CSVelte\Exception\NotYetImplementedException; |
24 | 23 | |
25 | 24 | /** |