Skip to content

Commit

Permalink
Merge pull request #6 from maschmann/yaml-fileread-deprecation-refact…
Browse files Browse the repository at this point in the history
…oring

Added filecheck, now loading with file_get_contents before YAML::read()
  • Loading branch information
maschmann committed Jul 22, 2015
2 parents 7c3a27d + 9aaca4b commit 8fa7c49
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
language: php
sudo: false

php:
- 5.4
Expand Down
12 changes: 8 additions & 4 deletions Config/AbstractConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,14 @@ public function setConfig($file)
*/
private function readFile($file)
{
if ($this->filecheck && !is_file($file)) {
throw new \InvalidArgumentException(
'Config::Abstract() - Given config file ' . $file . ' does not exist!'
);
if ($this->filecheck) {
if (is_file($file)) {
$file = file_get_contents($file);
} else {
throw new \InvalidArgumentException(
'Config::Abstract() - Given config file ' . $file . ' does not exist!'
);
}
}

return (array)Yaml::parse($file);
Expand Down

0 comments on commit 8fa7c49

Please sign in to comment.