LoadManagerData   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 6.98 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 3
loc 43
ccs 0
cts 29
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
B createEntity() 3 27 3
A getOrder() 0 4 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
namespace OSS\CoreBundle\DataFixtures\ORM;
4
5
use Doctrine\Common\DataFixtures\FixtureInterface;
6
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
7
use OSS\CoreBundle\Entity\Manager;
8
9
class LoadManagerData extends AbstractTeamMemberFixture implements FixtureInterface, OrderedFixtureInterface
10
{
11
    /**
12
     * @param int $teamIndex
13
     *
14
     * @return Manager
15
     */
16
    protected function createEntity($teamIndex)
17
    {
18
        $factor = array();
19
        for ($i = 0; $i < 10; $i++) {
20
            $factor[$i] = 0;
21
        }
22 View Code Duplication
        for ($i = 1; $i <= 100; $i++) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
23
            $factor[rand(0, 9)]++;
24
        }
25
26
        $manager = new Manager();
27
        $manager->setTransferFactorTackling($factor[0]);
28
        $manager->setTransferFactorPassing($factor[1]);
29
        $manager->setTransferFactorShooting($factor[2]);
30
        $manager->setTransferFactorHeading($factor[3]);
31
        $manager->setTransferFactorSpeed($factor[4]);
32
        $manager->setTransferFactorCrossing($factor[5]);
33
        $manager->setTransferFactorTechnics($factor[6]);
34
        $manager->setTransferFactorIntelligence($factor[7]);
35
        $manager->setTransferFactorSafety($factor[8]);
36
        $manager->setTransferFactorDribbling($factor[9]);
37
        $manager->setMoneyBehaviour(rand(1, 3));
38
        $manager->setAcceptTransferScoreOffset(rand(75, 200));
39
        $manager->setDenyTransferScoreOffset(rand(25, 75));
40
41
        return $manager;
42
    }
43
44
    /**
45
     * @return int
46
     */
47
    public function getOrder()
48
    {
49
        return 4;
50
    }
51
}
52