GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

LearningOutcomeRepository::getFromAgreement()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 9.7
c 0
b 0
f 0
cc 3
nc 3
nop 1
1
<?php
2
3
namespace AppBundle\Entity;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
use Doctrine\ORM\EntityRepository;
7
8
class LearningOutcomeRepository extends EntityRepository
9
{
10
    public function getFromAgreement(Agreement $agreement)
11
    {
12
        $em = $this->getEntityManager();
13
        $activities = $agreement->getActivities();
14
15
        $outcomes = new ArrayCollection();
16
17
        /** @var Activity $activity */
18
        foreach ($activities as $activity) {
19
            if (false === $outcomes->contains($activity->getLearningOutcome())) {
20
                $outcomes->add($activity->getLearningOutcome());
21
            }
22
        }
23
        return $em->createQuery('SELECT l FROM AppBundle:LearningOutcome l WHERE l.id IN (:outcomes) ORDER BY l.code')
24
            ->setParameter('outcomes', $outcomes)
25
            ->getResult();
26
    }
27
28
    public function getLearningProgramFromAgreement(Agreement $agreement)
29
    {
30
        $learningOutcomes = $this->getFromAgreement($agreement);
31
        $result = [];
32
33
        foreach ($learningOutcomes as $learningOutcome) {
34
            $item = [];
35
            $item['learning_outcome'] = $learningOutcome;
36
            $item['activities'] = $this->getEntityManager()->getRepository('AppBundle:Activity')->getFromAgreementAndLearningOutcome($agreement, $learningOutcome);
37
            $result[] = $item;
38
        }
39
40
        return $result;
41
    }
42
}
43