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

MethodLoader   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 0
cbo 2
dl 0
loc 19
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A load() 0 11 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
}