Completed
Push — 2.0 ( b5e900...ba9d42 )
by Marco
05:08
created

StackManager::add()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 5
Ratio 100 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 5
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
crap 1
1
<?php namespace Comodojo\Cache\Components;
2
3
use \Comodojo\Cache\Interfaces\EnhancedCacheItemPoolInterface;
4
use \Comodojo\Exception\CacheException;
5
use \Exception;
6
7
/**
8
 *
9
 * @package     Comodojo Spare Parts
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 View Code Duplication
class StackManager extends AbstractStackManager {
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
25
26 41
    public function add(EnhancedCacheItemPoolInterface $provider, $weight) {
27
28 41
        parent::genericAdd($provider, $weight);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (genericAdd() instead of add()). Are you sure this is correct? If so, you might want to change this to $this->genericAdd().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

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