Total Complexity | 41 |
Total Lines | 273 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
Complex classes like PageOuvrageDTO often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use PageOuvrageDTO, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
16 | class PageOuvrageDTO extends CrudModel |
||
17 | { |
||
18 | use DtoConvertDateTrait; |
||
19 | |||
20 | const COLUMN_ID = 'id'; |
||
21 | const COLUMN_PAGE = 'page'; |
||
22 | |||
23 | /** @var int */ |
||
24 | protected $id; |
||
25 | /** @var string */ |
||
26 | protected $page; |
||
27 | /** @var string|null */ |
||
28 | protected $raw; |
||
29 | /** @var string|null */ |
||
30 | protected $opti; |
||
31 | /** @var string|null */ |
||
32 | protected $opticorrected; |
||
33 | /** @var string|null */ |
||
34 | protected $optidate; |
||
35 | /** @var @var bool|null */ |
||
|
|||
36 | protected $skip; |
||
37 | /** @var string|null */ |
||
38 | protected $modifs; |
||
39 | /** @var string|null */ |
||
40 | protected $version; |
||
41 | /** @var @var int|null */ |
||
42 | protected $notcosmetic; |
||
43 | /** @var @var int|null */ |
||
44 | protected $major; |
||
45 | /** @var string|null */ |
||
46 | protected $isbn; |
||
47 | /** @var string|null */ |
||
48 | protected $edited; |
||
49 | /** @var @var int|null */ |
||
50 | protected $priority; |
||
51 | /** @var string|null */ |
||
52 | protected $corrected; |
||
53 | /** @var @var int|null */ |
||
54 | protected $torevert; |
||
55 | /** @var string|null */ |
||
56 | protected $reverted; |
||
57 | /** @var string|null */ |
||
58 | protected $row; |
||
59 | /** @var string|null */ |
||
60 | protected $verify; |
||
61 | /** @var @var int|null */ |
||
62 | protected $altered; |
||
63 | /** @var @var int|null */ |
||
64 | protected $label; |
||
65 | |||
66 | public function getId(): int |
||
67 | { |
||
68 | return $this->id; |
||
69 | } |
||
70 | |||
71 | public function getPage(): string |
||
72 | { |
||
73 | return $this->page; |
||
74 | } |
||
75 | |||
76 | public function setPage(string $page): PageOuvrageDTO |
||
77 | { |
||
78 | $this->page = $page; |
||
79 | return $this; |
||
80 | } |
||
81 | |||
82 | public function getRaw(): ?string |
||
83 | { |
||
84 | return $this->raw; |
||
85 | } |
||
86 | |||
87 | public function setRaw(?string $raw): PageOuvrageDTO |
||
88 | { |
||
89 | $this->raw = $raw; |
||
90 | return $this; |
||
91 | } |
||
92 | |||
93 | public function getOpti(): ?string |
||
94 | { |
||
95 | return $this->opti; |
||
96 | } |
||
97 | |||
98 | public function setOpti(?string $opti): PageOuvrageDTO |
||
99 | { |
||
100 | $this->opti = $opti; |
||
101 | return $this; |
||
102 | } |
||
103 | |||
104 | public function getOpticorrected(): ?string |
||
105 | { |
||
106 | return $this->opticorrected; |
||
107 | } |
||
108 | |||
109 | public function setOpticorrected(?string $opticorrected): PageOuvrageDTO |
||
110 | { |
||
111 | $this->opticorrected = $opticorrected; |
||
112 | return $this; |
||
113 | } |
||
114 | |||
115 | public function getOptidate(): ?string |
||
116 | { |
||
117 | return $this->optidate; |
||
118 | } |
||
119 | |||
120 | public function setOptidate(?string $optidate): PageOuvrageDTO |
||
121 | { |
||
122 | $this->optidate = $optidate; |
||
123 | return $this; |
||
124 | } |
||
125 | |||
126 | public function getSkip() |
||
127 | { |
||
128 | return $this->skip; |
||
129 | } |
||
130 | |||
131 | public function setSkip($skip) |
||
132 | { |
||
133 | $this->skip = $skip; |
||
134 | return $this; |
||
135 | } |
||
136 | |||
137 | public function getModifs(): ?string |
||
138 | { |
||
139 | return $this->modifs; |
||
140 | } |
||
141 | |||
142 | public function setModifs(?string $modifs): PageOuvrageDTO |
||
143 | { |
||
144 | $this->modifs = $modifs; |
||
145 | return $this; |
||
146 | } |
||
147 | |||
148 | public function getVersion(): ?string |
||
149 | { |
||
150 | return $this->version; |
||
151 | } |
||
152 | |||
153 | public function setVersion(?string $version): PageOuvrageDTO |
||
154 | { |
||
155 | $this->version = $version; |
||
156 | return $this; |
||
157 | } |
||
158 | |||
159 | public function getNotcosmetic() |
||
160 | { |
||
161 | return $this->notcosmetic; |
||
162 | } |
||
163 | |||
164 | public function setNotcosmetic($notcosmetic) |
||
165 | { |
||
166 | $this->notcosmetic = $notcosmetic; |
||
167 | return $this; |
||
168 | } |
||
169 | |||
170 | public function getMajor() |
||
171 | { |
||
172 | return $this->major; |
||
173 | } |
||
174 | |||
175 | public function setMajor($major) |
||
179 | } |
||
180 | |||
181 | public function getIsbn(): ?string |
||
182 | { |
||
183 | return $this->isbn; |
||
184 | } |
||
185 | |||
186 | public function setIsbn(?string $isbn): PageOuvrageDTO |
||
187 | { |
||
188 | $this->isbn = $isbn; |
||
189 | return $this; |
||
190 | } |
||
191 | |||
192 | public function getEdited(): ?string |
||
193 | { |
||
194 | return $this->edited; |
||
195 | } |
||
196 | |||
197 | public function setEdited(?string $edited): PageOuvrageDTO |
||
198 | { |
||
199 | $this->edited = $edited; |
||
200 | return $this; |
||
201 | } |
||
202 | |||
203 | public function getPriority() |
||
204 | { |
||
205 | return $this->priority; |
||
206 | } |
||
207 | |||
208 | public function setPriority($priority) |
||
212 | } |
||
213 | |||
214 | public function getCorrected(): ?string |
||
215 | { |
||
217 | } |
||
218 | |||
219 | public function setCorrected(?string $corrected): PageOuvrageDTO |
||
220 | { |
||
221 | $this->corrected = $corrected; |
||
222 | return $this; |
||
223 | } |
||
224 | |||
225 | public function getTorevert() |
||
226 | { |
||
227 | return $this->torevert; |
||
228 | } |
||
229 | |||
230 | public function setTorevert($torevert) |
||
231 | { |
||
232 | $this->torevert = $torevert; |
||
233 | return $this; |
||
234 | } |
||
235 | |||
236 | public function getReverted(): ?string |
||
237 | { |
||
238 | return $this->reverted; |
||
239 | } |
||
240 | |||
241 | public function setReverted(?string $reverted): PageOuvrageDTO |
||
242 | { |
||
243 | $this->reverted = $reverted; |
||
244 | return $this; |
||
245 | } |
||
246 | |||
247 | public function getRow(): ?string |
||
250 | } |
||
251 | |||
252 | public function setRow(?string $row): PageOuvrageDTO |
||
253 | { |
||
254 | $this->row = $row; |
||
255 | return $this; |
||
256 | } |
||
257 | |||
258 | public function getVerify(): ?string |
||
259 | { |
||
260 | return $this->verify; |
||
261 | } |
||
262 | |||
263 | public function setVerify(?string $verify): PageOuvrageDTO |
||
264 | { |
||
265 | $this->verify = $verify; |
||
266 | return $this; |
||
267 | } |
||
268 | |||
269 | public function getAltered() |
||
270 | { |
||
271 | return $this->altered; |
||
272 | } |
||
273 | |||
274 | public function setAltered($altered) |
||
275 | { |
||
276 | $this->altered = $altered; |
||
277 | return $this; |
||
278 | } |
||
279 | |||
280 | public function getLabel() |
||
283 | } |
||
284 | |||
285 | public function setLabel($label) |
||
286 | { |
||
287 | $this->label = $label; |
||
288 | return $this; |
||
289 | } |
||
290 | } |