| Conditions | 9 |
| Paths | 8 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | public function fetch($id, $secondId = null) { |
||
| 22 | $args = func_get_args(); |
||
| 23 | if (!$id || $secondId || is_array($id)) { |
||
| 24 | $id = sha1(serialize($args)); |
||
| 25 | } |
||
| 26 | if ($id && isset($this->cache[$id])) { |
||
| 27 | return $this->cache[$id]; |
||
| 28 | } |
||
| 29 | $ret = forward_static_call_array(array($this->className, 'fetch'), $args); |
||
| 30 | if ($id) { |
||
| 31 | if (is_array($ret)) { |
||
| 32 | foreach ($ret as $key => $value) { |
||
| 33 | $this->cache[$key] = $value; |
||
| 34 | } |
||
| 35 | } else { |
||
| 36 | $this->cache[$id] = $ret; |
||
| 37 | } |
||
| 38 | } |
||
| 39 | return $ret; |
||
| 40 | } |
||
| 41 | |||
| 45 | } |