@@ -124,7 +124,7 @@ public function add($message, $type=self::NOTICE)
124
124
*/
125
125
public function containsBlockingErrors ()
126
126
{
127
- $ seenTypes = $ this -> arrayColumn ($ this ->cache , 'type ' );
127
+ $ seenTypes = array_column ($ this ->cache , 'type ' );
128
128
$ typeFrequency = array_count_values ($ seenTypes );
129
129
return isset ($ typeFrequency [self ::ERROR ]);
130
130
@@ -156,7 +156,7 @@ public function display($order=self::ORDERBY_SEVERITY)
156
156
$ this ->clearCache ();
157
157
158
158
if ($ order === self ::ORDERBY_RECEIVED ) {
159
- $ messages = $ this -> arrayColumn ($ messageInfo , 'message ' );
159
+ $ messages = array_column ($ messageInfo , 'message ' );
160
160
} else {
161
161
$ messages = $ this ->sortBySeverity ($ messageInfo );
162
162
}
@@ -278,33 +278,4 @@ private function clearCache()
278
278
}//end clearCache()
279
279
280
280
281
- /**
282
- * Return the values from a single column in the input array.
283
- *
284
- * Polyfill for the PHP 5.5+ native array_column() function (for the functionality needed here).
285
- *
286
- * @param array<array<string, string|int>> $input A multi-dimensional array from which to pull a column of values.
287
- * @param string $columnKey The name of the column of values to return.
288
- *
289
- * @link https://www.php.net/function.array-column
290
- *
291
- * @return array<string|int>
292
- */
293
- private function arrayColumn (array $ input , $ columnKey )
294
- {
295
- if (function_exists ('array_column ' ) === true ) {
296
- // PHP 5.5+.
297
- return array_column ($ input , $ columnKey );
298
- }
299
-
300
- // PHP 5.4.
301
- $ callback = function ($ row ) use ($ columnKey ) {
302
- return $ row [$ columnKey ];
303
- };
304
-
305
- return array_map ($ callback , $ input );
306
-
307
- }//end arrayColumn()
308
-
309
-
310
281
}//end class
0 commit comments