@@ -401,7 +401,7 @@ private function commandsStats(): string {
401401 private function slabs (): string {
402402 $ slabs_stats = $ this ->memcached ->getSlabsStats ();
403403
404- $ slabs = array_map (function (array $ slab ): array {
404+ $ slabs = array_map (static function (array $ slab ): array {
405405 $ fields = [
406406 'chunk_size ' => ['Chunk Size ' , 'bytes ' ],
407407 'chunks_per_page ' => ['Chunks per Page ' , 'number ' ],
@@ -420,7 +420,7 @@ private function slabs(): string {
420420 'touch_hits ' => ['TOUCH Hits ' , 'number ' ],
421421 ];
422422
423- return $ this -> formatField ($ fields , $ slab );
423+ return Helpers:: formatFields ($ fields , $ slab );
424424 }, $ slabs_stats ['slabs ' ]);
425425
426426 return $ this ->template ->render ('dashboards/memcached ' , [
@@ -435,7 +435,7 @@ private function slabs(): string {
435435 private function items (): string {
436436 $ stats = $ this ->memcached ->getItemsStats ();
437437
438- $ items = array_map (function (array $ item ): array {
438+ $ items = array_map (static function (array $ item ): array {
439439 $ fields = [
440440 'number ' => ['Items ' , 'number ' ],
441441 'number_hot ' => ['HOT LRU ' , 'number ' ],
@@ -468,29 +468,12 @@ private function items(): string {
468468 'hits_to_temp ' => ['Hits to TEMP ' , 'number ' ],
469469 ];
470470
471- return $ this -> formatField ($ fields , $ item );
471+ return Helpers:: formatFields ($ fields , $ item );
472472 }, $ stats );
473473
474474 return $ this ->template ->render ('dashboards/memcached ' , ['items ' => $ items ]);
475475 }
476476
477- /**
478- * @param array<string, mixed> $fields
479- * @param array<string, mixed> $item
480- *
481- * @return array<string, mixed>
482- */
483- private function formatField (array $ fields , array $ item ): array {
484- $ formatted = [];
485-
486- foreach ($ fields as $ key => [$ label , $ type ]) {
487- $ value = $ item [$ key ] ?? 0 ;
488- $ formatted [$ label ] = Format::{$ type }($ value );
489- }
490-
491- return $ formatted ;
492- }
493-
494477 /**
495478 * @throws MemcachedException
496479 */
0 commit comments