| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace arc\html; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | class NodeList extends \ArrayObject { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |     use \arc\xml\NodeListTrait { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |         \arc\xml\NodeListTrait::parseArgs as traitParseArgs; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 | 1 |  |     protected function canHaveContent( $tagName ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |         $cantHaveContent = [  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 | 1 |  |             'area', 'base', 'basefont', 'br',  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 | 1 |  |             'col', 'frame', 'hr', 'img', 'input', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 | 1 |  |             'isindex', 'link', 'meta', 'param' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 | 1 |  |         ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 | 1 |  |         return !in_array( trim( strtolower( $tagName ) ), $cantHaveContent ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 18 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 19 | 1 |  |     protected function element( $tagName, $attributes, $content ) { | 
            
                                                                        
                            
            
                                    
            
            
                | 20 | 1 |  |         $tagName =  $this->writer->name( $tagName ); | 
            
                                                                        
                            
            
                                    
            
            
                | 21 | 1 |  |         $el = '<' . $tagName; | 
            
                                                                        
                            
            
                                    
            
            
                | 22 | 1 |  |         $el .= $this->getAttributes( $attributes ); | 
            
                                                                        
                            
            
                                    
            
            
                | 23 | 1 |  |         if ( $this->canHaveContent( $tagName ) ) { | 
            
                                                                        
                            
            
                                    
            
            
                | 24 | 1 |  |             $el .= '>' . self::indent( $content, $this->writer->indent, $this->writer->newLine ); | 
            
                                                                        
                            
            
                                    
            
            
                | 25 | 1 |  |             $el .= '</' . $tagName . '>'; | 
            
                                                                        
                            
            
                                    
            
            
                | 26 | 1 |  |         } else { | 
            
                                                                        
                            
            
                                    
            
            
                | 27 | 1 |  |             $el .= '>'; | 
            
                                                                        
                            
            
                                    
            
            
                | 28 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 29 | 1 |  |         return $el; | 
            
                                                                        
                            
            
                                    
            
            
                | 30 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 | 1 |  |     protected function parseArgs( $args ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 | 1 |  |         if ( is_string($args) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |             // allows for <input type="radio" checked> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |             // as \arc\html::input(['type' => 'radio', 'checked']); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 | 1 |  |             return [ [ $args => $args ], '' ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 | 1 |  |             return $this->traitParseArgs($args); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 41 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 42 |  |  | } | 
            
                        
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.