Passed
Push — master ( 574b67...81262d )
by Julito
12:08
created

CQuizRepository   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
dl 0
loc 10
rs 10
c 1
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getLink() 0 8 2
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
namespace Chamilo\CourseBundle\Repository;
6
7
use Chamilo\CoreBundle\Entity\Resource\AbstractResource;
8
use Chamilo\CoreBundle\Repository\ResourceRepository;
9
use Chamilo\CoreBundle\Repository\ResourceWithLinkInterface;
10
use Symfony\Component\Routing\RouterInterface;
11
12
/**
13
 * Class CQuizRepository.
14
 */
15
final class CQuizRepository extends ResourceRepository implements ResourceWithLinkInterface
16
{
17
    public function getLink(AbstractResource $exercise, RouterInterface $router, $extraParams = []): string
18
    {
19
        $params = ['name' => 'exercise/overview.php', 'exerciseId' => $exercise->getIid()];
0 ignored issues
show
Bug introduced by
The method getIid() does not exist on Chamilo\CoreBundle\Entit...source\AbstractResource. It seems like you code against a sub-type of said class. However, the method does not exist in Chamilo\CoreBundle\Entity\Course or Chamilo\CourseBundle\Entity\CLink or Chamilo\CourseBundle\Entity\CExerciseCategory or Chamilo\CourseBundle\Entity\CShortcut or Chamilo\CoreBundle\Entity\PersonalFile or Chamilo\CourseBundle\Entity\CLpCategory or Chamilo\CoreBundle\Entity\AccessUrl or Chamilo\CoreBundle\Entity\Illustration. Are you sure you never get one of those? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

19
        $params = ['name' => 'exercise/overview.php', 'exerciseId' => $exercise->/** @scrutinizer ignore-call */ getIid()];
Loading history...
20
        if (!empty($extraParams)) {
21
            $params = array_merge($params, $extraParams);
22
        }
23
24
        return $router->generate('legacy_main', $params);
25
    }
26
}
27