Skip to content

Commit

Permalink
Make the Importer fluent
Browse files Browse the repository at this point in the history
  • Loading branch information
Konafets committed Dec 4, 2017
1 parent 2d42306 commit 0189f49
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ $collection = $excel->getCollection();

The importer class is fluent, then you can also write
```
return Importer::make('Excel')->getCollection($filepath)->getCollection();
return Importer::make('Excel')->load($filepath)->getCollection();
```

### Advanced usage
Expand Down
4 changes: 4 additions & 0 deletions src/Importer/AbstractSpreadsheet.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ public function __call($name, $args)
public function load($path)
{
$this->path = $path;
return $this;
}

public function setSheet($sheet)
{
$this->sheet = $sheet;
return $this;
}

public function hasHeader($hasHeaderRow)
Expand All @@ -52,11 +54,13 @@ public function hasHeader($hasHeaderRow)
public function setParser(ParserInterface $parser)
{
$this->parser = $parser;
return $this;
}

public function setModel(Model $model)
{
$this->model = $model;
return $this;
}

abstract public function getType();
Expand Down

0 comments on commit 0189f49

Please sign in to comment.