| Total Complexity | 45 | 
| Total Lines | 283 | 
| 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  | 
            ||
| 18 | class PageOuvrageDTO extends CrudModel  | 
            ||
| 19 | { | 
            ||
| 20 | use DtoConvertDateTrait;  | 
            ||
| 21 | |||
| 22 | const COLUMN_ID = 'id';  | 
            ||
| 23 | const COLUMN_PAGE = 'page';  | 
            ||
| 24 | |||
| 25 | /** @var int */  | 
            ||
| 26 | protected $id;  | 
            ||
| 27 | /** @var string */  | 
            ||
| 28 | protected $page;  | 
            ||
| 29 | /** @var string|null */  | 
            ||
| 30 | protected $raw;  | 
            ||
| 31 | /** @var string|null */  | 
            ||
| 32 | protected $opti;  | 
            ||
| 33 | /** @var string|null */  | 
            ||
| 34 | protected $opticorrected;  | 
            ||
| 35 | /** @var string|null */  | 
            ||
| 36 | protected $optidate;  | 
            ||
| 37 | /** @var @var bool|null */  | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 38 | protected $skip;  | 
            ||
| 39 | /** @var string|null */  | 
            ||
| 40 | protected $modifs;  | 
            ||
| 41 | /** @var string|null */  | 
            ||
| 42 | protected $version;  | 
            ||
| 43 | /** @var @var int|null */  | 
            ||
| 44 | protected $notcosmetic;  | 
            ||
| 45 | /** @var @var int|null */  | 
            ||
| 46 | protected $major;  | 
            ||
| 47 | /** @var string|null */  | 
            ||
| 48 | protected $isbn;  | 
            ||
| 49 | /** @var string|null */  | 
            ||
| 50 | protected $edited;  | 
            ||
| 51 | /** @var @var int|null */  | 
            ||
| 52 | protected $priority;  | 
            ||
| 53 | /** @var string|null */  | 
            ||
| 54 | protected $corrected;  | 
            ||
| 55 | /** @var @var int|null */  | 
            ||
| 56 | protected $torevert;  | 
            ||
| 57 | /** @var string|null */  | 
            ||
| 58 | protected $reverted;  | 
            ||
| 59 | /** @var string|null */  | 
            ||
| 60 | protected $row;  | 
            ||
| 61 | /** @var string|null */  | 
            ||
| 62 | protected $verify;  | 
            ||
| 63 | /** @var @var int|null */  | 
            ||
| 64 | protected $altered;  | 
            ||
| 65 | /** @var @var int|null */  | 
            ||
| 66 | protected $label;  | 
            ||
| 67 | |||
| 68 | public function getId(): ?int  | 
            ||
| 69 |     { | 
            ||
| 70 | return $this->id ? (int) $this->id : null;  | 
            ||
| 71 | }  | 
            ||
| 72 | |||
| 73 | public function getPage(): string  | 
            ||
| 74 |     { | 
            ||
| 75 | return $this->page;  | 
            ||
| 76 | }  | 
            ||
| 77 | |||
| 78 | public function setPage(string $page): PageOuvrageDTO  | 
            ||
| 79 |     { | 
            ||
| 80 | $this->page = $page;  | 
            ||
| 81 | return $this;  | 
            ||
| 82 | }  | 
            ||
| 83 | |||
| 84 | public function getRaw(): ?string  | 
            ||
| 85 |     { | 
            ||
| 86 | return $this->raw;  | 
            ||
| 87 | }  | 
            ||
| 88 | |||
| 89 | public function setRaw(?string $raw): PageOuvrageDTO  | 
            ||
| 90 |     { | 
            ||
| 91 | $this->raw = $raw;  | 
            ||
| 92 | return $this;  | 
            ||
| 93 | }  | 
            ||
| 94 | |||
| 95 | public function getOpti(): ?string  | 
            ||
| 96 |     { | 
            ||
| 97 | return $this->opti;  | 
            ||
| 98 | }  | 
            ||
| 99 | |||
| 100 | public function setOpti(?string $opti): PageOuvrageDTO  | 
            ||
| 101 |     { | 
            ||
| 102 | $this->opti = $opti;  | 
            ||
| 103 | return $this;  | 
            ||
| 104 | }  | 
            ||
| 105 | |||
| 106 | public function getOpticorrected(): ?string  | 
            ||
| 107 |     { | 
            ||
| 108 | return $this->opticorrected;  | 
            ||
| 109 | }  | 
            ||
| 110 | |||
| 111 | public function setOpticorrected(?string $opticorrected): PageOuvrageDTO  | 
            ||
| 112 |     { | 
            ||
| 113 | $this->opticorrected = $opticorrected;  | 
            ||
| 114 | return $this;  | 
            ||
| 115 | }  | 
            ||
| 116 | |||
| 117 | public function getOptidate(): ?string  | 
            ||
| 118 |     { | 
            ||
| 119 | return $this->optidate;  | 
            ||
| 120 | }  | 
            ||
| 121 | |||
| 122 | public function setOptidate($optidate): PageOuvrageDTO  | 
            ||
| 123 |     { | 
            ||
| 124 |         if ($optidate instanceof DateTimeInterface) { | 
            ||
| 125 | $this->optidate = self::dateTimeToSql($optidate);  | 
            ||
| 126 | |||
| 127 | return $this;  | 
            ||
| 128 | }  | 
            ||
| 129 |         if (null === $optidate || is_string($optidate)) { | 
            ||
| 130 | $this->optidate = $optidate;  | 
            ||
| 131 | |||
| 132 | return $this;  | 
            ||
| 133 | }  | 
            ||
| 134 | |||
| 135 |         throw new Exception('optidate bad format'); | 
            ||
| 136 | }  | 
            ||
| 137 | |||
| 138 | public function getSkip()  | 
            ||
| 139 |     { | 
            ||
| 140 | return $this->skip;  | 
            ||
| 141 | }  | 
            ||
| 142 | |||
| 143 | public function setSkip($skip): PageOuvrageDTO  | 
            ||
| 144 |     { | 
            ||
| 145 | $this->skip = $skip;  | 
            ||
| 146 | return $this;  | 
            ||
| 147 | }  | 
            ||
| 148 | |||
| 149 | public function getModifs(): ?string  | 
            ||
| 150 |     { | 
            ||
| 151 | return $this->modifs;  | 
            ||
| 152 | }  | 
            ||
| 153 | |||
| 154 | public function setModifs(?string $modifs): PageOuvrageDTO  | 
            ||
| 155 |     { | 
            ||
| 156 | $this->modifs = $modifs;  | 
            ||
| 157 | return $this;  | 
            ||
| 158 | }  | 
            ||
| 159 | |||
| 160 | public function getVersion(): ?string  | 
            ||
| 161 |     { | 
            ||
| 162 | return $this->version;  | 
            ||
| 163 | }  | 
            ||
| 164 | |||
| 165 | public function setVersion(?string $version): PageOuvrageDTO  | 
            ||
| 166 |     { | 
            ||
| 167 | $this->version = $version;  | 
            ||
| 168 | return $this;  | 
            ||
| 169 | }  | 
            ||
| 170 | |||
| 171 | public function getNotcosmetic()  | 
            ||
| 172 |     { | 
            ||
| 173 | return $this->notcosmetic;  | 
            ||
| 174 | }  | 
            ||
| 175 | |||
| 176 | public function setNotcosmetic($notcosmetic): PageOuvrageDTO  | 
            ||
| 177 |     { | 
            ||
| 178 | $this->notcosmetic = $notcosmetic;  | 
            ||
| 179 | return $this;  | 
            ||
| 180 | }  | 
            ||
| 181 | |||
| 182 | public function getMajor()  | 
            ||
| 183 |     { | 
            ||
| 184 | return $this->major;  | 
            ||
| 185 | }  | 
            ||
| 186 | |||
| 187 | public function setMajor($major): PageOuvrageDTO  | 
            ||
| 191 | }  | 
            ||
| 192 | |||
| 193 | public function getIsbn(): ?string  | 
            ||
| 194 |     { | 
            ||
| 195 | return $this->isbn;  | 
            ||
| 196 | }  | 
            ||
| 197 | |||
| 198 | public function setIsbn(?string $isbn): PageOuvrageDTO  | 
            ||
| 199 |     { | 
            ||
| 200 | $this->isbn = $isbn;  | 
            ||
| 201 | return $this;  | 
            ||
| 202 | }  | 
            ||
| 203 | |||
| 204 | public function getEdited(): ?string  | 
            ||
| 205 |     { | 
            ||
| 206 | return $this->edited;  | 
            ||
| 207 | }  | 
            ||
| 208 | |||
| 209 | public function setEdited(?string $edited): PageOuvrageDTO  | 
            ||
| 210 |     { | 
            ||
| 211 | $this->edited = $edited;  | 
            ||
| 212 | return $this;  | 
            ||
| 213 | }  | 
            ||
| 214 | |||
| 215 | public function getPriority()  | 
            ||
| 216 |     { | 
            ||
| 217 | return $this->priority;  | 
            ||
| 218 | }  | 
            ||
| 219 | |||
| 220 | public function setPriority($priority): PageOuvrageDTO  | 
            ||
| 224 | }  | 
            ||
| 225 | |||
| 226 | public function getCorrected(): ?string  | 
            ||
| 227 |     { | 
            ||
| 229 | }  | 
            ||
| 230 | |||
| 231 | public function setCorrected(?string $corrected): PageOuvrageDTO  | 
            ||
| 232 |     { | 
            ||
| 233 | $this->corrected = $corrected;  | 
            ||
| 234 | return $this;  | 
            ||
| 235 | }  | 
            ||
| 236 | |||
| 237 | public function getTorevert()  | 
            ||
| 238 |     { | 
            ||
| 239 | return $this->torevert;  | 
            ||
| 240 | }  | 
            ||
| 241 | |||
| 242 | public function setTorevert($torevert): PageOuvrageDTO  | 
            ||
| 243 |     { | 
            ||
| 244 | $this->torevert = $torevert;  | 
            ||
| 245 | return $this;  | 
            ||
| 246 | }  | 
            ||
| 247 | |||
| 248 | public function getReverted(): ?string  | 
            ||
| 249 |     { | 
            ||
| 250 | return $this->reverted;  | 
            ||
| 251 | }  | 
            ||
| 252 | |||
| 253 | public function setReverted(?string $reverted): PageOuvrageDTO  | 
            ||
| 254 |     { | 
            ||
| 255 | $this->reverted = $reverted;  | 
            ||
| 256 | return $this;  | 
            ||
| 257 | }  | 
            ||
| 258 | |||
| 259 | public function getRow(): ?string  | 
            ||
| 262 | }  | 
            ||
| 263 | |||
| 264 | public function setRow(?string $row): PageOuvrageDTO  | 
            ||
| 265 |     { | 
            ||
| 266 | $this->row = $row;  | 
            ||
| 267 | return $this;  | 
            ||
| 268 | }  | 
            ||
| 269 | |||
| 270 | public function getVerify(): ?string  | 
            ||
| 271 |     { | 
            ||
| 272 | return $this->verify;  | 
            ||
| 273 | }  | 
            ||
| 274 | |||
| 275 | public function setVerify(?string $verify): PageOuvrageDTO  | 
            ||
| 276 |     { | 
            ||
| 277 | $this->verify = $verify;  | 
            ||
| 278 | return $this;  | 
            ||
| 279 | }  | 
            ||
| 280 | |||
| 281 | public function getAltered()  | 
            ||
| 282 |     { | 
            ||
| 283 | return $this->altered;  | 
            ||
| 284 | }  | 
            ||
| 285 | |||
| 286 | public function setAltered($altered): PageOuvrageDTO  | 
            ||
| 287 |     { | 
            ||
| 288 | $this->altered = $altered;  | 
            ||
| 289 | return $this;  | 
            ||
| 290 | }  | 
            ||
| 291 | |||
| 292 | public function getLabel()  | 
            ||
| 295 | }  | 
            ||
| 296 | |||
| 297 | public function setLabel($label): PageOuvrageDTO  | 
            ||
| 298 |     { | 
            ||
| 299 | $this->label = $label;  | 
            ||
| 300 | return $this;  | 
            ||
| 301 | }  | 
            ||
| 302 | }  |