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