Completed
Push — releases/v0.2.1 ( 5b7c83...363518 )
by Luke
03:29
created
src/CSVelte/IO/Resource.php 2 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
      *
220 220
      * Creates and returns a Stream object for this resource
221 221
      *
222
-     * @return resource The underlying stream resource
222
+     * @return Stream The underlying stream resource
223 223
      */
224 224
     public function __invoke()
225 225
     {
@@ -432,6 +432,7 @@  discard block
 block discarded – undo
432 432
      * until the user specifically requests it.
433 433
      *
434 434
      * @param boolean|null Whether or not to "lazily" open the stream
435
+     * @param boolean|null $lazy
435 436
      * @return $this
436 437
      */
437 438
     protected function setLazy($lazy)
@@ -841,6 +842,7 @@  discard block
 block discarded – undo
841 842
      * only be called on unopened stream resources.
842 843
      *
843 844
      * @param  string The method that is asserting
845
+     * @param string $method
844 846
      * @return void
845 847
      * @throws \CSVelte\Exception\IOException if stream is open
846 848
      */
@@ -857,6 +859,7 @@  discard block
 block discarded – undo
857 859
      * Used internally to ensure that a given stream wrapper is valid and available
858 860
      *
859 861
      * @param  string The name of the stream wrapper
862
+     * @param string $name
860 863
      * @return void
861 864
      * @throws \InvalidArgumentException if wrapper doesn't exist
862 865
      */
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -190,17 +190,17 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/CSVelte/Taster.php 2 patches
Doc Comments   +5 added lines, -1 removed lines patch added patch discarded remove patch
@@ -189,6 +189,7 @@  discard block
 block discarded – undo
189 189
      * replaceQuotedSpecialChars method which (at least to me) makes more sense.
190 190
      *
191 191
      * @param string The string to replace quoted strings within
192
+     * @param string $data
192 193
      * @return string The input string with quoted strings removed
193 194
      * @todo Replace code that uses this method with the replaceQuotedSpecialChars
194 195
      *     method instead. I think it's cleaner.
@@ -559,7 +560,7 @@  discard block
 block discarded – undo
559 560
      * Determine whether a particular string of data has quotes around it.
560 561
      *
561 562
      * @param string The data to check
562
-     * @return boolean Whether the data is quoted or not
563
+     * @return integer Whether the data is quoted or not
563 564
      */
564 565
     protected function isQuoted($data)
565 566
     {
@@ -607,6 +608,8 @@  discard block
 block discarded – undo
607 608
      *
608 609
      * @param string The string to do the replacements on
609 610
      * @param string The delimiter character to replace
611
+     * @param string $data
612
+     * @param string $delim
610 613
      * @return string The data with replacements performed
611 614
      * @todo I could probably pass in (maybe optionally) the newline character I
612 615
      *     want to replace as well. I'll do that if I need to.
@@ -632,6 +635,7 @@  discard block
 block discarded – undo
632 635
      * to be practical.
633 636
      *
634 637
      * @param string The string of data to check the type of
638
+     * @param string $data
635 639
      * @return string One of the TYPE_ string constants above
636 640
      */
637 641
     protected function lickType($data)
Please login to merge, or discard this patch.
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -290,20 +290,20 @@  discard block
 block discarded – undo
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 = [];
@@ -380,16 +380,16 @@  discard block
 block discarded – undo
380 380
              *     which one has the best distribution, return that one.
381 381
              */
382 382
 
383
-             $decision = $dups->get($max);
384
-             try {
385
-                 return $this->guessDelimByDistribution($decision, $eol);
386
-             } catch (TasterException $e) {
387
-                 // if somehow we STILL can't come to a consensus, then fall back to a
388
-                 // "preferred delimiters" list...
389
-                 foreach ($this->delims as $key => $val) {
383
+                $decision = $dups->get($max);
384
+                try {
385
+                    return $this->guessDelimByDistribution($decision, $eol);
386
+                } catch (TasterException $e) {
387
+                    // if somehow we STILL can't come to a consensus, then fall back to a
388
+                    // "preferred delimiters" list...
389
+                    foreach ($this->delims as $key => $val) {
390 390
                     if ($delim = array_search($val, $decision)) return $delim;
391
-                 }
392
-             }
391
+                    }
392
+                }
393 393
         }
394 394
         return $delims
395 395
             ->sort()
@@ -446,8 +446,8 @@  discard block
 block discarded – undo
446 446
             })->map(function($dists) {
447 447
                 return $dists->average();
448 448
             })->sort()
449
-              ->reverse()
450
-              ->getKeyAtPosition(0)];
449
+                ->reverse()
450
+                ->getKeyAtPosition(0)];
451 451
         } catch (Exception $e) {
452 452
             throw new TasterException("delimiter cannot be determined by distribution", TasterException::ERR_DELIMITER);
453 453
         }
Please login to merge, or discard this patch.
src/CSVelte/Table/AbstractRow.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
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)
Please login to merge, or discard this patch.
src/CSVelte/Reader.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,8 +91,8 @@
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
src/CSVelte/Exception/HeaderException.php 1 patch
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,6 @@
 block discarded – undo
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
  *
Please login to merge, or discard this patch.
src/CSVelte/IO/BufferStream.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -267,16 +267,16 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
      * Read in the specified amount of characters from the input source
120 120
      *
121 121
      * @param integer Amount of characters to read from input source
122
-     * @return string|boolean The specified amount of characters read from input source
122
+     * @return false|string The specified amount of characters read from input source
123 123
      */
124 124
     public function read($chars)
125 125
     {
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
      *
247 247
      * After the stream has been detached, the stream is in an unusable state.
248 248
      *
249
-     * @return BufferStream|null Underlying PHP stream, if any
249
+     * @return string Underlying PHP stream, if any
250 250
      */
251 251
     public function detach()
252 252
     {
Please login to merge, or discard this patch.
src/CSVelte/Contract/Streamable.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -267,16 +267,16 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/CSVelte/IO/IteratorStream.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -267,16 +267,16 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -259,7 +259,7 @@
 block discarded – undo
259 259
     /**
260 260
      * Closes the stream and any underlying resources.
261 261
      *
262
-     * @return void
262
+     * @return boolean
263 263
      */
264 264
     public function close()
265 265
     {
Please login to merge, or discard this patch.
src/CSVelte/Collection.php 1 patch
Doc Comments   +14 added lines, -11 removed lines patch added patch discarded remove patch
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
      *
616 616
      * @param int|mixed The offset to set
617 617
      * @param any The value to set it to
618
-     * @return boolean
618
+     * @return Collection
619 619
      */
620 620
     public function offsetSet($offset, $value)
621 621
     {
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
      *
685 685
      * @param boolean $multi Whether to count just the items in the collection or
686 686
      *     to count the items in each tabular data row.
687
-     * @return int|\CSVelte\Collection Either an integer count or a collection of counts
687
+     * @return string Either an integer count or a collection of counts
688 688
      */
689 689
     public function count($multi = false)
690 690
     {
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
      * Filter out unwanted items using a callback function.
772 772
      *
773 773
      * @param Callable $callback
774
-     * @return CSVelte\Collection A new collection with filtered items removed
774
+     * @return Collection A new collection with filtered items removed
775 775
      */
776 776
     public function filter(Callable $callback)
777 777
     {
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
      * Returns an array where the key is a value in the collection and the value
824 824
      * is the number of times that value appears in the collection.
825 825
      *
826
-     * @return CSVelte\Collection A collection of value frequencies (see description)
826
+     * @return Collection A collection of value frequencies (see description)
827 827
      */
828 828
     public function frequency()
829 829
     {
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
      * Returns a collection with duplicate values removed. If two-dimensional,
848 848
      * then each array within the collection will have its duplicates removed.
849 849
      *
850
-     * @return CSVelte\Collection A new collection with duplicate values removed.
850
+     * @return Collection A new collection with duplicate values removed.
851 851
      */
852 852
     public function unique()
853 853
     {
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
      * Returns a collection of arrays where the key is the duplicate value
864 864
      * and the value is an array of keys from the original collection.
865 865
      *
866
-     * @return CSVelte\Collection A new collection with duplicate values.
866
+     * @return Collection A new collection with duplicate values.
867 867
      */
868 868
     public function duplicates()
869 869
     {
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
      *
882 882
      * Get a new collection where the keys and values have been swapped.
883 883
      *
884
-     * @return CSVelte\Collection A new collection where keys/values have been swapped
884
+     * @return Collection A new collection where keys/values have been swapped
885 885
      */
886 886
     public function flip()
887 887
     {
@@ -895,7 +895,7 @@  discard block
 block discarded – undo
895 895
      * first is the default.
896 896
      *
897 897
      * @param boolean Whether you want pairs in [k => v] rather than [k, v] format
898
-     * @return CSVelte\Collection A collection of key/value pairs
898
+     * @return Collection A collection of key/value pairs
899 899
      */
900 900
     public function pairs($alt = false)
901 901
     {
@@ -1059,7 +1059,7 @@  discard block
 block discarded – undo
1059 1059
      *
1060 1060
      * @param Callable $callback The sorting function you want to use
1061 1061
      * @param boolean $preserve_keys Whether you want to preserve keys
1062
-     * @return CSVelte\Collection A new collection sorted by $callback
1062
+     * @return Collection A new collection sorted by $callback
1063 1063
      */
1064 1064
     public function sort(Callable $callback = null, $preserve_keys = true)
1065 1065
     {
@@ -1089,7 +1089,7 @@  discard block
 block discarded – undo
1089 1089
      * @param string $key The key you want to order by
1090 1090
      * @param Callable $cmp The sorting comparison algorithm to use
1091 1091
      * @param boolean $preserve_keys Whether keys should be preserved
1092
-     * @return CSVelte\Collection A new collection sorted by $cmp and $key
1092
+     * @return Collection A new collection sorted by $cmp and $key
1093 1093
      */
1094 1094
     public function orderBy($key, Callable $cmp = null, $preserve_keys = true)
1095 1095
     {
@@ -1113,13 +1113,16 @@  discard block
 block discarded – undo
1113 1113
      * trying to write a particular sorting algurithm that sorts forwards and back.
1114 1114
      *
1115 1115
      * @param boolean $preserve_keys Whether keys should be preserved
1116
-     * @return CSVelte\Collection A new collection in reverse order
1116
+     * @return Collection A new collection in reverse order
1117 1117
      */
1118 1118
     public function reverse($preserve_keys = true)
1119 1119
     {
1120 1120
         return new self(array_reverse($this->data, $preserve_keys));
1121 1121
     }
1122 1122
 
1123
+    /**
1124
+     * @param string $method
1125
+     */
1123 1126
     protected function if2DMapInternalMethod($method)
1124 1127
     {
1125 1128
         if ($this->is2D()) {
Please login to merge, or discard this patch.