Skip to content

Commit ef7eef7

Browse files
committed
Deprecate Methods and Methods calls
- deprecate methods - remove Reader::fetch usage - improve StreamIterator
1 parent 74f75e0 commit ef7eef7

File tree

9 files changed

+159
-77
lines changed

9 files changed

+159
-77
lines changed

CHANGELOG.md

Lines changed: 76 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,36 @@
22

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

5-
## Next
5+
## 8.2.0 - 2017-01-25
66

77
### Added
88

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

1111
### Deprecated
1212

13-
- None
13+
- `League\Csv\AbstractCsv::stripBom`
14+
- `League\Csv\Reader::getOffset`
15+
- `League\Csv\Reader::getLimit`
16+
- `League\Csv\Reader::getSortBy`
17+
- `League\Csv\Reader::getFilter`
18+
- `League\Csv\Reader::setOffset`
19+
- `League\Csv\Reader::setLimit`
20+
- `League\Csv\Reader::addSortBy`
21+
- `League\Csv\Reader::addFilter`
22+
- `League\Csv\Reader::fetch`
23+
- `League\Csv\Reader::each`
24+
- `League\Csv\Reader::fetchPairsWithoutDuplicates`
25+
- `League\Csv\Reader::fetchAssoc`
26+
- `League\Csv\Writer::removeFormatter`
27+
- `League\Csv\Writer::hasFormatter`
28+
- `League\Csv\Writer::clearFormatters`
29+
- `League\Csv\Writer::removeValidator`
30+
- `League\Csv\Writer::hasValidator`
31+
- `League\Csv\Writer::clearValidators`
32+
- `League\Csv\Writer::jsonSerialize`
33+
- `League\Csv\Writer::toHTML`
34+
- `League\Csv\Writer::toXML`
1435

1536
### Fixed
1637

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

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

234256
### Deprecated
257+
235258
- Nothing
236259

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

249273
### Removed
274+
250275
- 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.
251276
- `Writer` and `Reader` default constructor are removed from public API in favor of the named constructors.
252277
- All `Writer` methods and constant related to CSV data validation and formatting before insertion
@@ -262,6 +287,7 @@ All Notable changes to `Csv` will be documented in this file
262287
## 6.3.0 - 2015-01-21
263288

264289
### Added
290+
265291
- `AbstractCSV::setOutputBOM`
266292
- `AbstractCSV::getOutputBOM`
267293
- `AbstractCSV::getInputBOM`
@@ -283,6 +309,7 @@ to manage BOM character with CSV.
283309
## 6.2.0 - 2014-12-12
284310

285311
### Added
312+
286313
- `Writer::setNewline` , `Writer::getNewline` to control the newline sequence character added at the end of each CSV row.
287314

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

302329
### Added
330+
303331
- `Reader::fetchAssoc` now also accepts an integer as first argument representing a row index.
304332

305333
### Deprecated
@@ -325,6 +353,7 @@ to manage BOM character with CSV.
325353
- Nothing
326354

327355
### Fixed
356+
328357
- Bug Fixed `detectDelimiterList`
329358

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

336365
### Added
366+
337367
- Stream Filter API in `League\Csv\AbstractCsv`
338368
- named constructors `createFromPath` and `createFromFileObject` in `League\Csv\AbstractCsv` to ease CSV object instantiation
339369
- `detectDelimiterList` in `League\Csv\AbstractCsv` to replace and remove the use of `RuntimeException` in `detectDelimiter`
340370
- `setEncodingFrom` and `setDecodingFrom` in `League\Csv\AbstractCsv` to replace `setEncoding` and `getEncoding` for naming consistency
341371
- `newWriter` and `newReader` methods in `League\Csv\AbstractCsv` to replace `Writer::getReader` and `Reader::getWriter`
342372

343373
### Deprecated
374+
344375
- Nothing
345376

346377
### Fixed
378+
347379
- `League\Csv\Reader::each` more strict `$callable` MUST returns `true`
348380

349381
### Remove
382+
350383
- `League\Csv\AbstractCsv::detectDelimiter`
351384
- `League\Csv\AbstractCsv::setEncoding` and `League\Csv\AbstractCsv::getEncoding`
352385
- `League\Csv\Reader::setSortBy`
@@ -363,9 +396,11 @@ to manage BOM character with CSV.
363396
- `League\Csv\Reader::fetchColumn` replaces `League\Csv\Reader::fetchCol` for naming consistency
364397

365398
### Deprecated
399+
366400
- `League\Csv\Reader::fetchCol`
367401

368402
### Fixed
403+
369404
- Nothing
370405

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

377412
### Added
413+
378414
- Nothing
379415

380416
### Deprecated
417+
381418
- Nothing
382419

383420
### Fixed
421+
384422
- `$open_mode` default to `r+` in `League\Csv\AbstractCsv` constructors
385423

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

392430
### Added
431+
393432
- `League\Csv\Writer::setNullHandlingMode` and `League\Csv\Writer::getNullHandlingMode` to handle `null` value
394433

395434
### Deprecated
435+
396436
- Nothing
397437

398438
### Fixed
439+
399440
- `setting ini_set("auto_detect_line_endings", true);` no longer needed for Mac OS
400441

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

407448
### Added
449+
408450
- `League\Csv\Reader::addSortBy`, `League\Csv\Reader::removeSortBy`, `League\Csv\Reader::hasSortBy`, `League\Csv\Reader::clearSortBy` to improve sorting
409451
- `League\Csv\Reader::clearFilter` to align extract filter capabilities to sorting capabilities
410452

411453
### Deprecated
454+
412455
- `League\Csv\Reader::setSortBy` replaced by a better implementation
413456

414457
### Fixed
458+
415459
- `League\Csv\Reader::setOffset` now default to 0;
416460
- `League\Csv\Reader::setLimit` now default to -1;
417461
- `detectDelimiter` bug fixes
@@ -423,14 +467,17 @@ to manage BOM character with CSV.
423467
## 5.1.0 - 2014-03-11
424468

425469
### Added
470+
426471
- `League\Csv\Reader::each` to ease CSV import data
427472
- `League\Csv\Reader::addFilter`, `League\Csv\Reader::removeFilter`, `League\Csv\Reader::hasFilter` to improve extract filter capabilities
428473
- `detectDelimiter` method to `League\Csv\AbstractCsv` to sniff CSV delimiter character.
429474

430475
### Deprecated
476+
431477
- `League\Csv\Reader::setFilter` replaced by a better implementation
432478

433479
### Fixed
480+
434481
- Nothing
435482

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

442489
### Added
490+
443491
- Change namespace from `Bakame\Csv` to `League\Csv`
444492

445493
### Deprecated
494+
446495
- Nothing
447496

448497
### Fixed
498+
449499
- Nothing
450500

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

457507
### Fixed
508+
458509
- `$open_mode` validation is done by PHP internals directly
459510

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

466517
### Added
518+
467519
- `toXML` method to transcode the CSV into a XML in `Bakame\Csv\AbstractCsv`
468520

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

477530
### Added
531+
478532
- Move from `PSR-0` to `PSR-4` to autoload the library
479533

480534
## 4.1.1 - 2014-02-14
481535

482536
### Fixed
537+
483538
- `Bakame\Csv\Reader` methods fixed
484539
- `jsonSerialize` bug fixed
485540

486541
## 4.1.0 - 2014-02-07
487542

488543
### Added
544+
489545
- `getEncoding` and `setEncoding` methods to `Bakame\Csv\AbstractCsv`
490546

491547
### Fixed
548+
492549
- `Bakame\Csv\Writer::insertOne` takes into account CSV controls
493550
- `toHTML` method takes into account encoding
494551

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

502559
### Deprecated
560+
503561
- Nothing
504562

505563
### Fixed
564+
506565
- `Bakame\Csv\Reader::fetchOne` is no longer deprecated
507566
- `Bakame\Csv\Reader::fetchCol` no longer accepts a third parameter `$strict`
508567

509568
### Removed
569+
510570
- `Bakame\Csv\Codec` now the library is composer of 2 main classes
511571
- `Bakame\Csv\Reader::getFile`
512572
- `Bakame\Csv\Reader::fetchValue`
@@ -515,66 +575,80 @@ to manage BOM character with CSV.
515575
## 3.3.0 - 2014-01-28
516576

517577
### Added
578+
518579
- `Bakame\Csv\Reader` implements `IteratorAggregate` Interface
519580
- `Bakame\Csv\Reader::createFromString` to create a CSV object from a raw string
520581
- `Bakame\Csv\Reader::query` accept an optional `$callable` parameter
521582

522583
### Deprecated
584+
523585
- `Bakame\Csv\Reader::getFile` in favor of `Bakame\Csv\Reader::getIterator`
524586

525587
### Removed
588+
526589
- `Bakame\Csv\ReaderInterface` useless interface
527590

528591
### Fixed
592+
529593
- `Bakame\Csv\Reader::fetch*` `$callable` parameter is normalized to accept an array
530594
- `Bakame\Csv\Reader::fetchCol` accepts a third parameter `$strict`
531595

532596
## 3.2.0 - 2014-01-16
533597

534598
### Added
599+
535600
- `Bakame\Csv\Reader` implements the following interfaces `JsonSerializable` and `ArrayAccess`
536601
- `Bakame\Csv\Reader::toHTML` to output the CSV as a HTML table
537602
- `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.
538603
- `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
539604

540605
### Deprecated
606+
541607
- `Bakame\Csv\Reader::fetchOne` replaced by `Bakame\Csv\Reader::offsetGet`
542608
- `Bakame\Csv\Reader::fetchValue` useless method
543609

544610
## 3.1.0 - 2014-01-13
545611

546612
### Added
613+
547614
- `Bakame\Csv\Reader::output` output the CSV data directly in the output buffer
548615
- `Bakame\Csv\Reader::__toString` can be use to echo the raw CSV
549616

550617
## 3.0.1 - 2014-01-10
551618

552619
### Fixed
620+
553621
- `Bakame\Csv\Reader::fetchAssoc` when users keys and CSV row data don't have the same length
554622

555623
## 3.0.0 - 2014-01-10
556624

557625
### Added
626+
558627
- `Bakame\Csv\ReaderInterface`
559628
- `Bakame\Csv\Reader` class
560629

561630
### Fixed
631+
562632
- `Bakame\Csv\Codec::loadString`returns a `Bakame\Csv\Reader` object
563633
- `Bakame\Csv\Codec::loadFile` returns a `Bakame\Csv\Reader` object
564634
- `Bakame\Csv\Codec::save` returns a `Bakame\Csv\Reader` object
565635

566636
## 2.0.0 - 2014-01-09
567637

568638
### Added
639+
569640
- `Bakame\Csv\CsvCodec` class renamed `Bakame\Csv\Codec`
570641

571642
### Deprecated
643+
572644
- Nothing
573645

574646
### Fixed
647+
575648
- Nothing
576649

577650
### Removed
651+
578652
- `Bakame\Csv\Codec::create` from public API
579653

580654
## 1.0.0 - 2013-12-03

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
},
4444
"extra": {
4545
"branch-alias": {
46-
"dev-master": "8.1-dev"
46+
"dev-master": "8.2-dev"
4747
}
4848
}
4949
}

docs/basic-usage.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ title: Basic Usage
77

88
<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>
99

10-
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.
10+
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.
1111

1212

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

20-
public AbstractCsv::getIterator(void): SplFileObject
20+
public AbstractCsv::getIterator(void): Iterator
2121
~~~
2222

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

0 commit comments

Comments
 (0)