From bc5c14c1e91841bda27f389b38a10ca58264f2b8 Mon Sep 17 00:00:00 2001
From: ebremner <ebremner@uwaterloo.ca>
Date: Mon, 7 Dec 2020 08:31:43 -0500
Subject: [PATCH] ISTWCMS-4199: clearning up recursion in uwService

---
 src/Service/UWService.php | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/src/Service/UWService.php b/src/Service/UWService.php
index 75601919..362e36d1 100644
--- a/src/Service/UWService.php
+++ b/src/Service/UWService.php
@@ -355,23 +355,16 @@ class UWService implements UWServiceInterface {
     // Step through the menus and check for submenus and count.
     foreach ($menus as $menu) {
 
+      // Increment the menu items counter.
+      $menu_items_count++;
+
       // If there is a submenu, recursivley call the count function.
       if (isset($menu['submenu']) && count($menu['submenu']) > 0) {
 
-        // Increment the menu items counter.
-        $menu_items_count++;
-
         // Recursively check the submenu.
         $this->uwCountMenuItems($menu['submenu'], $menu_items_count);
 
       }
-
-      // If there are no submenus, simple increment the menu items counter.
-      else {
-
-        // Increment the menu items counter.
-        $menu_items_count++;
-      }
     }
   }
 
-- 
GitLab