Completed
Pull Request — master (#1970)
by
unknown
33:06 queued 18:52
created

CartDuplicationEvent::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
/*************************************************************************************/
3
/*      This file is part of the Thelia package.                                     */
4
/*                                                                                   */
5
/*      Copyright (c) OpenStudio                                                     */
6
/*      email : [email protected]                                                       */
7
/*      web : http://www.thelia.net                                                  */
8
/*                                                                                   */
9
/*      For the full copyright and license information, please view the LICENSE.txt  */
10
/*      file that was distributed with this source code.                             */
11
/*************************************************************************************/
12
13
namespace Thelia\Core\Event\Cart;
14
15
use Thelia\Model\Cart;
16
17
class CartDuplicationEvent extends CartEvent
18
{
19
    protected $originalCart;
20
21
    public function __construct(Cart $duplicatedCart, Cart $originalCart)
22
    {
23
        parent::__construct($duplicatedCart);
24
25
        $this->originalCart = $originalCart;
26
    }
27
28
    /**
29
     * @return Cart
30
     */
31
    public function getDuplicatedCart()
32
    {
33
        return parent::getCart();
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (getCart() instead of getDuplicatedCart()). Are you sure this is correct? If so, you might want to change this to $this->getCart().

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...
34
    }
35
36
    /**
37
     * @return Cart
38
     */
39
    public function getOriginalCart()
40
    {
41
        return $this->originalCart;
42
    }
43
}
44