StackManager::remove()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2.5

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 9
ccs 2
cts 4
cp 0.5
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2.5
1
<?php namespace Comodojo\SimpleCache\Components;
2
3
use \Comodojo\Cache\Components\AbstractStackManager;
4
use \Comodojo\SimpleCache\Interfaces\EnhancedSimpleCacheInterface;
5
use \Comodojo\Exception\SimpleCacheException;
6
use \Exception;
7
8
/**
9
 * @package     Comodojo Cache
10
 * @author      Marco Giovinazzi <[email protected]>
11
 * @license     MIT
12
 *
13
 * LICENSE:
14
 *
15
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
 * THE SOFTWARE.
22
 */
23
24
class StackManager extends AbstractStackManager {
25
26 34
    public function add(EnhancedSimpleCacheInterface $provider, $weight) {
27
28 34
        return $this->genericAdd($provider, $weight);
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->genericAdd($provider, $weight) targeting Comodojo\Cache\Component...ckManager::genericAdd() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
29
30
    }
31
32 1
    public function remove($id) {
33
34
        try {
35
36 1
            return parent::remove($id);
37
38
        } catch (Exception $e) {
39
40
            throw new SimpleCacheException($e->getMessage());
41
42
        }
43
44
    }
45
46 1
    public function get($id) {
47
48
        try {
49
50 1
            return parent::get($id);
51
52
        } catch (Exception $e) {
53
54
            throw new SimpleCacheException($e->getMessage());
55
56
        }
57
58
    }
59
60
}
61