Completed
Push — testing/model-reason ( c3acd7 )
by Tomas Norre
05:48
created

Reason::getCreationDate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1.125

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 2
cts 4
cp 0.5
crap 1.125
rs 10
c 0
b 0
f 0
1
<?php
2
namespace AOE\Crawler\Domain\Model;
3
4
/***************************************************************
5
 *  Copyright notice
6
 *
7
 *  (c) 2017 AOE GmbH <[email protected]>
8
 *
9
 *  All rights reserved
10
 *
11
 *  This script is part of the TYPO3 project. The TYPO3 project is
12
 *  free software; you can redistribute it and/or modify
13
 *  it under the terms of the GNU General Public License as published by
14
 *  the Free Software Foundation; either version 3 of the License, or
15
 *  (at your option) any later version.
16
 *
17
 *  The GNU General Public License can be found at
18
 *  http://www.gnu.org/copyleft/gpl.html.
19
 *
20
 *  This script is distributed in the hope that it will be useful,
21
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 *  GNU General Public License for more details.
24
 *
25
 *  This copyright notice MUST APPEAR in all copies of the script!
26
 ***************************************************************/
27
28
/**
29
 * Class Reason
30
 *
31
 */
32
class Reason
33
{
34
    /**
35
     * THE CONSTANTS REPRESENT THE KIND OF THE REASON
36
     *
37
     * Convention for own states: <extensionkey>_<reason>
38
     */
39
    const REASON_DEFAULT = 'crawler_default_reason';
40
    const REASON_GUI_SUBMIT = 'crawler_gui_submit_reason';
41
    const REASON_CLI_SUBMIT = 'crawler_cli_submit_reason';
42
43
    /**
44
     * @var array
45
     */
46
    protected $row;
47
48
    /**
49
     * @param array $row
50
     */
51 2
    public function __construct($row = [])
52
    {
53 2
        $this->row = $row;
54 2
    }
55
56
    /**
57
     * Set uid
58
     *
59
     * @param int uid
60
     * @return void
61
     */
62 1
    public function setUid($uid)
63
    {
64 1
        $this->row['uid'] = $uid;
65 1
    }
66
67
    /**
68
     * @return int
69
     */
70 1
    public function getUid()
71
    {
72 1
        return $this->row['uid'];
73
    }
74
75
    /**
76
     * Method to set a timestamp for the creation time of this record
77
     *
78
     * @param int $time
79
     */
80 1
    public function setCreationDate($time)
81
    {
82 1
        $this->row['crdate'] = $time;
83 1
    }
84
85
    /**
86
     * @return int
87
     */
88 1
    public function getCreationDate()
89
    {
90 1
        return $this->row['crdate'];
91
    }
92
93
    /**
94
     * This method can be used to set a user id of the user who has created this reason entry
95
     *
96
     * @param int $user_id
97
     */
98 1
    public function setBackendUserId($user_id)
99
    {
100 1
        $this->row['cruser_id'] = $user_id;
101 1
    }
102
103
    /**
104
     * @return int
105
     */
106 1
    public function getBackendUserId()
107
    {
108 1
        return $this->row['cruser_id'];
109
    }
110
    /**
111
     * Method to set the type of the reason for this reason instance (see constances)
112
     *
113
     * @param string $string
114
     */
115 1
    public function setReason($string)
116
    {
117 1
        $this->row['reason'] = $string;
118 1
    }
119
120
    /**
121
     * This method returns the attached reason text.
122
     *
123
     * @return string
124
     */
125 1
    public function getReason()
126
    {
127 1
        return $this->row['reason'];
128
    }
129
130
    /**
131
     * This method can be used to assign a detail text to the crawler reason
132
     *
133
     * @param string $detail_text
134
     */
135 1
    public function setDetailText($detail_text)
136
    {
137 1
        $this->row['detail_text'] = $detail_text;
138 1
    }
139
140
    /**
141
     * Returns the attachet detail text.
142
     *
143
     * @return string
144
     */
145 1
    public function getDetailText()
146
    {
147 1
        return $this->row['detail_text'];
148
    }
149
150
    /**
151
     * This method is used to set the uid of the queue entry
152
     * where the reason is relevant for.
153
     *
154
     * @param int $entry_uid
155
     */
156 1
    public function setQueueEntryUid($entry_uid)
157
    {
158 1
        $this->row['queue_entry_uid'] = $entry_uid;
159 1
    }
160
161
    /**
162
     * @return int
163
     */
164 1
    public function getQueueEntryUid()
165
    {
166 1
        return $this->row['queue_entry_uid'];
167
    }
168
169
    /**
170
     * Returns the properties of the object as array
171
     *
172
     * @return array
173
     */
174 2
    public function getRow()
175
    {
176 2
        return $this->row;
177
    }
178
}
179