LoadTrainerData::getOrder()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
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\Trainer;
8
9
class LoadTrainerData extends AbstractTeamMemberFixture implements FixtureInterface, OrderedFixtureInterface
10
{
11
    /**
12
     * @param int $teamIndex
13
     *
14
     * @return Trainer
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
        $trainer = new Trainer();
27
        $trainer->setTrainingFactorTackling($factor[0]);
28
        $trainer->setTrainingFactorPassing($factor[1]);
29
        $trainer->setTrainingFactorShooting($factor[2]);
30
        $trainer->setTrainingFactorHeading($factor[3]);
31
        $trainer->setTrainingFactorSpeed($factor[4]);
32
        $trainer->setTrainingFactorCrossing($factor[5]);
33
        $trainer->setTrainingFactorTechnics($factor[6]);
34
        $trainer->setTrainingFactorIntelligence($factor[7]);
35
        $trainer->setTrainingFactorSafety($factor[8]);
36
        $trainer->setTrainingFactorDribbling($factor[9]);
37
        $trainer->setSkill(max(1, min(100, round(rand(1, 100) / $teamIndex * 5))));
38
39
        return $trainer;
40
    }
41
42
    /**
43
     * @return int
44
     */
45
    public function getOrder()
46
    {
47
        return 5;
48
    }
49
}
50