Skip to content

Commit

Permalink
Deprecate Methods and Methods calls
Browse files Browse the repository at this point in the history
- deprecate methods
- remove Reader::fetch usage
- improve StreamIterator
  • Loading branch information
nyamsprod committed Jan 25, 2017
1 parent 74f75e0 commit ef7eef7
Show file tree
Hide file tree
Showing 9 changed files with 159 additions and 77 deletions.
78 changes: 76 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,36 @@

All Notable changes to `Csv` will be documented in this file

## Next
## 8.2.0 - 2017-01-25

### Added

- `AbstractCsv::createFromStream` to enable working with resource stream [issue #202](https://github.com/thephpleague/csv/issues/202)

### Deprecated

- None
- `League\Csv\AbstractCsv::stripBom`
- `League\Csv\Reader::getOffset`
- `League\Csv\Reader::getLimit`
- `League\Csv\Reader::getSortBy`
- `League\Csv\Reader::getFilter`
- `League\Csv\Reader::setOffset`
- `League\Csv\Reader::setLimit`
- `League\Csv\Reader::addSortBy`
- `League\Csv\Reader::addFilter`
- `League\Csv\Reader::fetch`
- `League\Csv\Reader::each`
- `League\Csv\Reader::fetchPairsWithoutDuplicates`
- `League\Csv\Reader::fetchAssoc`
- `League\Csv\Writer::removeFormatter`
- `League\Csv\Writer::hasFormatter`
- `League\Csv\Writer::clearFormatters`
- `League\Csv\Writer::removeValidator`
- `League\Csv\Writer::hasValidator`
- `League\Csv\Writer::clearValidators`
- `League\Csv\Writer::jsonSerialize`
- `League\Csv\Writer::toHTML`
- `League\Csv\Writer::toXML`

### Fixed

Expand Down Expand Up @@ -216,6 +237,7 @@ All Notable changes to `Csv` will be documented in this file
## 7.0.0 - 2015-02-19

### Added

- A new flexible mechanism to format and validate a row before its insertion by adding
- `Writer::addFormatter` to add a formatter to the `Writer` object
- `Writer::removeFormatter` to remove an already registered formatter
Expand All @@ -232,9 +254,11 @@ All Notable changes to `Csv` will be documented in this file
- `League\Csv\Plugin\SkipNullValuesFormatter` to format `null` value on insertion

### Deprecated

- Nothing

### Fixed

- `jsonSerialize`, `toXML` and `toHTML` output can be modified using `Reader` query options methods.
- `AbstractCSV::detectDelimiterList` index keys now represents the occurrence of the found delimiter.
- `getNewline` and `setNewline` are accessible on the `Reader` class too.
Expand All @@ -247,6 +271,7 @@ All Notable changes to `Csv` will be documented in this file
- `Reader::fetchColumn` will automatically filter out non existing values from the return array

### Removed

- Setting `ini_set("auto_detect_line_endings", true);` is no longer set in the class constructor. Mac OS X users must explicitly set this ini options in their script.
- `Writer` and `Reader` default constructor are removed from public API in favor of the named constructors.
- All `Writer` methods and constant related to CSV data validation and formatting before insertion
Expand All @@ -262,6 +287,7 @@ All Notable changes to `Csv` will be documented in this file
## 6.3.0 - 2015-01-21

### Added

- `AbstractCSV::setOutputBOM`
- `AbstractCSV::getOutputBOM`
- `AbstractCSV::getInputBOM`
Expand All @@ -283,6 +309,7 @@ to manage BOM character with CSV.
## 6.2.0 - 2014-12-12

### Added

- `Writer::setNewline` , `Writer::getNewline` to control the newline sequence character added at the end of each CSV row.

### Deprecated
Expand All @@ -300,6 +327,7 @@ to manage BOM character with CSV.
## 6.1.0 - 2014-12-08

### Added

- `Reader::fetchAssoc` now also accepts an integer as first argument representing a row index.

### Deprecated
Expand All @@ -325,6 +353,7 @@ to manage BOM character with CSV.
- Nothing

### Fixed

- Bug Fixed `detectDelimiterList`

### Removed
Expand All @@ -334,19 +363,23 @@ to manage BOM character with CSV.
## 6.0.0 - 2014-08-28

### Added

- Stream Filter API in `League\Csv\AbstractCsv`
- named constructors `createFromPath` and `createFromFileObject` in `League\Csv\AbstractCsv` to ease CSV object instantiation
- `detectDelimiterList` in `League\Csv\AbstractCsv` to replace and remove the use of `RuntimeException` in `detectDelimiter`
- `setEncodingFrom` and `setDecodingFrom` in `League\Csv\AbstractCsv` to replace `setEncoding` and `getEncoding` for naming consistency
- `newWriter` and `newReader` methods in `League\Csv\AbstractCsv` to replace `Writer::getReader` and `Reader::getWriter`

### Deprecated

- Nothing

### Fixed

- `League\Csv\Reader::each` more strict `$callable` MUST returns `true`

### Remove

- `League\Csv\AbstractCsv::detectDelimiter`
- `League\Csv\AbstractCsv::setEncoding` and `League\Csv\AbstractCsv::getEncoding`
- `League\Csv\Reader::setSortBy`
Expand All @@ -363,9 +396,11 @@ to manage BOM character with CSV.
- `League\Csv\Reader::fetchColumn` replaces `League\Csv\Reader::fetchCol` for naming consistency

### Deprecated

- `League\Csv\Reader::fetchCol`

### Fixed

- Nothing

### Removed
Expand All @@ -375,12 +410,15 @@ to manage BOM character with CSV.
## 5.3.1 - 2014-04-09

### Added

- Nothing

### Deprecated

- Nothing

### Fixed

- `$open_mode` default to `r+` in `League\Csv\AbstractCsv` constructors

### Removed
Expand All @@ -390,12 +428,15 @@ to manage BOM character with CSV.
## 5.3.0 - 2014-03-24

### Added

- `League\Csv\Writer::setNullHandlingMode` and `League\Csv\Writer::getNullHandlingMode` to handle `null` value

### Deprecated

- Nothing

### Fixed

- `setting ini_set("auto_detect_line_endings", true);` no longer needed for Mac OS

### Removed
Expand All @@ -405,13 +446,16 @@ to manage BOM character with CSV.
## 5.2.0 - 2014-03-13

### Added

- `League\Csv\Reader::addSortBy`, `League\Csv\Reader::removeSortBy`, `League\Csv\Reader::hasSortBy`, `League\Csv\Reader::clearSortBy` to improve sorting
- `League\Csv\Reader::clearFilter` to align extract filter capabilities to sorting capabilities

### Deprecated

- `League\Csv\Reader::setSortBy` replaced by a better implementation

### Fixed

- `League\Csv\Reader::setOffset` now default to 0;
- `League\Csv\Reader::setLimit` now default to -1;
- `detectDelimiter` bug fixes
Expand All @@ -423,14 +467,17 @@ to manage BOM character with CSV.
## 5.1.0 - 2014-03-11

### Added

- `League\Csv\Reader::each` to ease CSV import data
- `League\Csv\Reader::addFilter`, `League\Csv\Reader::removeFilter`, `League\Csv\Reader::hasFilter` to improve extract filter capabilities
- `detectDelimiter` method to `League\Csv\AbstractCsv` to sniff CSV delimiter character.

### Deprecated

- `League\Csv\Reader::setFilter` replaced by a better implementation

### Fixed

- Nothing

### Removed
Expand All @@ -440,12 +487,15 @@ to manage BOM character with CSV.
## 5.0.0 - 2014-02-28

### Added

- Change namespace from `Bakame\Csv` to `League\Csv`

### Deprecated

- Nothing

### Fixed

- Nothing

### Removed
Expand All @@ -455,6 +505,7 @@ to manage BOM character with CSV.
## 4.2.1 - 2014-02-22

### Fixed

- `$open_mode` validation is done by PHP internals directly

### Removed
Expand All @@ -464,9 +515,11 @@ to manage BOM character with CSV.
## 4.2.0 - 2014-02-17

### Added

- `toXML` method to transcode the CSV into a XML in `Bakame\Csv\AbstractCsv`

### Fixed

- `toHTML` method bug in `Bakame\Csv\AbstractCsv`
- `output` method accepts an optional `$filename` argument
- `Bakame\Csv\Reader::fetchCol` default to `$columnIndex = 0`
Expand All @@ -475,20 +528,24 @@ to manage BOM character with CSV.
## 4.1.2 - 2014-02-14

### Added

- Move from `PSR-0` to `PSR-4` to autoload the library

## 4.1.1 - 2014-02-14

### Fixed

- `Bakame\Csv\Reader` methods fixed
- `jsonSerialize` bug fixed

## 4.1.0 - 2014-02-07

### Added

- `getEncoding` and `setEncoding` methods to `Bakame\Csv\AbstractCsv`

### Fixed

- `Bakame\Csv\Writer::insertOne` takes into account CSV controls
- `toHTML` method takes into account encoding

Expand All @@ -500,13 +557,16 @@ to manage BOM character with CSV.
- `Bakame\Csv\Writer` and `Bakame\Csv\Reader` extend `Bakame\Csv\AbstractCsv`

### Deprecated

- Nothing

### Fixed

- `Bakame\Csv\Reader::fetchOne` is no longer deprecated
- `Bakame\Csv\Reader::fetchCol` no longer accepts a third parameter `$strict`

### Removed

- `Bakame\Csv\Codec` now the library is composer of 2 main classes
- `Bakame\Csv\Reader::getFile`
- `Bakame\Csv\Reader::fetchValue`
Expand All @@ -515,66 +575,80 @@ to manage BOM character with CSV.
## 3.3.0 - 2014-01-28

### Added

- `Bakame\Csv\Reader` implements `IteratorAggregate` Interface
- `Bakame\Csv\Reader::createFromString` to create a CSV object from a raw string
- `Bakame\Csv\Reader::query` accept an optional `$callable` parameter

### Deprecated

- `Bakame\Csv\Reader::getFile` in favor of `Bakame\Csv\Reader::getIterator`

### Removed

- `Bakame\Csv\ReaderInterface` useless interface

### Fixed

- `Bakame\Csv\Reader::fetch*` `$callable` parameter is normalized to accept an array
- `Bakame\Csv\Reader::fetchCol` accepts a third parameter `$strict`

## 3.2.0 - 2014-01-16

### Added

- `Bakame\Csv\Reader` implements the following interfaces `JsonSerializable` and `ArrayAccess`
- `Bakame\Csv\Reader::toHTML` to output the CSV as a HTML table
- `Bakame\Csv\Reader::setFilter`, `Bakame\Csv\Reader::setSortBy`, `Bakame\Csv\Reader::setOffset`, `Bakame\Csv\Reader::setLimit`, `Bakame\Csv\Reader::query` to perform SQL like queries on the CSV content.
- `Bakame\Csv\Codec::setFlags`, `Bakame\Csv\Codec::getFlags`, Bakame\Csv\Codec::__construct : add an optional `$flags` parameter to enable the use of `SplFileObject` constants flags

### Deprecated

- `Bakame\Csv\Reader::fetchOne` replaced by `Bakame\Csv\Reader::offsetGet`
- `Bakame\Csv\Reader::fetchValue` useless method

## 3.1.0 - 2014-01-13

### Added

- `Bakame\Csv\Reader::output` output the CSV data directly in the output buffer
- `Bakame\Csv\Reader::__toString` can be use to echo the raw CSV

## 3.0.1 - 2014-01-10

### Fixed

- `Bakame\Csv\Reader::fetchAssoc` when users keys and CSV row data don't have the same length

## 3.0.0 - 2014-01-10

### Added

- `Bakame\Csv\ReaderInterface`
- `Bakame\Csv\Reader` class

### Fixed

- `Bakame\Csv\Codec::loadString`returns a `Bakame\Csv\Reader` object
- `Bakame\Csv\Codec::loadFile` returns a `Bakame\Csv\Reader` object
- `Bakame\Csv\Codec::save` returns a `Bakame\Csv\Reader` object

## 2.0.0 - 2014-01-09

### Added

- `Bakame\Csv\CsvCodec` class renamed `Bakame\Csv\Codec`

### Deprecated

- Nothing

### Fixed

- Nothing

### Removed

- `Bakame\Csv\Codec::create` from public API

## 1.0.0 - 2013-12-03
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "8.1-dev"
"dev-master": "8.2-dev"
}
}
}
4 changes: 2 additions & 2 deletions docs/basic-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title: Basic Usage

<p class="message-info"><strong>Tips:</strong> Even though you can use the following methods with the <code>League\Csv\Writer</code> object. It is recommended to do so with the <code>League\Csv\Reader</code> class to avoid losing the file cursor position and getting unexpected results when inserting new data.</p>

Once your CSV object is [instantiated](/instantiation) and [configured](/properties/), you can start interacting with the data using a number of methods available to you.
Once your CSV object is [instantiated](/instantiation) and [configured](/properties/), you can start interacting with the data using a number of methods available to you.


## Iterating over the CSV rows
Expand All @@ -17,7 +17,7 @@ The CSV object implements PHP's `IteratorAggregate` interface
~~~php
<?php

public AbstractCsv::getIterator(void): SplFileObject
public AbstractCsv::getIterator(void): Iterator
~~~

You can iterate over your CSV object to extract each CSV row using the `foreach` construct.
Expand Down
Loading

0 comments on commit ef7eef7

Please sign in to comment.