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

CLpRepository::getLink()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
nc 2
nop 3
dl 0
loc 8
rs 10
c 1
b 0
f 0
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