aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Event/Activity/Actions/Entry/EntryTaggedEvent.php
blob: 1ea8a7f1211f0da191cc0b1867910558de03cf62 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php

namespace Wallabag\CoreBundle\Event\Activity\Actions\Entry;

use Wallabag\CoreBundle\Entity\Entry;
use Wallabag\CoreBundle\Entity\Tag;

/**
 * This event is fired as soon as a tag is added on an entry.
 */
class EntryTaggedEvent extends EntryEvent
{
    const NAME = 'entry.tagged';

    /** @var Tag[] */
    protected $tags;

    /**
     * @var boolean
     */
    protected $remove;

    /**
     * EntryTaggedEvent constructor.
     * @param Entry $entry
     * @param $tags
     * @param bool $remove
     */
    public function __construct(Entry $entry, $tags, $remove = false)
    {
        parent::__construct($entry);

        if (false === is_array($tags)) {
            $tags = [$tags];
        }

        $this->tags = $tags;
    }

    /**
     * @return Tag[]
     */
    public function getTags()
    {
        return $this->tags;
    }

    /**
     * @return bool
     */
    public function isRemove()
    {
        return $this->remove;
    }
}