ModuleUserRepository::findModuleUserFailed()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 11

Duplication

Lines 13
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 13
loc 13
ccs 0
cts 11
cp 0
rs 9.4285
cc 1
eloc 11
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: device
5
 * Date: 23.02.16
6
 * Time: 10:06
7
 */
8
9
namespace AppBundle\Repository;
10
11
12
use AppBundle\Entity\ModuleUser;
13
use Doctrine\ORM\EntityRepository;
14
15
class ModuleUserRepository extends EntityRepository
16
{
17 View Code Duplication
    public function findModuleUserFailed($user)
0 ignored issues
show
Duplication introduced by
This method 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...
18
    {
19
        return $this->createQueryBuilder('mu')
20
            ->select('mu, m, p')
21
            ->join('mu.passModules', 'p')
22
            ->join('mu.module', 'm')
23
            ->where('mu.user = :user')
24
            ->andWhere('mu.status = :failed')
25
            ->setParameter('user', $user)
26
            ->setParameter('failed', ModuleUser::STATUS_FAILED)
27
            ->getQuery()
28
            ->getResult();
29
    }
30
31 View Code Duplication
    public function findModuleUserSuccess($user)
0 ignored issues
show
Duplication introduced by
This method 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...
32
    {
33
        return $this->createQueryBuilder('mu')
34
            ->select('mu, m, p')
35
            ->join('mu.passModules', 'p')
36
            ->join('mu.module', 'm')
37
            ->where('mu.user = :user')
38
            ->andWhere('mu.status = :success')
39
            ->setParameter('user', $user)
40
            ->setParameter('success', ModuleUser::STATUS_SUCCESS)
41
            ->getQuery()
42
            ->getResult();
43
    }
44
45 View Code Duplication
    public function findModuleUserActive($user)
0 ignored issues
show
Duplication introduced by
This method 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...
46
    {
47
        return $this->createQueryBuilder('mu')
48
            ->select('mu, m')
49
            ->join('mu.module', 'm')
50
            ->where('mu.user = :user')
51
            ->andWhere('mu.status = :active')
52
            ->setParameter('user', $user)
53
            ->setParameter('active', ModuleUser::STATUS_ACTIVE)
54
            ->getQuery()
55
            ->getResult();
56
    }
57
58
    public function findInfoPassModules($module)
59
    {
60
        return $this->createQueryBuilder('mu')
61
            ->select('mu, m, u, p')
62
            ->join('mu.module', 'm')
63
            ->join('mu.user', 'u')
64
            ->join('mu.passModules', 'p')
65
            ->where('mu.status <> :active')
66
            ->andWhere('mu.module = :module')
67
            ->orderBy('mu.rating', 'DESC')
68
            ->setParameter('active', ModuleUser::STATUS_ACTIVE)
69
            ->setParameter('module', $module)
70
            ->getQuery()
71
            ->getResult();
72
    }
73
74 2
    public function findModules($user)
75
    {
76 2
        return $this->createQueryBuilder('mu')
77 2
            ->select('mu, m, p')
78 2
            ->leftJoin('mu.passModules', 'p')
79 2
            ->leftJoin('mu.module', 'm')
80 2
            ->where('mu.user = :user')
81 2
            ->setParameter('user', $user)
82 2
            ->getQuery()
83 2
            ->getResult();
84
    }
85
86
87
}