diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Event/Activity/Actions/Entry/EntryTaggedEvent.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Event/Activity/Actions/Entry/EntryTaggedEvent.php | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Event/Activity/Actions/Entry/EntryTaggedEvent.php b/src/Wallabag/CoreBundle/Event/Activity/Actions/Entry/EntryTaggedEvent.php new file mode 100644 index 00000000..1ea8a7f1 --- /dev/null +++ b/src/Wallabag/CoreBundle/Event/Activity/Actions/Entry/EntryTaggedEvent.php | |||
@@ -0,0 +1,55 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Event\Activity\Actions\Entry; | ||
4 | |||
5 | use Wallabag\CoreBundle\Entity\Entry; | ||
6 | use Wallabag\CoreBundle\Entity\Tag; | ||
7 | |||
8 | /** | ||
9 | * This event is fired as soon as a tag is added on an entry. | ||
10 | */ | ||
11 | class EntryTaggedEvent extends EntryEvent | ||
12 | { | ||
13 | const NAME = 'entry.tagged'; | ||
14 | |||
15 | /** @var Tag[] */ | ||
16 | protected $tags; | ||
17 | |||
18 | /** | ||
19 | * @var boolean | ||
20 | */ | ||
21 | protected $remove; | ||
22 | |||
23 | /** | ||
24 | * EntryTaggedEvent constructor. | ||
25 | * @param Entry $entry | ||
26 | * @param $tags | ||
27 | * @param bool $remove | ||
28 | */ | ||
29 | public function __construct(Entry $entry, $tags, $remove = false) | ||
30 | { | ||
31 | parent::__construct($entry); | ||
32 | |||
33 | if (false === is_array($tags)) { | ||
34 | $tags = [$tags]; | ||
35 | } | ||
36 | |||
37 | $this->tags = $tags; | ||
38 | } | ||
39 | |||
40 | /** | ||
41 | * @return Tag[] | ||
42 | */ | ||
43 | public function getTags() | ||
44 | { | ||
45 | return $this->tags; | ||
46 | } | ||
47 | |||
48 | /** | ||
49 | * @return bool | ||
50 | */ | ||
51 | public function isRemove() | ||
52 | { | ||
53 | return $this->remove; | ||
54 | } | ||
55 | } | ||