Commit Graph

412 Commits

Author SHA1 Message Date
Christian Bläul
a92506d078 Prevent quoting of sinlge-column file. Needed because auto() with...
...single-column file will not set field delimiter. This commit is a bug fix.

For a test see testSaveWithDefaultSettings.
2018-02-02 11:13:49 +01:00
Christian Bläul
54e846ee30 Construct array key just once instead for better readability 2018-02-02 11:13:49 +01:00
Christian Bläul
63932f67a4 ParseTest: skip 'test_Piwik_data' in PHP 5.4 2018-02-02 11:13:49 +01:00
Christian Bläul
44ff705a23 Improved README.md: spelling, mention native PHP functions 2018-02-02 11:13:49 +01:00
Christian Bläul
6432ba2ced Added test for new field 'use_mb_convert_encoding' 2018-02-02 11:13:49 +01:00
Christian Bläul
8ae09c604b Added support for mb_convert_encoding() instead of iconv()
See issue #109 at GitHub
2018-02-02 11:13:49 +01:00
Christian Bläul
5ea1d95f31 Also run test files ending with Test.php (capital letter) 2018-02-02 11:13:49 +01:00
Christian Bläul
af549dc47e Updated .travis.yml to test with PHP 7.2 2018-02-02 11:13:49 +01:00
Christian Bläul
12aec86bf7 Merge branch 'alex-vlasov-single_quote_auto_detection'
See #74
2018-01-21 21:48:13 +01:00
Christian Bläul
38944ba221 Moved testAutoQuotes into existing test infrastructure 2018-01-21 21:47:28 +01:00
Alexander Vlasov
5a9a10aeed Incorrect parsing with single quote during auto-detection delimiter. 2018-01-21 21:43:42 +01:00
Christian Bläul
631fae5191 Improved PHPDoc of _check_count; Refactored vars in _guess_delimiter
This commit does not contain functional changes.
2018-01-21 01:15:56 +01:00
Christian Bläul
18ddde98c0 Comparison in _enclose_value: put least expensive condition first 2018-01-21 01:15:56 +01:00
Christian Bläul
a07de14bba Slightly more meaningful variable names in 'unparse' function 2018-01-21 01:15:56 +01:00
Christian Bläul
e87a5ae0e6 Improved source code formatting (no functional change) 2018-01-21 01:15:56 +01:00
Christian Bläul
c04fc89c43 Removed @access PHPDoc because it doesn't add value.
Today's phpDocumentor detects visiblity from the PHP keywords.
2018-01-21 01:15:56 +01:00
Christian Bläul
cc908fd096 _detect_and_remove_sep_row_from_data: improved comments to make it more ...
obvious that $data given is changed.
2018-01-21 01:15:56 +01:00
Christian Bläul
155c50ad7a Slightly improved code quality, no functionality changes
E.g.:
- Improved PHPDoc to reflect/include actual types
- Removed unnecessary brackets in ternary statements
- _check_count: Added return statement (code smell)
- added type-safe comparison where it doesn't change results
2018-01-21 01:15:56 +01:00
Christian Bläul
98edcbfec3 Ignore *.bak files that WinMerge leaves behind
I don't want to accidentally add them to the repo.
2018-01-21 01:15:56 +01:00
Christian Bläul
378353eb79 Added PHIVE files to .gitignore 2018-01-21 01:15:56 +01:00
Christian Bläul
e4ca0062f6 Added .idea folder to .gitignore; if you want my PHPStorm settings, go ...
...to GitHub issue #101: https://github.com/parsecsv/parsecsv-for-php/issues/101
2018-01-21 01:15:56 +01:00
Christian Bläul
e419663679 Improved name of files and classes within tests/methods folder
This follows PHP best practices for classes.
2018-01-21 01:15:56 +01:00
Christian Bläul
0ecaa80222 Added .editorconfig to tell others about spaces and tabs
Also:
- formated source code according to these rules;
- added spaces after commas in test code

See GitHub issue #101
2017-12-21 09:33:23 +01:00
Christian Bläul
0ac5064d58 Only call iconv if input and output encoding differ.
This saves some headache if characters are invalid according to iconv.
2017-12-21 09:33:23 +01:00
Christian Bläul
4d011827f5 When we find a BOM, we know the input encoding. Let's use it!
Also: UTF tests not failing anymore because we are specifying
the output encoding now.
2017-12-21 09:33:23 +01:00
Christian Bläul
c818fff81a Only improved spelling in source code comments 2017-12-21 09:33:23 +01:00
Matthew de Marillac
ccad5c8360 Remove BOM from UTF files.
Implementation similar to suggestion from, and thus closes #83
2017-12-21 09:33:23 +01:00
Christian Bläul
b082849b17 Added tests for files starting with a byte order mark (BOM) 2017-12-21 09:33:23 +01:00
Christian Bläul
7536d55f27 PHPUnit: Prevent 'Cannot redeclare class' error
The Travis environments of PHP 5.4 and 5.6 contained both the
namespaced and the global version of the TestCase class :-/
2017-12-06 02:25:54 +01:00
Christian Bläul
db1e242d07 PHPUnit: made compatible with v6, which is now namespaced. 2017-12-06 02:25:54 +01:00
Christian Bläul
fd5fb96bce PHPUnit: simplified Bootstrap.php without changing functionality.
Notes:
- Using / on Windows is safe.
- __DIR__ is identical to dirname(__FILE)
2017-12-06 02:25:54 +01:00
Christian Bläul
4f08cbb561 PHPUnit: added test for UTF-8 and sep= row
Thanks to https://github.com/blaubaer! Some things in the CSV file
originate from java-kata-1 by Gregor Noczinski
2017-12-06 02:25:54 +01:00
Christian Bläul
0d14ca01be Improved sep= detection and added it to auto() 2017-12-06 02:25:54 +01:00
Christian Bläul
a4a0dfa2fd Extracted the long detection algorithm from 'auto()' into new function.
Also removed unnecessary brackets () in ternary on the way.
2017-12-06 02:25:54 +01:00
Christian Bläul
95ad7c315a PHPUnit: told Travis to also run tests on PHP 7 2017-12-06 02:25:54 +01:00
Christian Bläul
0e50aec3b9 Renamed example file 'single_row', as it containes a single column. 2017-12-06 02:25:54 +01:00
Christian Bläul
f5851ba9ac Only improved comments in source code 2017-12-06 02:25:54 +01:00
Jan Piskvor Martinec
fad5ebcdc8 Added function to detect delimiter using sep= file header 2017-12-06 02:25:54 +01:00
Christian Bläul
bd2031582d Added 'single_row' test data for issue #99
Took example documented in #100. Thanks, @tunecino!
2017-11-16 15:29:17 +01:00
Christian Bläul
1db4b02e9e ChangeLog: corrected spelling mistake 2017-11-16 15:29:17 +01:00
Christian Bläul
07f2306a9c Travis configuration: removed hhvm and PHP 5.3
They seem unsupported by GitHub at this point.
2017-11-16 15:29:17 +01:00
Christian Bläul
7eb6daa6fb Added file parse_test.php to check for 'is_readable' warning
As documented in pull request #67
2017-11-16 15:29:17 +01:00
Christian Bläul
240fa0ce23 construct_test.php: only reformatted the code 2017-11-16 15:29:17 +01:00
Salem Ouerdani
1321c3b693 Should fix #99 (zeros breaking lines)
see https://github.com/parsecsv/parsecsv-for-php/issues/99
2017-11-03 21:35:58 +01:00
Christian Bläul
b9cf7cb0c1 Improved PHPDoc blocks
Added missing parameters, wrapped at 80 characters, added types.
2017-11-03 20:25:56 +01:00
Christian Bläul
4bae0d2bcf Re-added the code to grap object-level filename in output()
Follow-up on pull request #88: No breaking compatibality with
older parsecsv versions.

If no output to browser is desired, set $output_filename to null,
or use unparse() function.
2017-11-03 20:23:12 +01:00
Jan Piskvor Martinec
189746405f Do not force filename if not set explicitly
Per docblock, the function output() is supposed to output to browser
    only if filename is passed into it.
    If not, it should return the CSV as a string, not auto-set filename.
2017-11-03 11:30:55 -06:00
Fonata
2ae35c26ff Merge pull request #78 from lbajsarowicz/patch-1
Documentation: added example usage of fields variable
2017-11-03 11:13:47 -06:00
Fonata
2d1b7cebde Merge pull request #67 from BreyndotEchse/patch-1
Suppress file name too long warning
2017-11-02 15:09:33 -06:00
Lukasz Bajsarowicz
b33cc6c667 Example usage of field variable 2016-02-08 00:08:17 +01:00