Code Duplication    Length = 12-12 lines in 3 locations

src/dbo/states.php 3 locations

@@ 618-629 (lines=12) @@
615
            // Set author transitions.
616
            $transitions = $state->xpath('./transitions/author/state');
617
618
            if ($transitions !== FALSE)
619
            {
620
                foreach ($transitions as $transit)
621
                {
622
                    $rs = dal_query('states/fndk2.sql', $template_id, ustrtolower(ustrcut($transit, MAX_STATE_NAME)));
623
624
                    if ($rs->rows != 0)
625
                    {
626
                        dal_query('states/rtadd.sql', $state_id, $rs->fetch('state_id'), STATE_ROLE_AUTHOR);
627
                    }
628
                }
629
            }
630
631
            // Set responsible transitions.
632
            $transitions = $state->xpath('./transitions/responsible/state');
@@ 634-645 (lines=12) @@
631
            // Set responsible transitions.
632
            $transitions = $state->xpath('./transitions/responsible/state');
633
634
            if ($transitions !== FALSE)
635
            {
636
                foreach ($transitions as $transit)
637
                {
638
                    $rs = dal_query('states/fndk2.sql', $template_id, ustrtolower(ustrcut($transit, MAX_STATE_NAME)));
639
640
                    if ($rs->rows != 0)
641
                    {
642
                        dal_query('states/rtadd.sql', $state_id, $rs->fetch('state_id'), STATE_ROLE_RESPONSIBLE);
643
                    }
644
                }
645
            }
646
647
            // Set registered transitions.
648
            $transitions = $state->xpath('./transitions/registered/state');
@@ 650-661 (lines=12) @@
647
            // Set registered transitions.
648
            $transitions = $state->xpath('./transitions/registered/state');
649
650
            if ($transitions !== FALSE)
651
            {
652
                foreach ($transitions as $transit)
653
                {
654
                    $rs = dal_query('states/fndk2.sql', $template_id, ustrtolower(ustrcut($transit, MAX_STATE_NAME)));
655
656
                    if ($rs->rows != 0)
657
                    {
658
                        dal_query('states/rtadd.sql', $state_id, $rs->fetch('state_id'), STATE_ROLE_REGISTERED);
659
                    }
660
                }
661
            }
662
663
            // Enumerate groups transitions.
664
            $groups = $state->xpath('./transitions/group');