Code Duplication    Length = 14-14 lines in 2 locations

src/Intraface/modules/debtor/Debtor.php 1 location

@@ 621-634 (lines=14) @@
618
     */
619
    public function setStatus($status)
620
    {
621
        if (is_string($status)) {
622
            $status_id = array_search($status, $this->getStatusTypes());
623
            if ($status_id === false) {
624
                throw new Exception("Debtor->setStatus(): Ugyldig status (streng)");
625
            }
626
        } else {
627
            $status_id = intval($status);
628
            $status_types = $this->getStatusTypes();
629
            if (isset($status_types[$status_id])) {
630
                $status = $status_types[$status];
631
            } else {
632
                throw new Exception("Debtor->setStatus(): Ugyldig status (integer)");
633
            }
634
        }
635
636
        if ($status_id == $this->get("status_id")) {
637
            throw new Exception("Du kan ikke sætte status til samme som den er i forvejen");

src/Intraface/modules/invoice/Reminder.php 1 location

@@ 304-317 (lines=14) @@
301
    function setStatus($status)
302
    {
303
304
        if (is_string($status)) {
305
            $status_id = array_search($status, $this->getStatusTypes());
306
            if ($status_id === false) {
307
                throw new Exception("Reminder->setStatus(): Ugyldig status (streng)", FATAL);
308
            }
309
        } else {
310
            $status_id = intval($status);
311
            $status_types = $this->getStatusTypes();
312
            if (isset($status_types[$status_id])) {
313
                $status = $status_types[$status];
314
            } else {
315
                throw new Exception("Reminder->setStatus(): Ugyldig status (integer)");
316
            }
317
        }
318
319
        if ($status_id <= $this->get("status_id")) {
320
            throw new Exception("Tried to set status the same or lower than it was before. Can be because of reload. In Reminder->setStatus");