diff --git a/LICENSE b/LICENSE index 20242042..d29a1dda 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2013 ignace nyamagana butera +Copyright (c) 2013-2014 ignace nyamagana butera Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/src/Iterator/IteratorFilter.php b/src/Iterator/IteratorFilter.php index 00da7b53..888c97cc 100644 --- a/src/Iterator/IteratorFilter.php +++ b/src/Iterator/IteratorFilter.php @@ -1,34 +1,14 @@ <?php /** -* League.csv - A CSV data manipulation library +* This file is part of the League.csv library * -* @author Ignace Nyamagana Butera <nyamsprod@gmail.com> -* @copyright 2014 Ignace Nyamagana Butera -* @link https://github.com/thephpleague/csv/ * @license http://opensource.org/licenses/MIT +* @link https://github.com/thephpleague/csv/ * @version 5.5.0 * @package League.csv * -* MIT LICENSE -* -* Permission is hereby granted, free of charge, to any person obtaining -* a copy of this software and associated documentation files (the -* "Software"), to deal in the Software without restriction, including -* without limitation the rights to use, copy, modify, merge, publish, -* distribute, sublicense, and/or sell copies of the Software, and to -* permit persons to whom the Software is furnished to do so, subject to -* the following conditions: -* -* The above copyright notice and this permission notice shall be -* included in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. */ namespace League\Csv\Iterator; diff --git a/src/Iterator/IteratorInterval.php b/src/Iterator/IteratorInterval.php index 678db600..fe3cbb45 100644 --- a/src/Iterator/IteratorInterval.php +++ b/src/Iterator/IteratorInterval.php @@ -1,34 +1,13 @@ <?php /** -* League.csv - A CSV data manipulation library +* This file is part of the League.csv library * -* @author Ignace Nyamagana Butera <nyamsprod@gmail.com> -* @copyright 2014 Ignace Nyamagana Butera -* @link https://github.com/thephpleague/csv/ * @license http://opensource.org/licenses/MIT * @version 5.5.0 * @package League.csv * -* MIT LICENSE -* -* Permission is hereby granted, free of charge, to any person obtaining -* a copy of this software and associated documentation files (the -* "Software"), to deal in the Software without restriction, including -* without limitation the rights to use, copy, modify, merge, publish, -* distribute, sublicense, and/or sell copies of the Software, and to -* permit persons to whom the Software is furnished to do so, subject to -* the following conditions: -* -* The above copyright notice and this permission notice shall be -* included in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. */ namespace League\Csv\Iterator; diff --git a/src/Iterator/IteratorSortBy.php b/src/Iterator/IteratorSortBy.php index aa85b922..9324364f 100644 --- a/src/Iterator/IteratorSortBy.php +++ b/src/Iterator/IteratorSortBy.php @@ -1,34 +1,14 @@ <?php /** -* League.csv - A CSV data manipulation library +* This file is part of the League.csv library * -* @author Ignace Nyamagana Butera <nyamsprod@gmail.com> -* @copyright 2014 Ignace Nyamagana Butera -* @link https://github.com/thephpleague/csv/ * @license http://opensource.org/licenses/MIT +* @link https://github.com/thephpleague/csv/ * @version 5.5.0 * @package League.csv * -* MIT LICENSE -* -* Permission is hereby granted, free of charge, to any person obtaining -* a copy of this software and associated documentation files (the -* "Software"), to deal in the Software without restriction, including -* without limitation the rights to use, copy, modify, merge, publish, -* distribute, sublicense, and/or sell copies of the Software, and to -* permit persons to whom the Software is furnished to do so, subject to -* the following conditions: -* -* The above copyright notice and this permission notice shall be -* included in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. */ namespace League\Csv\Iterator; diff --git a/src/Iterator/MapIterator.php b/src/Iterator/MapIterator.php index ef6d3434..32399026 100644 --- a/src/Iterator/MapIterator.php +++ b/src/Iterator/MapIterator.php @@ -1,34 +1,14 @@ <?php /** -* League.csv - A CSV data manipulation library +* This file is part of the League.csv library * -* @author Ignace Nyamagana Butera <nyamsprod@gmail.com> -* @copyright 2014 Ignace Nyamagana Butera -* @link https://github.com/thephpleague/csv/ * @license http://opensource.org/licenses/MIT +* @link https://github.com/thephpleague/csv/ * @version 5.5.0 * @package League.csv * -* MIT LICENSE -* -* Permission is hereby granted, free of charge, to any person obtaining -* a copy of this software and associated documentation files (the -* "Software"), to deal in the Software without restriction, including -* without limitation the rights to use, copy, modify, merge, publish, -* distribute, sublicense, and/or sell copies of the Software, and to -* permit persons to whom the Software is furnished to do so, subject to -* the following conditions: -* -* The above copyright notice and this permission notice shall be -* included in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. */ namespace League\Csv\Iterator; diff --git a/src/Reader.php b/src/Reader.php index 648c3e31..f8c733b8 100644 --- a/src/Reader.php +++ b/src/Reader.php @@ -1,34 +1,14 @@ <?php /** -* League.csv - A CSV data manipulation library +* This file is part of the League.csv library * -* @author Ignace Nyamagana Butera <nyamsprod@gmail.com> -* @copyright 2014 Ignace Nyamagana Butera -* @link https://github.com/thephpleague/csv/ * @license http://opensource.org/licenses/MIT +* @link https://github.com/thephpleague/csv/ * @version 5.5.0 * @package League.csv * -* MIT LICENSE -* -* Permission is hereby granted, free of charge, to any person obtaining -* a copy of this software and associated documentation files (the -* "Software"), to deal in the Software without restriction, including -* without limitation the rights to use, copy, modify, merge, publish, -* distribute, sublicense, and/or sell copies of the Software, and to -* permit persons to whom the Software is furnished to do so, subject to -* the following conditions: -* -* The above copyright notice and this permission notice shall be -* included in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. */ namespace League\Csv; @@ -72,6 +52,9 @@ class Reader extends AbstractCsv /** * Intelligent Array Combine * + * add or remove values from the $value array to + * match array $keys length before using PHP array_combine function + * * @param array $keys * @param array $value * @@ -95,7 +78,7 @@ private static function combineArray(array $keys, array $value) * * @param callable $callable a callable function to be applied to each Iterator item * - * @return \Iterator + * @return \Traversable */ public function query(callable $callable = null) { diff --git a/src/Stream/StreamFilter.php b/src/Stream/StreamFilter.php index b8669deb..1f2ac6e0 100644 --- a/src/Stream/StreamFilter.php +++ b/src/Stream/StreamFilter.php @@ -1,34 +1,14 @@ <?php /** -* League.csv - A CSV data manipulation library +* This file is part of the League.csv library * -* @author Ignace Nyamagana Butera <nyamsprod@gmail.com> -* @copyright 2014 Ignace Nyamagana Butera -* @link https://github.com/thephpleague/csv/ * @license http://opensource.org/licenses/MIT +* @link https://github.com/thephpleague/csv/ * @version 5.5.0 * @package League.csv * -* MIT LICENSE -* -* Permission is hereby granted, free of charge, to any person obtaining -* a copy of this software and associated documentation files (the -* "Software"), to deal in the Software without restriction, including -* without limitation the rights to use, copy, modify, merge, publish, -* distribute, sublicense, and/or sell copies of the Software, and to -* permit persons to whom the Software is furnished to do so, subject to -* the following conditions: -* -* The above copyright notice and this permission notice shall be -* included in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. */ namespace League\Csv\Stream; @@ -91,7 +71,8 @@ protected function initStreamFilter($path) } $path = trim($path); - //if we are submitting a filter meta wrapper we extract and inject the info + //if we are submitting a filter meta wrapper + //we extract and inject the mode, the filter and the path if (preg_match( ',^php://filter/(?P<mode>:?read=|write=)?(?P<filters>.*?)/resource=(?P<resource>.*)$,i', $path, @@ -119,6 +100,10 @@ protected function initStreamFilter($path) /** * stream filter mode Setter + * + * Set the new Stream Filter mode and remove all + * previously attached stream filters + * * @param integer $mode * * @return self diff --git a/src/Writer.php b/src/Writer.php index ce1589da..02a2da15 100644 --- a/src/Writer.php +++ b/src/Writer.php @@ -1,34 +1,14 @@ <?php /** -* League.csv - A CSV data manipulation library +* This file is part of the League.csv library * -* @author Ignace Nyamagana Butera <nyamsprod@gmail.com> -* @copyright 2014 Ignace Nyamagana Butera -* @link https://github.com/thephpleague/csv/ * @license http://opensource.org/licenses/MIT +* @link https://github.com/thephpleague/csv/ * @version 5.5.0 * @package League.csv * -* MIT LICENSE -* -* Permission is hereby granted, free of charge, to any person obtaining -* a copy of this software and associated documentation files (the -* "Software"), to deal in the Software without restriction, including -* without limitation the rights to use, copy, modify, merge, publish, -* distribute, sublicense, and/or sell copies of the Software, and to -* permit persons to whom the Software is furnished to do so, subject to -* the following conditions: -* -* The above copyright notice and this permission notice shall be -* included in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +* For the full copyright and license information, please view the LICENSE +* file that was distributed with this source code. */ namespace League\Csv; @@ -234,7 +214,7 @@ private function isColumnsCountConsistent(array $row) */ private function validateRow($row) { - //convert input row into a proper array + //convert input string row into a proper array if (self::isValidString($row)) { $row = str_getcsv((string) $row, $this->delimiter, $this->enclosure, $this->escape); } @@ -245,6 +225,7 @@ private function validateRow($row) ); } + //validate row according to null handling mode $check = array_filter($row, function ($value) { return (is_null($value) && self::NULL_AS_EXCEPTION != $this->null_handling_mode) || self::isValidString($value); @@ -261,6 +242,8 @@ private function validateRow($row) /** * set the csv container as a SplFileObject instance + * insure we use the same object for insertion to + * avoid loosing the cursor position * * @return SplFileObject * @@ -308,6 +291,8 @@ public function insertOne($data) /** * Add multiple lines to the CSV your are generating * + * a simple helper/Wrapper method around insertOne + * * @param mixed $rows a multidimentional array or a Traversable object * * @return self