Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like absences_Right 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. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
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 absences_Right, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 88 | class absences_Right extends absences_Record implements absences_RightSort |
||
| 89 | { |
||
| 90 | /** |
||
| 91 | * Genre du droit default |
||
| 92 | * @var int |
||
| 93 | */ |
||
| 94 | const REGULAR = 1; |
||
| 95 | |||
| 96 | /** |
||
| 97 | * Genre du droit a date fixe |
||
| 98 | * @var int |
||
| 99 | */ |
||
| 100 | const FIXED = 2; |
||
| 101 | |||
| 102 | /** |
||
| 103 | * Genre du droit compte epargne temps |
||
| 104 | * @var int |
||
| 105 | */ |
||
| 106 | const CET = 4; |
||
| 107 | |||
| 108 | /** |
||
| 109 | * Ajout periodique de solde sur le droit |
||
| 110 | * @var int |
||
| 111 | */ |
||
| 112 | const INCREMENT = 8; |
||
| 113 | |||
| 114 | |||
| 115 | /** |
||
| 116 | * Droit a recuperation (cree apres une approbation de declaration de jours travailles donnant droit a recuperation) |
||
| 117 | * @var int |
||
| 118 | */ |
||
| 119 | const RECOVERY = 16; |
||
| 120 | |||
| 121 | /** |
||
| 122 | * Droit de report (cree automatiquement) |
||
| 123 | * @var int |
||
| 124 | */ |
||
| 125 | const REPORT = 32; |
||
| 126 | |||
| 127 | |||
| 128 | |||
| 129 | |||
| 130 | |||
| 131 | const SYNC_CLIENT = 1; |
||
| 132 | const SYNC_CLIENT_END = 2; |
||
| 133 | const SYNC_CLIENT_ERROR = 3; |
||
| 134 | |||
| 135 | const SYNC_SERVER = 8; |
||
| 136 | |||
| 137 | |||
| 138 | |||
| 139 | |||
| 140 | /** |
||
| 141 | * |
||
| 142 | * @var absences_Type |
||
| 143 | */ |
||
| 144 | private $type; |
||
| 145 | |||
| 146 | |||
| 147 | /** |
||
| 148 | * @var absences_Rgroup |
||
| 149 | */ |
||
| 150 | private $rgroup; |
||
| 151 | |||
| 152 | |||
| 153 | /** |
||
| 154 | * |
||
| 155 | * @var absences_RightRule |
||
| 156 | */ |
||
| 157 | private $right_rule; |
||
| 158 | |||
| 159 | /** |
||
| 160 | * |
||
| 161 | * @var absences_RightCet |
||
| 162 | */ |
||
| 163 | private $right_cet; |
||
| 164 | |||
| 165 | |||
| 166 | /** |
||
| 167 | * List of unsaved inperiod rules |
||
| 168 | * @var array |
||
| 169 | */ |
||
| 170 | private $inperiod = array(); |
||
| 171 | |||
| 172 | /** |
||
| 173 | * |
||
| 174 | * @var absences_Right |
||
| 175 | */ |
||
| 176 | private $reported_from; |
||
| 177 | |||
| 178 | /** |
||
| 179 | * |
||
| 180 | * @var absences_Right |
||
| 181 | */ |
||
| 182 | private $report; |
||
| 183 | |||
| 184 | |||
| 185 | /** |
||
| 186 | * |
||
| 187 | * @var string |
||
| 188 | */ |
||
| 189 | private $_uuid; |
||
| 190 | |||
| 191 | |||
| 192 | 84 | public function __construct($id) |
|
| 193 | { |
||
| 194 | 84 | $this->id = $id; |
|
| 195 | 84 | } |
|
| 196 | |||
| 197 | |||
| 198 | /** |
||
| 199 | * |
||
| 200 | * @param string $uuid |
||
| 201 | * @return absences_Right |
||
| 202 | */ |
||
| 203 | public static function getByUuid($uuid) |
||
| 204 | { |
||
| 205 | $right = new absences_Right(null); |
||
| 206 | $right->_uuid = $uuid; |
||
| 207 | |||
| 208 | return $right; |
||
| 209 | } |
||
| 210 | |||
| 211 | /** |
||
| 212 | * Table row as an array |
||
| 213 | * @return array |
||
| 214 | */ |
||
| 215 | 72 | public function getRow() |
|
| 216 | { |
||
| 217 | 72 | if (null === $this->row) |
|
| 218 | 72 | { |
|
| 219 | 46 | global $babDB; |
|
| 220 | |||
| 221 | $query = ' |
||
| 222 | SELECT |
||
| 223 | r.* |
||
| 224 | FROM absences_rights r |
||
| 225 | 46 | WHERE '; |
|
| 226 | |||
| 227 | 46 | if (isset($this->id)) |
|
| 228 | 46 | { |
|
| 229 | 46 | $query .= 'r.id='.$babDB->quote($this->id); |
|
| 230 | 46 | } elseif (isset($this->_uuid)) |
|
| 231 | { |
||
| 232 | $query .= 'r.uuid='.$babDB->quote($this->_uuid); |
||
| 233 | } else { |
||
| 234 | 9 | return false; |
|
| 235 | } |
||
| 236 | |||
| 237 | 46 | $res = $babDB->db_query($query); |
|
| 238 | |||
| 239 | 46 | $this->setRow($babDB->db_fetch_assoc($res)); |
|
| 240 | 46 | } |
|
| 241 | |||
| 242 | 72 | return $this->row; |
|
| 243 | } |
||
| 244 | |||
| 245 | |||
| 246 | /** |
||
| 247 | * La nature du droit |
||
| 248 | * @return int |
||
| 249 | */ |
||
| 250 | 14 | public function getKind() |
|
| 251 | { |
||
| 252 | 14 | return (int) $this->kind; |
|
| 253 | } |
||
| 254 | |||
| 255 | /** |
||
| 256 | * @return string |
||
| 257 | */ |
||
| 258 | 9 | public function getKindLabel() |
|
| 259 | 9 | { |
|
| 260 | $arr = absences_kinds(); |
||
| 261 | $kind = $this->getKind(); |
||
| 262 | |||
| 263 | if (!isset($arr[$kind])) { |
||
| 264 | return ''; |
||
| 265 | } |
||
| 266 | |||
| 267 | return $arr[$kind]; |
||
| 268 | 9 | } |
|
| 269 | |||
| 270 | /** |
||
| 271 | * @return int |
||
| 272 | */ |
||
| 273 | 9 | public function getSyncStatus() |
|
| 274 | 9 | { |
|
| 275 | return (int) $this->sync_status; |
||
| 276 | } |
||
| 277 | |||
| 278 | /** |
||
| 279 | * @return string |
||
| 280 | */ |
||
| 281 | public function getSyncStatusLabel() |
||
| 282 | { |
||
| 283 | $arr = absences_syncStatus(); |
||
| 284 | return $arr[$this->getSyncStatus()]; |
||
| 285 | } |
||
| 286 | |||
| 287 | |||
| 288 | /** |
||
| 289 | * |
||
| 290 | * @param absences_Type $type |
||
| 291 | * @return absences_Right |
||
| 292 | */ |
||
| 293 | 9 | public function setType(absences_Type $type) |
|
| 294 | { |
||
| 295 | $this->type = $type; |
||
| 296 | return $this; |
||
| 297 | } |
||
| 298 | |||
| 299 | |||
| 300 | /** |
||
| 301 | * @return absences_Type |
||
| 302 | */ |
||
| 303 | 10 | public function getType() |
|
| 304 | { |
||
| 305 | 1 | if (!isset($this->type)) |
|
| 306 | 1 | { |
|
| 307 | 10 | $row = $this->getRow(); |
|
| 308 | 1 | $this->type = new absences_Type($row['id_type']); |
|
| 309 | 10 | } |
|
| 310 | |||
| 311 | 1 | return $this->type; |
|
| 312 | } |
||
| 313 | |||
| 314 | |||
| 315 | |||
| 316 | /** |
||
| 317 | * |
||
| 318 | * @param absences_Rgroup $rgroup |
||
| 319 | * @return absences_Right |
||
| 320 | */ |
||
| 321 | public function setRgroup(absences_Rgroup $rgroup) |
||
| 322 | { |
||
| 323 | $this->rgroup = $rgroup; |
||
| 324 | return $this; |
||
| 325 | } |
||
| 326 | |||
| 327 | |||
| 328 | /** |
||
| 329 | * @return absences_Rgroup |
||
| 330 | */ |
||
| 331 | 9 | View Code Duplication | public function getRgroup() |
|
|
|||
| 332 | { |
||
| 333 | if (!isset($this->rgroup)) |
||
| 334 | { |
||
| 335 | $row = $this->getRow(); |
||
| 336 | if (empty($row['id_rgroup'])) |
||
| 337 | { |
||
| 338 | return null; |
||
| 339 | } |
||
| 340 | $this->rgroup = new absences_Rgroup($row['id_rgroup']); |
||
| 341 | } |
||
| 342 | |||
| 343 | 9 | return $this->rgroup; |
|
| 344 | 9 | } |
|
| 345 | |||
| 346 | /** |
||
| 347 | * |
||
| 348 | * @return string |
||
| 349 | */ |
||
| 350 | 9 | View Code Duplication | public function getRgroupLabel() |
| 351 | { |
||
| 352 | $rgroup = $this->getRgroup(); |
||
| 353 | |||
| 354 | if (null === $rgroup || !$rgroup->getRow()) |
||
| 355 | { |
||
| 356 | return null; |
||
| 357 | } |
||
| 358 | |||
| 359 | return $rgroup->name; |
||
| 360 | } |
||
| 361 | |||
| 362 | |||
| 363 | |||
| 364 | /** |
||
| 365 | * |
||
| 366 | * @return int |
||
| 367 | */ |
||
| 368 | View Code Duplication | public function getRgroupSortkey() |
|
| 369 | { |
||
| 370 | $rgroup = $this->getRgroup(); |
||
| 371 | |||
| 372 | if (null === $rgroup || !$rgroup->getRow()) |
||
| 373 | { |
||
| 374 | return null; |
||
| 375 | } |
||
| 376 | |||
| 377 | return $rgroup->sortkey; |
||
| 378 | } |
||
| 379 | |||
| 380 | |||
| 381 | /** |
||
| 382 | * @return string |
||
| 383 | */ |
||
| 384 | View Code Duplication | public function getUnitLabel() |
|
| 385 | { |
||
| 386 | switch($this->quantity_unit) |
||
| 387 | { |
||
| 388 | case 'D': |
||
| 389 | return absences_translate('day(s)'); |
||
| 390 | |||
| 391 | case 'H': |
||
| 392 | return absences_translate('hour(s)'); |
||
| 393 | } |
||
| 394 | |||
| 395 | return ''; |
||
| 396 | } |
||
| 397 | |||
| 398 | /** |
||
| 399 | * Start date year |
||
| 400 | * @return int |
||
| 401 | */ |
||
| 402 | View Code Duplication | public function getYear() |
|
| 403 | { |
||
| 404 | $year = (int) substr($this->date_begin, 0, 4); |
||
| 405 | |||
| 406 | if (0 === $year) |
||
| 407 | { |
||
| 408 | return null; |
||
| 409 | } |
||
| 410 | |||
| 411 | return $year; |
||
| 412 | } |
||
| 413 | |||
| 414 | |||
| 415 | /** |
||
| 416 | * |
||
| 417 | * @param absences_RightRule $RightRule |
||
| 418 | */ |
||
| 419 | public function setRightRule(absences_RightRule $RightRule) |
||
| 420 | { |
||
| 421 | $this->rightrule = $RightRule; |
||
| 422 | return $this; |
||
| 423 | } |
||
| 424 | |||
| 425 | /** |
||
| 426 | * @return absences_RightRule |
||
| 427 | */ |
||
| 428 | 10 | View Code Duplication | public function getRightRule() |
| 429 | { |
||
| 430 | 10 | if (!isset($this->right_rule)) |
|
| 431 | 10 | { |
|
| 432 | 10 | require_once dirname(__FILE__).'/right_rule.class.php'; |
|
| 433 | 10 | $this->right_rule = absences_RightRule::getFromRight($this->id); |
|
| 434 | 10 | } |
|
| 435 | 10 | return $this->right_rule; |
|
| 436 | } |
||
| 437 | |||
| 438 | |||
| 439 | |||
| 440 | |||
| 441 | /** |
||
| 442 | * |
||
| 443 | * @param absences_RightCet $RightCet |
||
| 444 | */ |
||
| 445 | public function setRightCet(absences_RightCet $RightCet) |
||
| 446 | { |
||
| 447 | $this->right_cet = $RightCet; |
||
| 448 | return $this; |
||
| 449 | } |
||
| 450 | |||
| 451 | /** |
||
| 452 | * @return absences_RightCet |
||
| 453 | */ |
||
| 454 | View Code Duplication | public function getRightCet() |
|
| 455 | { |
||
| 456 | if (!isset($this->right_cet)) |
||
| 457 | { |
||
| 458 | require_once dirname(__FILE__).'/right_cet.class.php'; |
||
| 459 | $this->right_cet = absences_RightCet::getFromRight($this->id); |
||
| 460 | } |
||
| 461 | return $this->right_cet; |
||
| 462 | } |
||
| 463 | |||
| 464 | |||
| 465 | |||
| 466 | /** |
||
| 467 | * |
||
| 468 | * @param absences_RightInPeriod $inperiod |
||
| 469 | */ |
||
| 470 | public function addInPeriod(absences_RightInPeriod $inperiod) |
||
| 471 | { |
||
| 472 | $this->inperiod[] = $inperiod; |
||
| 473 | $inperiod->setRight($this); |
||
| 474 | return $this; |
||
| 475 | } |
||
| 476 | |||
| 477 | |||
| 478 | /** |
||
| 479 | * @return multitype:absences_RightInPeriod |
||
| 480 | */ |
||
| 481 | public function getInperiodRules() |
||
| 482 | { |
||
| 483 | return $this->inperiod; |
||
| 484 | } |
||
| 485 | |||
| 486 | |||
| 487 | /** |
||
| 488 | * Get the source right of report or false if the right is not a report |
||
| 489 | * @return absences_Right | false |
||
| 490 | */ |
||
| 491 | public function getReportedFrom() |
||
| 492 | { |
||
| 493 | if (!isset($this->reported_from)) |
||
| 494 | { |
||
| 495 | if (self::REPORT !== $this->getKind() || empty($this->id_reported_from)) |
||
| 496 | { |
||
| 497 | $this->reported_from = false; |
||
| 498 | } else { |
||
| 499 | |||
| 500 | $this->reported_from = new absences_Right($this->id_reported_from); |
||
| 501 | } |
||
| 502 | } |
||
| 503 | |||
| 504 | return $this->reported_from; |
||
| 505 | } |
||
| 506 | |||
| 507 | |||
| 508 | /** |
||
| 509 | * Get the report right if exists |
||
| 510 | * @return absences_Right | false |
||
| 511 | */ |
||
| 512 | public function getReport() |
||
| 513 | { |
||
| 514 | if (!isset($this->report)) |
||
| 515 | { |
||
| 516 | global $babDB; |
||
| 517 | |||
| 518 | $res = $babDB->db_query('SELECT * FROM absences_rights WHERE id_reported_from='.$babDB->quote($this->id)); |
||
| 519 | if (0 === $babDB->db_num_rows($res)) |
||
| 520 | { |
||
| 521 | $this->report = false; |
||
| 522 | } else { |
||
| 523 | |||
| 524 | $row = $babDB->db_fetch_assoc($res); |
||
| 525 | $right = new absences_Right($row['id']); |
||
| 526 | $right->setRow($row); |
||
| 527 | |||
| 528 | $this->report = $right; |
||
| 529 | } |
||
| 530 | } |
||
| 531 | |||
| 532 | return $this->report; |
||
| 533 | } |
||
| 534 | |||
| 535 | |||
| 536 | /** |
||
| 537 | * Get the report right or create it if not exists |
||
| 538 | * @return absences_Right | null |
||
| 539 | */ |
||
| 540 | public function getOrCreateReport() |
||
| 600 | |||
| 601 | |||
| 602 | |||
| 603 | /** |
||
| 604 | * Tester si le droit est disponible dans le mois en cours (en fonction de la periode de conges demandee) |
||
| 605 | * si cette methode renvoi true, il n'y a pas de fin de validite dans le mois en cours sauf si validoperlap est actif |
||
| 606 | * |
||
| 607 | * si on ce base sur cette methode pour determiner si un droit doit etre incremente dans le mois |
||
| 608 | * - le droit sera incremente si pas de fin de validite dans le mois |
||
| 609 | * - le droit sera incremente si le chevauchement est active et que la fin de validite est dans le mois |
||
| 610 | * |
||
| 611 | * |
||
| 612 | * @return bool |
||
| 613 | */ |
||
| 614 | 10 | View Code Duplication | public function isAccessibleOnMonth() |
| 615 | { |
||
| 616 | 10 | require_once $GLOBALS['babInstallPath'].'utilit/dateTime.php'; |
|
| 617 | 10 | $begin = new BAB_DateTime(date('Y'), date('n'), 1); |
|
| 618 | 10 | $end = new BAB_DateTime(date('Y'), date('n'), date('t'), 23, 59, 59); |
|
| 619 | |||
| 620 | 10 | $rightRule = $this->getRightRule(); |
|
| 621 | |||
| 624 | |||
| 625 | |||
| 626 | |||
| 627 | 9 | View Code Duplication | protected function saveQuantityIncMonth($quantity) |
| 639 | |||
| 640 | |||
| 641 | |||
| 642 | |||
| 643 | /** |
||
| 644 | * Increment quantity for the month if not allready done |
||
| 645 | * return true if quantity has been modified |
||
| 646 | * |
||
| 647 | * @param LibTimer_eventHourly $event optional event if the action is done via a background task |
||
| 648 | * |
||
| 649 | * @return bool |
||
| 650 | */ |
||
| 651 | 14 | public function monthlyQuantityUpdate(LibTimer_eventHourly $event = null) |
|
| 729 | |||
| 730 | |||
| 731 | |||
| 732 | |||
| 733 | /** |
||
| 734 | * Tester si le droit est accessible en fonction de la periode de validite du droit |
||
| 735 | * @see absences_AgentRight::isAccessibleByValidityPeriod() |
||
| 736 | * @return bool |
||
| 737 | */ |
||
| 738 | public function isAccessibleByValidityPeriod() |
||
| 752 | |||
| 753 | /** |
||
| 754 | * Test if the vacation right is visible to the end user by testing properties of fixed vacation right |
||
| 755 | * if the right is not a fixed vacation right, this method return true |
||
| 756 | * |
||
| 757 | * @return bool |
||
| 758 | */ |
||
| 759 | public function isAccessibleIfFixed() |
||
| 773 | |||
| 774 | |||
| 775 | /** |
||
| 776 | * If the right is displayed as available in the manager list |
||
| 777 | * Test if the right is accessible for the user to display information in exported file |
||
| 778 | * pour l'export de l'agent et pour l'export des droits |
||
| 779 | * |
||
| 780 | * @return bool |
||
| 781 | */ |
||
| 782 | public function isAvailable() |
||
| 786 | |||
| 787 | |||
| 788 | public function getStatus() |
||
| 806 | |||
| 807 | |||
| 808 | /** |
||
| 809 | * Get a period description in text |
||
| 810 | * @param string $begin |
||
| 811 | * @param string $end |
||
| 812 | */ |
||
| 813 | private function periodText($begin, $end) |
||
| 833 | |||
| 834 | |||
| 835 | /** |
||
| 836 | * |
||
| 837 | * @param string $name |
||
| 838 | * @return string |
||
| 839 | */ |
||
| 840 | private function getDirFieldLabel($name) |
||
| 845 | |||
| 846 | |||
| 847 | |||
| 848 | |||
| 849 | /** |
||
| 850 | * Get access conditions as a string |
||
| 851 | * of null if there are no access conditions |
||
| 852 | * @return string |
||
| 853 | */ |
||
| 854 | public function getAccessConditions() |
||
| 988 | |||
| 989 | |||
| 990 | |||
| 991 | |||
| 992 | /** |
||
| 993 | * Agents associated to vacation right |
||
| 994 | * @return absences_AgentIterator |
||
| 995 | */ |
||
| 996 | public function getAgentIterator() |
||
| 1004 | |||
| 1005 | /** |
||
| 1006 | * Collections associated to vacation right |
||
| 1007 | * @return absences_CollectionIterator |
||
| 1008 | */ |
||
| 1009 | public function getCollectionIterator() |
||
| 1017 | |||
| 1018 | |||
| 1019 | /** |
||
| 1020 | * @return absences_AgentRightStatIterator |
||
| 1021 | */ |
||
| 1022 | 10 | public function getAgentRightIterator() |
|
| 1030 | |||
| 1031 | |||
| 1032 | /** |
||
| 1033 | * determiner le nombre de d'agent avec ce droit non solde |
||
| 1034 | * @return int |
||
| 1035 | */ |
||
| 1036 | public function getAgentUsage() |
||
| 1078 | |||
| 1079 | |||
| 1080 | |||
| 1081 | |||
| 1082 | |||
| 1083 | /** |
||
| 1084 | * |
||
| 1085 | * @param string $message Generated message |
||
| 1086 | * @param string $comment Author comment |
||
| 1087 | */ |
||
| 1088 | 9 | View Code Duplication | public function addMovement($message, $comment = '', $id_author = null) |
| 1104 | |||
| 1105 | |||
| 1106 | |||
| 1107 | /** |
||
| 1108 | * Tester si tout les beneficiaires du droit on consome tout le solde |
||
| 1109 | * @return bool |
||
| 1110 | */ |
||
| 1111 | public function isResulted() |
||
| 1133 | |||
| 1134 | |||
| 1135 | |||
| 1136 | |||
| 1137 | /** |
||
| 1138 | * Archiver le droit |
||
| 1139 | */ |
||
| 1140 | public function archive() |
||
| 1146 | |||
| 1147 | |||
| 1148 | /** |
||
| 1149 | * Method used with bab_Sort |
||
| 1150 | */ |
||
| 1151 | public function getSortKey() |
||
| 1155 | |||
| 1156 | public function setSortKey($i) |
||
| 1161 | |||
| 1162 | public function getSortLabel() |
||
| 1166 | |||
| 1167 | |||
| 1168 | public function getIconClassName() |
||
| 1173 | |||
| 1174 | |||
| 1175 | |||
| 1176 | |||
| 1177 | /** |
||
| 1178 | * Insert new right |
||
| 1179 | */ |
||
| 1180 | 8 | public function insert() |
|
| 1262 | |||
| 1263 | |||
| 1264 | /** |
||
| 1265 | * Update by UUID |
||
| 1266 | */ |
||
| 1267 | public function update() |
||
| 1307 | |||
| 1308 | |||
| 1309 | /** |
||
| 1310 | * |
||
| 1311 | * @return string |
||
| 1312 | */ |
||
| 1313 | public function getQuantityAlertTypes() |
||
| 1334 | |||
| 1335 | |||
| 1336 | /** |
||
| 1337 | * @return absences_IncrementRight[] |
||
| 1338 | */ |
||
| 1339 | 42 | public function getIncrementIterator() |
|
| 1346 | |||
| 1347 | |||
| 1348 | /** |
||
| 1349 | * Quantitee attribuee sur le droit par la mise a jour mensuelle |
||
| 1350 | * a condition qu'il n'y ai pas de quantite specifique pour l'agent |
||
| 1351 | * @param string $date YYYY-MM-DD |
||
| 1352 | * @return float |
||
| 1353 | */ |
||
| 1354 | 23 | View Code Duplication | public function getIncrementQuantity($date = null) |
| 1367 | |||
| 1368 | |||
| 1369 | |||
| 1370 | public function getDynamicConfigurationIterator() |
||
| 1379 | |||
| 1380 | /** |
||
| 1381 | * @return array |
||
| 1382 | */ |
||
| 1383 | public function getDynamicTypes() |
||
| 1398 | |||
| 1399 | |||
| 1400 | /** |
||
| 1401 | * Quantite a ajouter pour le mois |
||
| 1402 | * tiens compte de la quantite max |
||
| 1403 | * |
||
| 1404 | * @param float $current_quantity Can be the right quantity or the user right quantity |
||
| 1405 | * |
||
| 1406 | * @return float |
||
| 1407 | */ |
||
| 1408 | 10 | public function getQuantityIncMonth($current_quantity) |
|
| 1430 | |||
| 1431 | |||
| 1432 | /** |
||
| 1433 | * Movements related to the right |
||
| 1434 | * @return absences_MovementIterator |
||
| 1435 | */ |
||
| 1436 | public function getMovementIterator() |
||
| 1445 | |||
| 1446 | |||
| 1447 | } |
||
| 1448 | |||
| 1559 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.