Skip to content
This repository was archived by the owner on Oct 26, 2024. It is now read-only.

Added filecheck, now loading with file_get_contents before YAML::read() #6

Merged
merged 2 commits into from
Jul 22, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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