Completed
Push — master ( bd8241...d66abd )
by Akihito
03:20
created

QueueFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
namespace Ackintosh\Snidel;
3
4
use Ackintosh\Snidel\Config;
5
6
class QueueFactory
7
{
8
    /** @var \Ackintosh\Snidel\Config */
9
    private $config;
10
11
    public function __construct(Config $config)
12
    {
13
        $this->config = $config;
14
    }
15
16
    private function createQueue($queueConfig)
17
    {
18
        $className = $queueConfig['className'];
19
        return new $className($this->config);
20
    }
21
22
    public function createTaskQueue()
23
    {
24
        return $this->createQueue($this->config->get('taskQueue'));
25
    }
26
27
    public function createResultQueue()
28
    {
29
        return $this->createQueue($this->config->get('resultQueue'));
30
    }
31
}
32