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
|
|
|
class Reason |
32
|
|
|
{ |
33
|
|
|
/** |
34
|
|
|
* THE CONSTANTS REPRESENT THE KIND OF THE REASON |
35
|
|
|
* |
36
|
|
|
* Convention for own states: <extensionkey>_<reason> |
37
|
|
|
*/ |
38
|
|
|
public const REASON_DEFAULT = 'crawler_default_reason'; |
39
|
|
|
|
40
|
|
|
public const REASON_GUI_SUBMIT = 'crawler_gui_submit_reason'; |
41
|
|
|
|
42
|
|
|
public const REASON_CLI_SUBMIT = 'crawler_cli_submit_reason'; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @var array |
46
|
|
|
*/ |
47
|
|
|
protected $row; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @param array $row |
51
|
|
|
*/ |
52
|
2 |
|
public function __construct($row = []) |
53
|
|
|
{ |
54
|
2 |
|
$this->row = $row; |
55
|
2 |
|
} |
56
|
|
|
|
57
|
1 |
|
public function setUid(int $uid): void |
58
|
|
|
{ |
59
|
1 |
|
$this->row['uid'] = $uid; |
60
|
1 |
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @return int |
64
|
|
|
*/ |
65
|
1 |
|
public function getUid() |
66
|
|
|
{ |
67
|
1 |
|
return $this->row['uid']; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Method to set a timestamp for the creation time of this record |
72
|
|
|
* |
73
|
|
|
* @param int $time |
74
|
|
|
*/ |
75
|
1 |
|
public function setCreationDate($time): void |
76
|
|
|
{ |
77
|
1 |
|
$this->row['crdate'] = $time; |
78
|
1 |
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @return int |
82
|
|
|
*/ |
83
|
1 |
|
public function getCreationDate() |
84
|
|
|
{ |
85
|
1 |
|
return $this->row['crdate']; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* This method can be used to set a user id of the user who has created this reason entry |
90
|
|
|
* |
91
|
|
|
* @param int $user_id |
92
|
|
|
*/ |
93
|
1 |
|
public function setBackendUserId($user_id): void |
94
|
|
|
{ |
95
|
1 |
|
$this->row['cruser_id'] = $user_id; |
96
|
1 |
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @return int |
100
|
|
|
*/ |
101
|
1 |
|
public function getBackendUserId() |
102
|
|
|
{ |
103
|
1 |
|
return $this->row['cruser_id']; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* Method to set the type of the reason for this reason instance (see constances) |
108
|
|
|
* |
109
|
|
|
* @param string $string |
110
|
|
|
*/ |
111
|
1 |
|
public function setReason($string): void |
112
|
|
|
{ |
113
|
1 |
|
$this->row['reason'] = $string; |
114
|
1 |
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* This method returns the attached reason text. |
118
|
|
|
* |
119
|
|
|
* @return string |
120
|
|
|
*/ |
121
|
1 |
|
public function getReason() |
122
|
|
|
{ |
123
|
1 |
|
return $this->row['reason']; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* This method can be used to assign a detail text to the crawler reason |
128
|
|
|
* |
129
|
|
|
* @param string $detail_text |
130
|
|
|
*/ |
131
|
1 |
|
public function setDetailText($detail_text): void |
132
|
|
|
{ |
133
|
1 |
|
$this->row['detail_text'] = $detail_text; |
134
|
1 |
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* Returns the attachet detail text. |
138
|
|
|
* |
139
|
|
|
* @return string |
140
|
|
|
*/ |
141
|
1 |
|
public function getDetailText() |
142
|
|
|
{ |
143
|
1 |
|
return $this->row['detail_text']; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* This method is used to set the uid of the queue entry |
148
|
|
|
* where the reason is relevant for. |
149
|
|
|
* |
150
|
|
|
* @param int $entry_uid |
151
|
|
|
*/ |
152
|
1 |
|
public function setQueueEntryUid($entry_uid): void |
153
|
|
|
{ |
154
|
1 |
|
$this->row['queue_entry_uid'] = $entry_uid; |
155
|
1 |
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* @return int |
159
|
|
|
*/ |
160
|
1 |
|
public function getQueueEntryUid() |
161
|
|
|
{ |
162
|
1 |
|
return $this->row['queue_entry_uid']; |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* Returns the properties of the object as array |
167
|
|
|
* |
168
|
|
|
* @return array |
169
|
|
|
*/ |
170
|
2 |
|
public function getRow() |
171
|
|
|
{ |
172
|
2 |
|
return $this->row; |
173
|
|
|
} |
174
|
|
|
} |
175
|
|
|
|