Passed
Push — master ( 7f030f...a70d3c )
by Julito
13:07
created

CLpRepository   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 5
dl 0
loc 10
rs 10
c 2
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\ResourceInterface;
8
use Chamilo\CoreBundle\Repository\ResourceRepository;
9
use Chamilo\CoreBundle\Repository\ResourceWithLinkInterface;
10
use Symfony\Component\Routing\RouterInterface;
11
12
/**
13
 * Class CLpRepository.
14
 */
15
final class CLpRepository extends ResourceRepository implements ResourceWithLinkInterface
16
{
17
    public function getLink(ResourceInterface $resource, RouterInterface $router, $extraParams = []): string
18
    {
19
        $params = ['lp_id' => $resource->getResourceIdentifier(), 'name' => 'lp/lp_controller.php', 'action' => 'view'];
20
        if (!empty($extraParams)) {
21
            $params = array_merge($params, $extraParams);
22
        }
23
24
        return $router->generate('legacy_main', $params);
25
    }
26
}
27