Conditions | 4 |
Paths | 6 |
Total Lines | 18 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
23 | protected function _loadUser($userId, $failIfNotFound = TRUE) |
||
24 | { |
||
25 | $fileName = $this->getPath().$userId.".json"; |
||
26 | |||
27 | $data = NULL; |
||
28 | if (file_exists($fileName)) { |
||
29 | $data = json_decode(file_get_contents($this->getPath().$userId.".json"), true); |
||
30 | } |
||
31 | |||
32 | if ($data === NULL) { |
||
33 | if ($failIfNotFound) { |
||
34 | throw new Exception('Error loading data for user: ' . var_export($userId, TRUE)); |
||
35 | } else { |
||
36 | $this->logger->error('Error loading data for user from user storage (file storage)'); |
||
37 | return false; |
||
38 | } |
||
39 | } else { |
||
40 | return $data; |
||
41 | } |
||
54 |