File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -197,7 +197,7 @@ protected function compareChildLists()
197197 break ;
198198 } else {
199199 // Get all the other matces for the same $key
200- $ columns = array_column ($ bestMatchPercentages , $ key );
200+ $ columns = $ this -> getArrayColumn ($ bestMatchPercentages , $ key );
201201 $ thisBestMatches = array_filter (
202202 $ columns ,
203203 function ($ v ) use ($ percent ) {
@@ -250,6 +250,24 @@ function ($v) use ($percent) {
250250 // Save the matches.
251251 $ this ->textMatches = $ matches ;
252252 }
253+
254+ /**
255+ * This fuction is exactly like array_column. This is added for PHP versions that do not support array_column.
256+ * @param array $targetArray
257+ * @param mixed $key
258+ * @return array
259+ */
260+ protected function getArrayColumn (array $ targetArray , $ key )
261+ {
262+ $ data = array ();
263+ foreach ($ targetArray as $ item ) {
264+ if (array_key_exists ($ key , $ item )) {
265+ $ data [] = $ item [$ key ];
266+ }
267+ }
268+
269+ return $ data ;
270+ }
253271
254272 /**
255273 * Build multidimensional array holding the contents of each list node, old and new.
You can’t perform that action at this time.
0 commit comments