Skip to content

Commit

Permalink
Implementing 9.0 Public API
Browse files Browse the repository at this point in the history
The goals are

- to make the package more SOLID
- to improve stream filter usage

### Added 

#### Classes

- `League\Csv\Statement` : a Constraint builder class
- `League\Csv\RecordSet` : a class to manipulare CSV document records
- `League\Csv\Exception\CsvException` : an interface implemented by all package exceptions
- `League\Csv\Exception\InvalidArgumentException`
- `League\Csv\Exception\RuntimeException`
- `League\Csv\Exception\InsertionException`

### Methods

- `AbstractCsv::isStream` tell whether Stream filtering is supported
- `AbstractCsv::addStreamFilter` append a new Stream filter to the CSV document
- `Reader::getHeaderOffset` returns the CSV document header record offset
- `Reader::getHeader` returns the CSV document header record
- `Reader::select` returns a RecordSet object
- `Reader::setHeaderOffset` sets the CSV document header record offset
- `Writer::getFlushThreshold` returns the flushing mechanism threshold
- `Writer::setFlushThreshold` sets the flushing mechanism threshold

### Fixed 

- Stream filtering is simplified and is supported for every object except when created from `SplFileObject`.
- `Writer::insertOne` returns the numbers of bytes added
- `Writer::insertOne` throws an exception on error instead of failing silently
- `Writer::insertAll` returns the numbers of bytes added
- `AbstractCsv::output` now HTTP/2 compliant
- `AbstractCsv` are no longer clonable.

### Deprecated

- None

### Removed

- `AbstractCsv::newReader`
- `AbstractCsv::newWriter`
- `AbstractCsv::isActiveStreamFilter` replaced by `AbstractCsv::isStream`
- `AbstractCsv::appendStreamFilter` replaced by `Reader::addStreamFilter`
- `AbstractCsv::prependStreamFilter` replaced by `Reader::addStreamFilter`
- `InvalidRowException` replaced by `InsertionException`
- `Writer::fetchDelimitersOccurence`
- `Writer::getIterator`
- `Writer::jsonSerialize`
- `Writer::toXML`
- `Writer::toHTML`
- `Reader::getNewLine`
- `Reader::setNewLine`
- `Reader::fetchAll` replaced by `RecordSet::fetchAll`
- `Reader::fetchOne` replaced by `RecordSet::fetchOne`
- `Reader::fetchColumn` replaced by `RecordSet::fetchColumn`
- `Reader::fetchPairs` replaced by `RecordSet::fetchPairs`
- `Reader::toXML` replaced by `RecordSet::toXML`
- `Reader::toHTML` replaced by `RecordSet::toHTML`

### Internal changes

- Improved `StreamIterator`
- Removed the `League\Csv\Config` namespace
- `AbstractCsv::createFromString` now uses `StreamIterator` instead of `SplFileObject`
- `AbstractCsv::createFromPath` now uses `StreamIterator` instead of `SplFileObject`
  • Loading branch information
nyamsprod authored Feb 27, 2017
1 parent ef1cb2a commit 87bc1aa
Show file tree
Hide file tree
Showing 35 changed files with 2,406 additions and 2,349 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
/.scrutinizer.yml export-ignore
/.travis.yml export-ignore
/docs export-ignore
/README.md export-ignore
/CHANGELOG.md export-ignore
/CONDUCT.md export-ignore
/README.md export-ignore
/phpunit.xml export-ignore
/tests export-ignore
5 changes: 2 additions & 3 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ filter:
checks:
php:
code_rating: true
fix_doc_comments: true
tools:
external_code_coverage:
timeout: 600
runs: 1
runs: 2
php_code_coverage: false
php_loc:
enabled: true
excluded_dirs: [tests, vendor]
php_cpd:
enabled: true
excluded_dirs: [tests, vendor]
excluded_dirs: [tests, vendor]
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ sudo: false
matrix:
include:
- php: 7.0
env: COLLECT_COVERAGE=true VALIDATE_CODING_STYLE=true
- php: 7.1
env: COLLECT_COVERAGE=true VALIDATE_CODING_STYLE=false
- php: 7.1
env: COLLECT_COVERAGE=true VALIDATE_CODING_STYLE=true
- php: hhvm
env: COLLECT_COVERAGE=false VALIDATE_CODING_STYLE=false
fast_finish: true
allow_failures:
- php: hhvm

cache:
directories:
Expand Down
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"ext-mbstring" : "*"
},
"require-dev": {
"phpunit/phpunit" : "^5.2",
"phpunit/phpunit" : "^6.0",
"friendsofphp/php-cs-fixer": "^1.9"
},
"autoload": {
Expand All @@ -40,6 +40,9 @@
"phpunit": "phpunit --coverage-text",
"phpcs": "php-cs-fixer fix -v --diff --dry-run;"
},
"suggest": {
"ext-iconv" : "Needed to ease transcoding CSV using iconv stream filters"
},
"extra": {
"branch-alias": {
"dev-master": "9.x-dev"
Expand Down
6 changes: 3 additions & 3 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
</testsuites>

<filter>
<whitelist>
<directory suffix=".php">src/</directory>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>

<logging>
<log type="junit" target="build/report.junit.xml"/>
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
<log type="coverage-text" target="build/coverage.txt"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
<log type="coverage-clover" target="build/clover.xml"/>
</logging>

</phpunit>
Loading

0 comments on commit 87bc1aa

Please sign in to comment.