Skip to content

Commit

Permalink
Merge pull request #2 from stefandanaita/bugfix/singleton
Browse files Browse the repository at this point in the history
Reset arrays in the make functions to avoid having data from previous…
  • Loading branch information
stefandanaita committed Jun 2, 2017
2 parents abe8447 + d543a46 commit 9d5a548
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/CsvValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@ class CsvValidator
/**
* @param \SplFileObject $csv
* @param $rules
* @param array $requiredHeadings
* @param bool $trim
* @param string $encoding
* @return $this
*/
public function make(\SplFileObject $csv, $rules, $requiredHeadings = [], $trim = true, $encoding = 'UTF-8')
{
// Reset the variables
$this->rules = $this->errors = $this->headingKeys = $this->requiredHeadings = [];

$this->setRequiredHeadings($requiredHeadings);
$this->setTrim($trim);
$this->setEncoding($encoding);
Expand Down
2 changes: 1 addition & 1 deletion src/CsvValidatorServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function boot()
public function register()
{
$this->app->bind('csv-validator', function ($app) {
return new CsvValidator();
return new CsvValidator;
});
}

Expand Down

0 comments on commit 9d5a548

Please sign in to comment.