Passed
Push — 3.0 ( b611c9...572608 )
by Rubén
03:38
created

MessageBase::getDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * sysPass
4
 *
5
 * @author    nuxsmin
6
 * @link      https://syspass.org
7
 * @copyright 2012-2018, Rubén Domínguez nuxsmin@$syspass.org
8
 *
9
 * This file is part of sysPass.
10
 *
11
 * sysPass is free software: you can redistribute it and/or modify
12
 * it under the terms of the GNU General Public License as published by
13
 * the Free Software Foundation, either version 3 of the License, or
14
 * (at your option) any later version.
15
 *
16
 * sysPass is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 * GNU General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU General Public License
22
 *  along with sysPass.  If not, see <http://www.gnu.org/licenses/>.
23
 */
24
25
namespace SP\Core\Messages;
26
27
/**
28
 * Class MessageBase
29
 *
30
 * @package SP\Core\Messages
31
 */
32
abstract class MessageBase implements MessageInterface
33
{
34
    /**
35
     * @var string
36
     */
37
    protected $title;
38
    /**
39
     * @var array
40
     */
41
    protected $footer = [];
42
    /**
43
     * @var array
44
     */
45
    protected $description = [];
46
47
    /**
48
     * @return static
49
     */
50
    public static function factory()
51
    {
52
        return new static();
53
    }
54
55
    /**
56
     * @return string
57
     */
58
    public function getTitle()
59
    {
60
        return $this->title;
61
    }
62
63
    /**
64
     * @param string $title
65
     *
66
     * @return MessageBase
67
     */
68
    public function setTitle($title)
69
    {
70
        $this->title = $title;
71
72
        return $this;
73
    }
74
75
    /**
76
     * @param FormatterInterface $formatter
77
     * @param bool               $translate
78
     *
79
     * @return string
80
     */
81
    public abstract function getDescription(FormatterInterface $formatter, $translate = false): string;
82
83
    /**
84
     * @param array $description
85
     *
86
     * @return MessageBase
87
     */
88
    public function setDescription(array $description)
89
    {
90
        $this->description = $description;
91
92
        return $this;
93
    }
94
95
    /**
96
     * @param string $description
97
     *
98
     * @return MessageBase
99
     */
100
    public function addDescription($description)
101
    {
102
        $this->description[] = $description;
103
104
        return $this;
105
    }
106
107
    /**
108
     * @return array
109
     */
110
    public function getFooter()
111
    {
112
        return $this->footer;
113
    }
114
115
    /**
116
     * @param array $footer
117
     *
118
     * @return MessageBase
119
     */
120
    public function setFooter(array $footer)
121
    {
122
        $this->footer = $footer;
123
124
        return $this;
125
    }
126
}