Completed
Push — master ( b03639...e93a17 )
by Dmitry
39s
created

Queue::getName()   A

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