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

CLpCategoryRepository   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getLink() 0 12 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
final class CLpCategoryRepository extends ResourceRepository implements ResourceWithLinkInterface
13
{
14
    public function getLink(ResourceInterface $resource, RouterInterface $router, $extraParams = []): string
15
    {
16
        $params = [
17
            'id' => $resource->getResourceIdentifier(),
18
            'name' => 'lp/lp_controller.php',
19
            'action' => 'view_category',
20
        ];
21
        if (!empty($extraParams)) {
22
            $params = array_merge($params, $extraParams);
23
        }
24
25
        return $router->generate('legacy_main', $params);
26
    }
27
}
28