LoadManagerData::createEntity()   B
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 27
Code Lines 21

Duplication

Lines 3
Ratio 11.11 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
dl 3
loc 27
ccs 0
cts 25
cp 0
rs 8.8571
c 0
b 0
f 0
cc 3
eloc 21
nc 4
nop 1
crap 12
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