Passed
Push — devel-3.0 ( 3ec0cb...3281db )
by Rubén
03:38
created

UserPreferencesData::isShowAccountSearchFilters()   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\DataModel;
26
27
/**
28
 * Class UserPreferencesData
29
 *
30
 * @package SP\DataModel
31
 */
32
class UserPreferencesData
33
{
34
    /**
35
     * @var int
36
     */
37
    public $user_id = 0;
38
    /**
39
     * Lenguaje del usuario
40
     *
41
     * @var string
42
     */
43
    public $lang = '';
44
    /**
45
     * Tema del usuario
46
     *
47
     * @var string
48
     */
49
    public $theme = '';
50
    /**
51
     * @var int
52
     */
53
    public $resultsPerPage = 0;
54
    /**
55
     * @var bool
56
     */
57
    public $accountLink;
58
    /**
59
     * @var bool
60
     */
61
    public $sortViews = false;
62
    /**
63
     * @var bool
64
     */
65
    public $topNavbar = false;
66
    /**
67
     * @var bool
68
     */
69
    public $optionalActions = false;
70
    /**
71
     * @var bool
72
     */
73
    public $resultsAsCards = false;
74
    /**
75
     * @var bool
76
     */
77
    public $checkNotifications = true;
78
    /**
79
     * @var bool
80
     */
81
    public $showAccountSearchFilters = false;
82
83
    /**
84
     * @return string
85
     */
86
    public function getLang()
87
    {
88
        return $this->lang;
89
    }
90
91
    /**
92
     * @param string $lang
93
     */
94
    public function setLang($lang)
95
    {
96
        $this->lang = $lang;
97
    }
98
99
    /**
100
     * @return string
101
     */
102
    public function getTheme()
103
    {
104
        return $this->theme;
105
    }
106
107
    /**
108
     * @param string $theme
109
     */
110
    public function setTheme($theme)
111
    {
112
        $this->theme = $theme;
113
    }
114
115
    /**
116
     * @return int
117
     */
118
    public function getResultsPerPage()
119
    {
120
        return $this->resultsPerPage;
121
    }
122
123
    /**
124
     * @param int $resultsPerPage
125
     */
126
    public function setResultsPerPage($resultsPerPage)
127
    {
128
        $this->resultsPerPage = $resultsPerPage;
129
    }
130
131
    /**
132
     * @return boolean
133
     */
134
    public function isAccountLink()
135
    {
136
        return $this->accountLink;
137
    }
138
139
    /**
140
     * @param boolean $accountLink
141
     */
142
    public function setAccountLink($accountLink)
143
    {
144
        $this->accountLink = $accountLink;
145
    }
146
147
    /**
148
     * @return boolean
149
     */
150
    public function isSortViews()
151
    {
152
        return $this->sortViews;
153
    }
154
155
    /**
156
     * @param boolean $sortViews
157
     */
158
    public function setSortViews($sortViews)
159
    {
160
        $this->sortViews = $sortViews;
161
    }
162
163
    /**
164
     * @return boolean
165
     */
166
    public function isTopNavbar()
167
    {
168
        return $this->topNavbar;
169
    }
170
171
    /**
172
     * @param boolean $topNavbar
173
     */
174
    public function setTopNavbar($topNavbar)
175
    {
176
        $this->topNavbar = $topNavbar;
177
    }
178
179
    /**
180
     * @return boolean
181
     */
182
    public function isOptionalActions()
183
    {
184
        return $this->optionalActions;
185
    }
186
187
    /**
188
     * @param boolean $optionalActions
189
     */
190
    public function setOptionalActions($optionalActions)
191
    {
192
        $this->optionalActions = $optionalActions;
193
    }
194
195
    /**
196
     * @return int
197
     */
198
    public function getUserId()
199
    {
200
        return $this->user_id;
201
    }
202
203
    /**
204
     * @param int $user_id
205
     */
206
    public function setUserId($user_id)
207
    {
208
        $this->user_id = $user_id;
209
    }
210
211
    /**
212
     * unserialize() checks for the presence of a function with the magic name __wakeup.
213
     * If present, this function can reconstruct any resources that the object may have.
214
     * The intended use of __wakeup is to reestablish any database connections that may have been lost during
215
     * serialization and perform other reinitialization tasks.
216
     *
217
     * @return void
218
     * @link http://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.sleep
219
     */
220
    public function __wakeup()
221
    {
222
        // Para realizar la conversión de nombre de propiedades que empiezan por _
223
        foreach (get_object_vars($this) as $name => $value) {
224
            if (strpos($name, '_') === 0) {
225
                $newName = substr($name, 1);
226
                $this->$newName = $value;
227
228
                // Borrar la variable anterior
229
                unset($this->$name);
230
            }
231
        }
232
    }
233
234
    /**
235
     * @return bool
236
     */
237
    public function isResultsAsCards()
238
    {
239
        return $this->resultsAsCards;
240
    }
241
242
    /**
243
     * @param bool $resultsAsCards
244
     */
245
    public function setResultsAsCards($resultsAsCards)
246
    {
247
        $this->resultsAsCards = $resultsAsCards;
248
    }
249
250
    /**
251
     * @return bool
252
     */
253
    public function isCheckNotifications(): bool
254
    {
255
        return $this->checkNotifications;
256
    }
257
258
    /**
259
     * @param bool $checkNotifications
260
     */
261
    public function setCheckNotifications(bool $checkNotifications)
262
    {
263
        $this->checkNotifications = $checkNotifications;
264
    }
265
266
    /**
267
     * @return bool
268
     */
269
    public function isShowAccountSearchFilters(): bool
270
    {
271
        return $this->showAccountSearchFilters;
272
    }
273
274
    /**
275
     * @param bool $showAccountSearchFilters
276
     */
277
    public function setShowAccountSearchFilters(bool $showAccountSearchFilters)
278
    {
279
        $this->showAccountSearchFilters = $showAccountSearchFilters;
280
    }
281
}