| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace UniMan\Drivers\Memcache; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use UniMan\Core\Column; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use UniMan\Core\ListingHeaders\HeaderManagerInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | class MemcacheHeaderManager implements HeaderManagerInterface | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 9 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 10 | 2 |  |     public function databasesHeaders() | 
            
                                                                        
                            
            
                                    
            
            
                | 11 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 12 |  |  |         $fields = [ | 
            
                                                                        
                            
            
                                    
            
            
                | 13 | 2 |  |             'server' => ['is_numeric' => false], | 
            
                                                                        
                            
            
                                    
            
            
                | 14 |  |  |             'process_id' => ['is_numeric' => false], | 
            
                                                                        
                            
            
                                    
            
            
                | 15 |  |  |             'uptime' => ['is_numeric' => true, 'is_time' => true], | 
            
                                                                        
                            
            
                                    
            
            
                | 16 |  |  |             'current_items' => ['is_numeric' => true], | 
            
                                                                        
                            
            
                                    
            
            
                | 17 |  |  |             'total_items' => ['is_numeric' => true], | 
            
                                                                        
                            
            
                                    
            
            
                | 18 |  |  |             'size' => ['is_numeric' => true, 'is_size' => true], | 
            
                                                                        
                            
            
                                    
            
            
                | 19 |  |  |             'active_slabs' => ['is_numeric' => true], | 
            
                                                                        
                            
            
                                    
            
            
                | 20 |  |  |             'total_malloced' => ['is_numeric' => true, 'is_size' => true], | 
            
                                                                        
                            
            
                                    
            
            
                | 21 |  |  |         ]; | 
            
                                                                        
                            
            
                                    
            
            
                | 22 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 23 | 2 |  |         $columns = []; | 
            
                                                                        
                            
            
                                    
            
            
                | 24 | 2 |  |         foreach ($fields as $key => $settings) { | 
            
                                                                        
                            
            
                                    
            
            
                | 25 | 2 |  |             $column = (new Column($key, 'memcache.headers.servers.' . $key)) | 
            
                                                                        
                            
            
                                    
            
            
                | 26 | 2 |  |                 ->setSortable(true); | 
            
                                                                        
                            
            
                                    
            
            
                | 27 | 2 |  |             if (isset($settings['is_numeric'])) { | 
            
                                                                        
                            
            
                                    
            
            
                | 28 | 2 |  |                 $column->setNumeric($settings['is_numeric']); | 
            
                                                                        
                            
            
                                    
            
            
                | 29 |  |  |             } | 
            
                                                                        
                            
            
                                    
            
            
                | 30 | 2 |  |             if (isset($settings['is_size'])) { | 
            
                                                                        
                            
            
                                    
            
            
                | 31 | 2 |  |                 $column->setSize($settings['is_size']); | 
            
                                                                        
                            
            
                                    
            
            
                | 32 |  |  |             } | 
            
                                                                        
                            
            
                                    
            
            
                | 33 | 2 |  |             if (isset($settings['is_time'])) { | 
            
                                                                        
                            
            
                                    
            
            
                | 34 | 2 |  |                 $column->setTime($settings['is_time']); | 
            
                                                                        
                            
            
                                    
            
            
                | 35 |  |  |             } | 
            
                                                                        
                            
            
                                    
            
            
                | 36 | 2 |  |             $columns[] = $column; | 
            
                                                                        
                            
            
                                    
            
            
                | 37 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 38 | 2 |  |         return $columns; | 
            
                                                                        
                            
            
                                    
            
            
                | 39 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 | 2 |  |     public function tablesHeaders() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 | 2 |  |         return []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 | 2 |  |     public function itemsHeaders($type, $table) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 | 2 |  |         $columns = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 | 2 |  |         if ($type == MemcacheDriver::TYPE_KEY) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 | 2 |  |             $columns[] = (new Column('key', 'memcache.columns.' . $type . '.key')) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 | 2 |  |                 ->setSortable(true) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 | 2 |  |                 ->setFilterable(true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 | 2 |  |             $columns[] = (new Column('value', 'memcache.columns.' . $type . '.value')) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 | 2 |  |                 ->setSortable(true) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 | 2 |  |                 ->setFilterable(true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 | 2 |  |             $columns[] = (new Column('length', 'memcache.columns.' . $type . '.length')) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 | 2 |  |                 ->setSortable(true) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 | 2 |  |                 ->setFilterable(true) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 | 2 |  |                 ->setNumeric(true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 | 2 |  |             $columns[] = (new Column('expiration', 'memcache.columns.' . $type . '.expiration')) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 | 2 |  |                 ->setSortable(true) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 | 2 |  |                 ->setFilterable(true) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 | 2 |  |                 ->setNumeric(true) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 | 2 |  |                 ->setTime(true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 | 2 |  |             $columns[] = (new Column('compressed', 'memcache.columns.' . $type . '.compressed')) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 | 2 |  |                 ->setSortable(true) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 | 2 |  |                 ->setFilterable(true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 | 2 |  |         return $columns; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 71 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 72 |  |  |  |