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 @@ -109,15 +109,7 @@ public function listing($forceUpdate = false)
109109 {
110110 @trigger_error ('` ' . __METHOD__ . '()` is deprecated since v2.7.0, use ` ' . __CLASS__ . '::listNames()` instead. ' , E_USER_DEPRECATED );
111111
112- if (empty ($ this ->trackers ) || $ forceUpdate ) {
113- $ this ->trackers = $ this ->list ();
114- }
115- $ ret = [];
116- foreach ($ this ->trackers ['trackers ' ] as $ e ) {
117- $ ret [$ e ['name ' ]] = (int ) $ e ['id ' ];
118- }
119-
120- return $ ret ;
112+ return $ this ->doListing ($ forceUpdate );
121113 }
122114
123115 /**
@@ -129,11 +121,27 @@ public function listing($forceUpdate = false)
129121 */
130122 public function getIdByName ($ name )
131123 {
132- $ arr = $ this ->listing ();
124+ $ arr = $ this ->doListing (false );
125+
133126 if (!isset ($ arr [$ name ])) {
134127 return false ;
135128 }
136129
137130 return $ arr [(string ) $ name ];
138131 }
132+
133+ private function doListing (bool $ forceUpdate )
134+ {
135+ if (empty ($ this ->trackers ) || $ forceUpdate ) {
136+ $ this ->trackers = $ this ->list ();
137+ }
138+
139+ $ ret = [];
140+
141+ foreach ($ this ->trackers ['trackers ' ] as $ e ) {
142+ $ ret [$ e ['name ' ]] = (int ) $ e ['id ' ];
143+ }
144+
145+ return $ ret ;
146+ }
139147}
You can’t perform that action at this time.
0 commit comments