BaseCache   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A proxy() 0 15 2
1
<?php
2
3
/*
4
 * This file is part of Jitamin.
5
 *
6
 * Copyright (C) Jitamin Team
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Jitamin\Foundation\Cache;
13
14
/**
15
 * Base Class for Cache Drivers.
16
 */
17
abstract class BaseCache implements CacheInterface
18
{
19
    /**
20
     * Proxy cache.
21
     *
22
     * Note: Arguments must be scalar types
23
     *
24
     * @param string $class  Class instance
25
     * @param string $method Container method
26
     *
27
     * @return mixed
28
     */
29
    public function proxy($class, $method)
30
    {
31
        $args = func_get_args();
32
        array_shift($args);
33
34
        $key = 'proxy:'.get_class($class).':'.implode(':', $args);
35
        $result = $this->get($key);
36
37
        if ($result === null) {
38
            $result = call_user_func_array([$class, $method], array_splice($args, 1));
39
            $this->set($key, $result);
0 ignored issues
show
Bug introduced by
The call to set() misses a required argument $minutes.

This check looks for function calls that miss required arguments.

Loading history...
40
        }
41
42
        return $result;
43
    }
44
}
45