Skip to content

Commit

Permalink
Fixes exception shouldn't be thrown when casting
Browse files Browse the repository at this point in the history
`Orchestra\Support\Collection` to CSV when no data is available.

Signed-off-by: crynobone <crynobone@gmail.com>
  • Loading branch information
crynobone committed Jul 16, 2014
1 parent 57ef2fa commit aa90039
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions docs/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ title: Support Change Log

## Version 2.1 {#v2-1}

### v2.1.4@dev {#v2-1-4}

* Fixes exception shouldn't be thrown when casting `Orchestra\Support\Collection` to CSV when no data is available.

### v2.1.3 {#v2-1-2}

* Convert `Orchestra\Support\Nesty` to utilize `Orchestra\Support\Collection`.
Expand Down
9 changes: 7 additions & 2 deletions src/Support/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ public function toCsv()
{
$delimiter = ',';
$enclosure = '"';
$single = max($this->items);
$header = array_keys(array_dot($single));
$single = 0;
$header = array();

if (! $this->isEmpty()) {
$single = max($this->items);
$header = array_keys(array_dot($single));
}

ob_start();

Expand Down

0 comments on commit aa90039

Please sign in to comment.