Completed
Push — master ( d29062...de4eee )
by Alexey
9s
created

JobResolver::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace SfCod\QueueBundle\Service;
4
5
use SfCod\QueueBundle\Base\JobInterface;
6
use SfCod\QueueBundle\Base\JobResolverInterface;
7
use Symfony\Component\DependencyInjection\ContainerInterface;
8
9
/**
10
 * Class JobResolver
11
 *
12
 * @author Virchenko Maksim <[email protected]>
13
 *
14
 * @package SfCod\QueueBundle\Service
15
 */
16
class JobResolver implements JobResolverInterface
17
{
18
    /**
19
     * @var ContainerInterface
20
     */
21
    protected $container;
22
23
    /**
24
     * JobResolver constructor.
25
     *
26
     * @param ContainerInterface $container
27
     */
28
    public function __construct(ContainerInterface $container)
29
    {
30
        $this->container = $container;
31
    }
32
33
    /**
34
     * Resolve the given class.
35
     *
36
     * @param string $class
37
     *
38
     * @return JobInterface
39
     */
40
    public function resolve(string $class): JobInterface
41
    {
42
        return $this->container->get($class);
43
    }
44
}
45