@@ -1,18 +1,18 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | class JConfig { |
| 3 | - public function __construct( $_path ) { |
|
| 4 | - if(!is_string($_path)) |
|
| 3 | + public function __construct($_path) { |
|
| 4 | + if (!is_string($_path)) |
|
| 5 | 5 | throw new JException("Path must be a string."); |
| 6 | - if(!file_exists($_path)) |
|
| 6 | + if (!file_exists($_path)) |
|
| 7 | 7 | throw new JException("File [$_path] not found."); |
| 8 | 8 | $data = file_get_contents($_path); |
| 9 | 9 | $data = json_decode($data); |
| 10 | - if($data === NULL) |
|
| 10 | + if ($data === NULL) |
|
| 11 | 11 | throw new JException("Invalid file data. [$_path]"); |
| 12 | - if(is_object($data)) |
|
| 12 | + if (is_object($data)) |
|
| 13 | 13 | foreach (get_object_vars($data) as $key => $value) |
| 14 | 14 | $this->$key = $value; |
| 15 | - if(is_array($data)) |
|
| 15 | + if (is_array($data)) |
|
| 16 | 16 | $this->data = $data; |
| 17 | 17 | } |
| 18 | 18 | } |