Completed
Pull Request — master (#6)
by Beñat
01:52
created

GetFilesRoutesLoader   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 26
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A supports() 0 4 1
A register() 0 18 1
1
<?php
2
3
/*
4
 * This file is part of the BenGorFile package.
5
 *
6
 * (c) Beñat Espiña <[email protected]>
7
 * (c) Gorka Laucirica <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace BenGorFile\FileBundle\Routing\Api;
14
15
use BenGorFile\FileBundle\Routing\RoutesLoader;
16
use Symfony\Component\Routing\Route;
17
18
/**
19
 * @author Beñat Espiña <[email protected]>
20
 */
21
class GetFilesRoutesLoader extends RoutesLoader
22
{
23
    public function supports($resource, $type = null)
24
    {
25
        return 'bengor_file_get_files_api' === $type;
26
    }
27
28
    protected function register($file, array $config)
29
    {
30
        $this->routes->add(
31
            $config['api_name'],
32
            new Route(
33
                $config['api_path'],
34
                [
35
                    '_controller' => 'BenGorFileBundle:Api\GetFiles:byIds',
36
                    'fileClass'   => $file,
37
                ],
38
                [],
39
                [],
40
                '',
41
                [],
42
                ['GET']
43
            )
44
        );
45
    }
46
}
47