-
-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
44 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <[email protected]> | ||
* @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; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <[email protected]> | ||
* @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; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <[email protected]> | ||
* @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; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <[email protected]> | ||
* @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; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <[email protected]> | ||
* @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) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <[email protected]> | ||
* @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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <[email protected]> | ||
* @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 | ||
|