Queue::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace SymfonyBundles\QueueBundle\Service;
4
5
class Queue implements QueueInterface
6
{
7
    /**
8
     * @var string
9
     */
10
    private $name;
11
12
    /**
13
     * @var Storage\StorageInterface
14
     */
15
    private $storage;
16
17
    /**
18
     * {@inheritdoc}
19
     */
20 4
    public function setName($name)
21
    {
22 4
        $this->name = $name;
23 4
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28 1
    public function getName()
29
    {
30 1
        return $this->name;
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36 1
    public function setStorage(Storage\StorageInterface $storage)
37
    {
38 1
        $this->storage = $storage;
39 1
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44 3
    public function pop()
45
    {
46 3
        return $this->storage->first($this->name);
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52 2
    public function push($value)
53
    {
54 2
        $this->storage->append($this->name, $value);
55 2
    }
56
57
    /**
58
     * {@inheritdoc}
59
     */
60 4
    public function count()
61
    {
62 4
        return $this->storage->count($this->name);
63
    }
64
}
65