aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Notifications/Action.php
blob: 8ef1860a0fa4f702167b6de02f3c347ab7fcae70 (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php

namespace Wallabag\CoreBundle\Notifications;

class Action implements ActionInterface {

    /**
     * @var string
     */
    protected $label;

    /**
     * @var int
     */
    protected $type;

    const TYPE_OK = 1;
    const TYPE_YES = 2;
    const TYPE_NO = 3;
    const TYPE_INFO = 4;

    /**
     * @var string
     */
    protected $link;

    /**
     * @return string
     */
    public function getLabel()
    {
        return $this->label;
    }

    /**
     * @param string $label
     * @return ActionInterface
     */
    public function setLabel($label)
    {
        $this->label = $label;
        return $this;
    }

    /**
     * @return int
     */
    public function getType()
    {
        return $this->type;
    }

    /**
     * @param int $type
     * @return ActionInterface
     * @throws \InvalidArgumentException
     */
    public function setType($type)
    {
        if ($type <= 0 || $type > 4) {
            throw new \InvalidArgumentException('The given type option is invalid');
        }
        $this->type = $type;
        return $this;
    }

    /**
     * @return string
     */
    public function getLink()
    {
        return $this->link;
    }

    /**
     * @param string $link
     * @return ActionInterface
     */
    public function setLink($link)
    {
        $this->link = $link;
        return $this;
    }
}