FixturesLoader   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getFixtures() 0 16 2
A encodePassword() 0 6 1
1
<?php
2
namespace AppBundle\DataFixtures\ORM;
3
4
use Hautelook\AliceBundle\Alice\DataFixtureLoader;
5
use Symfony\Component\Security\Core\User\UserInterface;
6
7
/**
8
 * Class FixturesLoader
9
 * @package AppBundle\DataFixtures\ORM
10
 */
11
class FixturesLoader extends DataFixtureLoader
12
{
13
    /**
14
     * Returns an array of file paths to fixtures
15
     *
16
     * @return array<string>
17
     */
18
    protected function getFixtures()
19
    {
20
        $env = $this->container->get('kernel')->getEnvironment();
21
        if ($env == 'test') {
22
            return [
23
                __DIR__ . '/DataForTests/test.yml',
24
            ];
25
        }
26
        return [
27
            __DIR__ . '/Data/categories.yml',
28
            __DIR__ . '/Data/users.yml',
29
            __DIR__ . '/Data/modules.yml',
30
            __DIR__ . '/Data/questions.yml',
31
            __DIR__ . '/Data/answers.yml',
32
        ];
33
    }
34
35
36
    public function encodePassword(UserInterface $user, $plainPassword)
37
    {
38
        $pass = $this->container->get('security.password_encoder')
39
                ->encodePassword($user, $plainPassword);
40
        return $pass;
41
    }
42
43
44
}