Skip to content

Commit

Permalink
Merge pull request #9 from jn-jairo/patch-3
Browse files Browse the repository at this point in the history
Fix issue #8 file does not exist for url in JSON parser
  • Loading branch information
sergiorodenas authored Jul 29, 2018
2 parents 0595aa9 + 0f22669 commit 1ed9d22
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/Services/JsonCollectionParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,20 @@ public function parse($filePath, $itemCallback, $assoc = true)
throw new IncompleteParseException();
}
}
}

/**
* @param string $filePath
*
* @return resource
* @throws \Exception
*/
protected function openFile($filePath)
{
$stream = @fopen($filePath, 'r');
if (false === $stream) {
throw new \Exception('Unable to open file for read: ' . $filePath);
}

return $stream;
}
}

0 comments on commit 1ed9d22

Please sign in to comment.