Discount   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A createModification() 0 10 1
1
<?php
2
3
/**
4
 * @author Rafał Muszyński <[email protected]>
5
 * @copyright 2015 Sourcefabric z.ú.
6
 * @license http://www.gnu.org/licenses/gpl-3.0.txt
7
 */
8
namespace Newscoop\PaywallBundle\Discount;
9
10
use Newscoop\PaywallBundle\Entity\Modification;
11
use Newscoop\PaywallBundle\Entity\DiscountInterface;
12
13
/**
14
 * Abstract discount class.
15
 */
16
abstract class Discount implements DiscountTypeInterface
17
{
18
    /**
19
     * @param DiscountInterface $discount
20
     *
21
     * @return DiscountInterface
22
     */
23
    public function createModification(DiscountInterface $discount)
24
    {
25
        $modification = new Modification();
26
        $modification->setLabel('discount');
27
        $modification->setDescription($discount->getDescription());
28
        $modification->setModificationOriginId($discount->getId());
29
        $modification->setModificationType(get_class($discount));
30
31
        return $modification;
32
    }
33
}
34