GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

InMemoryFactory   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 65.38%

Importance

Changes 0
Metric Value
wmc 7
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 52
ccs 17
cts 26
cp 0.6538
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 8 2
A all() 0 4 1
A count() 0 4 1
A exists() 0 4 1
A remove() 0 8 2
1
<?php
2
3
namespace Bernard\QueueFactory;
4
5
use Bernard\Queue\InMemoryQueue;
6
7
/**
8
 * This is an in memory queue factory. It creates SplQueue objects for the
9
 * queue. This also means it is not possible to introspect with Juno.
10
 */
11
class InMemoryFactory implements \Bernard\QueueFactory
12
{
13
    protected $queues = [];
14
15
    /**
16
     * {@inheritdoc}
17
     */
18 7
    public function create($queueName)
19
    {
20 7
        if (!$this->exists($queueName)) {
21 7
            $this->queues[$queueName] = new InMemoryQueue($queueName);
22 7
        }
23
24 7
        return $this->queues[$queueName];
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30 1
    public function all()
31
    {
32 1
        return $this->queues;
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38 2
    public function count()
39
    {
40 2
        return count($this->queues);
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46 7
    public function exists($queueName)
47
    {
48 7
        return isset($this->queues[$queueName]);
49
    }
50
51
    /**
52
     * {@inheritdoc}
53
     */
54 1
    public function remove($queueName)
55
    {
56 1
        if ($this->exists($queueName)) {
57 1
            $this->queues[$queueName]->close();
58
59 1
            unset($this->queues[$queueName]);
60 1
        }
61 1
    }
62
}
63