]>
Commit | Line | Data |
---|---|---|
bf6c0346 TC |
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 | } |