Completed
Branch master (b7ffcb)
by Tomas Norre
17:57
created

Reason   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 116
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 116
rs 10
c 0
b 0
f 0
wmc 10
lcom 1
cbo 0

10 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A setUid() 0 4 1
A setCreationDate() 0 4 1
A setBackendUserId() 0 4 1
A setReason() 0 4 1
A getReason() 0 4 1
A setDetailText() 0 4 1
A getDetailText() 0 4 1
A setQueueEntryUid() 0 4 1
A getRow() 0 4 1
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
 * @package AOE\Crawler\Domain\Model
32
 */
33
class Reason
34
{
35
    /**
36
     * THE CONSTANTS REPRESENT THE KIND OF THE REASON
37
     *
38
     * Convention for own states: <extensionkey>_<reason>
39
     */
40
    const REASON_DEFAULT = 'crawler_default_reason';
41
    const REASON_GUI_SUBMIT = 'crawler_gui_submit_reason';
42
    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
    public function __construct($row = [])
53
    {
54
        $this->row = $row;
55
    }
56
57
    /**
58
     * Set uid
59
     *
60
     * @param int uid
61
     * @return void
62
     */
63
    public function setUid($uid)
64
    {
65
        $this->row['uid'] = $uid;
66
    }
67
68
    /**
69
     * Method to set a timestamp for the creation time of this record
70
     *
71
     * @param int $time
72
     */
73
    public function setCreationDate($time)
74
    {
75
        $this->row['crdate'] = $time;
76
    }
77
78
    /**
79
     * This method can be used to set a user id of the user who has created this reason entry
80
     *
81
     * @param int $user_id
82
     */
83
    public function setBackendUserId($user_id)
84
    {
85
        $this->row['cruser_id'] = $user_id;
86
    }
87
88
    /**
89
     * Method to set the type of the reason for this reason instance (see constances)
90
     *
91
     * @param string $string
92
     */
93
    public function setReason($string)
94
    {
95
        $this->row['reason'] = $string;
96
    }
97
98
    /**
99
     * This method returns the attached reason text.
100
     *
101
     * @return string
102
     */
103
    public function getReason()
104
    {
105
        return $this->row['reason'];
106
    }
107
108
    /**
109
     * This method can be used to assign a detail text to the crawler reason
110
     *
111
     * @param string $detail_text
112
     */
113
    public function setDetailText($detail_text)
114
    {
115
        $this->row['detail_text'] = $detail_text;
116
    }
117
118
    /**
119
     * Returns the attachet detail text.
120
     *
121
     * @return string
122
     */
123
    public function getDetailText()
124
    {
125
        return $this->row['detail_text'];
126
    }
127
128
    /**
129
     * This method is used to set the uid of the queue entry
130
     * where the reason is relevant for.
131
     *
132
     * @param int $entry_uid
133
     */
134
    public function setQueueEntryUid($entry_uid)
135
    {
136
        $this->row['queue_entry_uid'] = $entry_uid;
137
    }
138
139
    /**
140
     * Returns the properties of the object as array
141
     *
142
     * @return array
143
     */
144
    public function getRow()
145
    {
146
        return $this->row;
147
    }
148
}
149