original_string: public function getLabel()
      {
          $xpath = new \DOMXPath($this->node->ownerDocument);
  
          if ($this->node->hasAttribute('id')) {
              $labels = $xpath->query(sprintf('descendant::label[@for="%s"]', $this->node->getAttribute('id')));
              if ($labels->length > 0) {
                  return $labels->item(0);
              }
          }
  
          $labels = $xpath->query('ancestor::label[1]', $this->node);
          if ($labels->length > 0) {
              return $labels->item(0);
          }
      }
code: public function getLabel()
      {
          $xpath = new \DOMXPath($this->node->ownerDocument);
  
          if ($this->node->hasAttribute('id')) {
              $labels = $xpath->query(sprintf('descendant::label[@for="%s"]', $this->node->getAttribute('id')));
              if ($labels->length > 0) {
                  return $labels->item(0);
              }
          }
  
          $labels = $xpath->query('ancestor::label[1]', $this->node);
          if ($labels->length > 0) {
              return $labels->item(0);
          }
      }
code_tokens: public function getLabel ( ) { $ xpath = new \ DOMXPath ( $ this -> node -> ownerDocument ) ; if ( $ this -> node -> hasAttribute ( 'id' ) ) { $ labels = $ xpath -> query ( sprintf ( 'descendant::label[@for="%s"]' , $ this -> node -> getAttribute ( 'id' ) ) ) ; if ( $ labels -> length > 0 ) { return $ labels -> item ( 0 ) ; } } $ labels = $ xpath -> query ( 'ancestor::label[1]' , $ this -> node ) ; if ( $ labels -> length > 0 ) { return $ labels -> item ( 0 ) ; } }
docstring: Returns the label tag associated to the field or null if none.
  
  @return \DOMElement|null
docstring_tokens: Returns the label tag associated to the field or null if none .