Completed
Push — master ( a70ca2...b8c2a5 )
by Daniel
14:22
created

MethodLoader   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A load() 0 11 1
A supports() 0 4 1
A getContainer() 0 4 1
1
<?php
2
3
namespace Cmobi\RabbitmqBundle\Routing;
4
5
use Cmobi\RabbitmqBundle\Routing\MethodCollection;
6
use Symfony\Component\Config\Loader\Loader;
7
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
8
9
class MethodLoader extends Loader
10
{
11
    use ContainerAwareTrait;
12
13
    public function load($resource, $type = null)
14
    {
15
        $collection = new MethodCollection();
16
        $root = $this->getContainer()->getParameter('kernel.root_dir');
17
        $resource = $root . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'rpc_routing.yml';
18
        $type = 'yaml';
19
        $importedRouters = $this->import($resource, $type);
20
        $collection->addCollection($importedRouters);
21
22
        return $collection;
23
    }
24
25
    public function supports($resource, $type = null)
26
    {
27
        return 'rpc' === $type;
28
    }
29
30
    public function getContainer()
31
    {
32
        return $this->container;
33
    }
34
}