Completed
Push — master ( 5f10d0...5fdc3a )
by Andrii
11:47
created

EnumPriceHydrator   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 2
dl 15
loc 15
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A extract() 8 8 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 * API for Billing
4
 *
5
 * @link      https://github.com/hiqdev/billing-hiapi
6
 * @package   billing-hiapi
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2017-2018, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\billing\hiapi\price;
12
13
/**
14
 * EnumPrice Hydrator.
15
 *
16
 * @author Andrii Vasyliev <[email protected]>
17
 */
18 View Code Duplication
class EnumPriceHydrator extends PriceHydrator
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...
19
{
20
    /**
21
     * {@inheritdoc}
22
     * @param object|Plan $object
23
     */
24
    public function extract($object)
25
    {
26
        return array_merge(parent::extract($object), array_filter([
27
            'unit'          => $this->hydrator->extract($object->getUnit()),
28
            'currency'      => $this->hydrator->extract($object->getCurrency()),
29
            'sums'          => $sums,
0 ignored issues
show
Bug introduced by
The variable $sums does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
30
        ]));
31
    }
32
}
33