File tree Expand file tree Collapse file tree 1 file changed +18
-10
lines changed Expand file tree Collapse file tree 1 file changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -105,15 +105,7 @@ public function listing($forceUpdate = false)
105105 {
106106 @trigger_error ('` ' . __METHOD__ . '()` is deprecated since v2.7.0, use ` ' . __CLASS__ . '::listNames()` instead. ' , E_USER_DEPRECATED );
107107
108- if (empty ($ this ->timeEntryActivities ) || $ forceUpdate ) {
109- $ this ->timeEntryActivities = $ this ->list ();
110- }
111- $ ret = [];
112- foreach ($ this ->timeEntryActivities ['time_entry_activities ' ] as $ e ) {
113- $ ret [$ e ['name ' ]] = (int ) $ e ['id ' ];
114- }
115-
116- return $ ret ;
108+ return $ this ->doListing ((bool ) $ forceUpdate );
117109 }
118110
119111 /**
@@ -125,11 +117,27 @@ public function listing($forceUpdate = false)
125117 */
126118 public function getIdByName ($ name )
127119 {
128- $ arr = $ this ->listing ();
120+ $ arr = $ this ->doListing (false );
121+
129122 if (!isset ($ arr [$ name ])) {
130123 return false ;
131124 }
132125
133126 return $ arr [(string ) $ name ];
134127 }
128+
129+ private function doListing (bool $ forceUpdate )
130+ {
131+ if (empty ($ this ->timeEntryActivities ) || $ forceUpdate ) {
132+ $ this ->timeEntryActivities = $ this ->list ();
133+ }
134+
135+ $ ret = [];
136+
137+ foreach ($ this ->timeEntryActivities ['time_entry_activities ' ] as $ e ) {
138+ $ ret [$ e ['name ' ]] = (int ) $ e ['id ' ];
139+ }
140+
141+ return $ ret ;
142+ }
135143}
You can’t perform that action at this time.
0 commit comments