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

MethodLoader::getContainer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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