Failed Conditions
Pull Request — develop (#17)
by Carlo
13:58
created

OauthConsumer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 19
loc 19
wmc 2
lcom 1
cbo 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A build() 10 10 2

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
namespace Magefix\Fixture\Builder;
4
5
use Magefix\Fixture\Builder\Helper\ApiUser as ApiUserHelper;
6
use Magefix\Fixture\Factory\Builder;
7
use Magefix\Fixture\Instanciator;
8
9
/**
10
 * Class ApiUser
11
 * @package Magefix\Fixture\Builder
12
 *
13
 * @author  Carlo Tasca <[email protected]>
14
 */
15 View Code Duplication
class OauthConsumer extends AbstractBuilder
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...
16
{
17
    /**
18
     *
19
     * Concrete classes to provide implementation for build method
20
     *
21
     * @return mixed
22
     */
23
    public function build()
24
    {
25
        $this->iterateFixture();
26
        $defaultData = $this->_getMageModelData() ? $this->_getMageModelData() : [];
27
        $mergedData  = array_merge($defaultData, $this->_getFixtureAttributes());
28
29
        $this->_getMageModel()->setData($mergedData);
30
31
        return $this->_saveFixture();
32
    }
33
}