original_string: protected function validateHeaderSettings()
      {
          $errors = $header = array();
          $lines = gplcart_string_explode_multiline($this->getSubmitted('header', ''));
  
          foreach ($lines as $pos => $line) {
  
              $pos++;
              $data = array_filter(array_map('trim', explode(' ', $line, 2)));
  
              if (count($data) != 2) {
                  $errors[] = $pos;
                  continue;
              }
  
              list($key, $label) = $data;
  
              if (preg_match('/^[a-z_]+$/', $key) !== 1) {
                  $errors[] = $pos;
                  continue;
              }
  
              $header[$key] = $label;
          }
  
          if (empty($errors)) {
              $this->setSubmitted('header', $header);
          } else {
              $vars = array('@num' => implode(',', $errors));
              $this->setError('header', $this->text('Error on line @num', $vars));
          }
      }
code: protected function validateHeaderSettings()
      {
          $errors = $header = array();
          $lines = gplcart_string_explode_multiline($this->getSubmitted('header', ''));
  
          foreach ($lines as $pos => $line) {
  
              $pos++;
              $data = array_filter(array_map('trim', explode(' ', $line, 2)));
  
              if (count($data) != 2) {
                  $errors[] = $pos;
                  continue;
              }
  
              list($key, $label) = $data;
  
              if (preg_match('/^[a-z_]+$/', $key) !== 1) {
                  $errors[] = $pos;
                  continue;
              }
  
              $header[$key] = $label;
          }
  
          if (empty($errors)) {
              $this->setSubmitted('header', $header);
          } else {
              $vars = array('@num' => implode(',', $errors));
              $this->setError('header', $this->text('Error on line @num', $vars));
          }
      }
code_tokens: protected function validateHeaderSettings ( ) { $ errors = $ header = array ( ) ; $ lines = gplcart_string_explode_multiline ( $ this -> getSubmitted ( 'header' , '' ) ) ; foreach ( $ lines as $ pos => $ line ) { $ pos ++ ; $ data = array_filter ( array_map ( 'trim' , explode ( ' ' , $ line , 2 ) ) ) ; if ( count ( $ data ) != 2 ) { $ errors [ ] = $ pos ; continue ; } list ( $ key , $ label ) = $ data ; if ( preg_match ( '/^[a-z_]+$/' , $ key ) !== 1 ) { $ errors [ ] = $ pos ; continue ; } $ header [ $ key ] = $ label ; } if ( empty ( $ errors ) ) { $ this -> setSubmitted ( 'header' , $ header ) ; } else { $ vars = array ( '@num' => implode ( ',' , $ errors ) ) ; $ this -> setError ( 'header' , $ this -> text ( 'Error on line @num' , $ vars ) ) ; } }
docstring: Validate header mapping
docstring_tokens: Validate header mapping