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

QueueFactory   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A createQueue() 0 5 1
A createTaskQueue() 0 4 1
A createResultQueue() 0 4 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