Completed
Push — develop ( 179622...b8268a )
by Maxime
18:59
created

TaggedListener::handle()   A

Complexity

Conditions 1
Paths 1

Duplication

Lines 0
Ratio 0 %

Size

Total Lines 4
Code Lines 2

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 1
ccs 2
cts 2
cp 1
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
/*
4
 * This file is part of Rocketeer
5
 *
6
 * (c) Maxime Fabre <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 */
12
13
namespace Rocketeer\Services\Events;
14
15
use League\Event\EventInterface;
16
use League\Event\ListenerInterface;
17
18
/**
19
 * A listener that can be assigned
20
 * a particular tag.
21
 */
22
class TaggedListener implements ListenerInterface
23
{
24
    /**
25
     * @var ListenerInterface
26
     */
27
    protected $listener;
28
29
    /**
30
     * @var string
31
     */
32
    protected $tag;
33
34
    /**
35
     * @param ListenerInterface $listener
36
     */
37 3
    public function __construct(ListenerInterface $listener)
38
    {
39 3
        $this->listener = $listener;
40 3
    }
41
42
    /**
43
     * @param string $tag
44
     */
45 3
    public function setTag($tag)
46
    {
47 3
        $this->tag = $tag;
48 3
    }
49
50
    /**
51
     * @return string
52
     */
53 3
    public function getTag()
54
    {
55 3
        return $this->tag;
56
    }
57
58
    /**
59
     * {@inheritdoc}
60
     */
61 3
    public function handle(EventInterface $event)
62
    {
63 3
        return $this->listener->handle($event);
64
    }
65
66
    /**
67
     * {@inheritdoc}
68
     */
69
    public function isListener($listener)
70
    {
71
        return $this->listener->isListener($listener);
72
    }
73
}
74