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

Commit 8fa7c49

Browse files
committed
Merge pull request #6 from maschmann/yaml-fileread-deprecation-refactoring
Added filecheck, now loading with file_get_contents before YAML::read()
2 parents 7c3a27d + 9aaca4b commit 8fa7c49

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
language: php
2+
sudo: false
23

34
php:
45
- 5.4

Config/AbstractConfig.php

+8-4
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,14 @@ public function setConfig($file)
113113
*/
114114
private function readFile($file)
115115
{
116-
if ($this->filecheck && !is_file($file)) {
117-
throw new \InvalidArgumentException(
118-
'Config::Abstract() - Given config file ' . $file . ' does not exist!'
119-
);
116+
if ($this->filecheck) {
117+
if (is_file($file)) {
118+
$file = file_get_contents($file);
119+
} else {
120+
throw new \InvalidArgumentException(
121+
'Config::Abstract() - Given config file ' . $file . ' does not exist!'
122+
);
123+
}
120124
}
121125

122126
return (array)Yaml::parse($file);

0 commit comments

Comments
 (0)