Passed
Push — devel-3.0 ( 7ceb3a...2fc71e )
by Rubén
03:58
created

ItemPresetRequest::getItemPresetData()   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\Services\ItemPreset;
26
27
use SP\DataModel\ItemPresetData;
28
29
30
/**
31
 * Class ItemPresetRequest
32
 *
33
 * @package SP\Services\ItemPreset
34
 */
35
class ItemPresetRequest
36
{
37
    /**
38
     * @var ItemPresetData
39
     */
40
    private $itemPresetData;
41
    /**
42
     * @var mixed
43
     */
44
    private $data;
45
46
    /**
47
     * ItemPresetRequest constructor.
48
     *
49
     * @param ItemPresetData $itemPresetData
50
     * @param mixed          $data
51
     */
52
    public function __construct(ItemPresetData $itemPresetData, $data)
53
    {
54
        $this->itemPresetData = $itemPresetData;
55
        $this->data = $data;
56
    }
57
58
    /**
59
     * @return ItemPresetData
60
     */
61
    public function getItemPresetData(): ItemPresetData
62
    {
63
        return $this->itemPresetData;
64
    }
65
66
    /**
67
     * @return mixed
68
     */
69
    public function getData()
70
    {
71
        return $this->data;
72
    }
73
74
    /**
75
     * @return ItemPresetData
76
     */
77
    public function prepareToPersist()
78
    {
79
        $this->itemPresetData->setData(serialize($this->data));
80
81
        return $this->itemPresetData;
82
    }
83
}