Code Duplication    Length = 13-19 lines in 3 locations

core/admin/EE_Admin_Page.core.php 3 locations

@@ 864-876 (lines=13) @@
861
        }
862
        $this->_route = false;
863
        // check that the page_routes array is not empty
864
        if (empty($this->_page_routes)) {
865
            // user error msg
866
            $error_msg = sprintf(
867
                esc_html__('No page routes have been set for the %s admin page.', 'event_espresso'),
868
                $this->_admin_page_title
869
            );
870
            // developer error msg
871
            $error_msg .= '||' . $error_msg
872
                          . esc_html__(
873
                              ' Make sure the "set_page_routes()" method exists, and is setting the "_page_routes" array properly.',
874
                              'event_espresso'
875
                          );
876
            throw new EE_Error($error_msg);
877
        }
878
        // and that the requested page route exists
879
        if (array_key_exists($this->_req_action, $this->_page_routes)) {
@@ 883-901 (lines=19) @@
880
            $this->_route = $this->_page_routes[ $this->_req_action ];
881
            $this->_route_config = isset($this->_page_config[ $this->_req_action ])
882
                ? $this->_page_config[ $this->_req_action ] : array();
883
        } else {
884
            // user error msg
885
            $error_msg = sprintf(
886
                esc_html__(
887
                    'The requested page route does not exist for the %s admin page.',
888
                    'event_espresso'
889
                ),
890
                $this->_admin_page_title
891
            );
892
            // developer error msg
893
            $error_msg .= '||' . $error_msg
894
                          . sprintf(
895
                              esc_html__(
896
                                  ' Create a key in the "_page_routes" array named "%s" and set its value to the appropriate method.',
897
                                  'event_espresso'
898
                              ),
899
                              $this->_req_action
900
                          );
901
            throw new EE_Error($error_msg);
902
        }
903
        // and that a default route exists
904
        if (! array_key_exists('default', $this->_page_routes)) {
@@ 904-919 (lines=16) @@
901
            throw new EE_Error($error_msg);
902
        }
903
        // and that a default route exists
904
        if (! array_key_exists('default', $this->_page_routes)) {
905
            // user error msg
906
            $error_msg = sprintf(
907
                esc_html__(
908
                    'A default page route has not been set for the % admin page.',
909
                    'event_espresso'
910
                ),
911
                $this->_admin_page_title
912
            );
913
            // developer error msg
914
            $error_msg .= '||' . $error_msg
915
                          . esc_html__(
916
                              ' Create a key in the "_page_routes" array named "default" and set its value to your default page method.',
917
                              'event_espresso'
918
                          );
919
            throw new EE_Error($error_msg);
920
        }
921
922
        // first lets' catch if the UI request has EVER been set.