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