original_string: public function map(array $columns)
      {
          $maps = [];
  
          $seenKeys = [];
  
          foreach($columns as $index => $column_name) {
              $key = $this->getMapping($column_name);
  
              if ($key === false) {
                  continue;
              }
  
              if (in_array($key, $seenKeys)) {
                  throw new OverlapColumnException($key);
              }
  
              $seenKeys[] = $key;
  
              $this->mappings[$key]['index'] = $index;
  
              $maps[$key] = $index;
          }
  
          // Check all required mappings are satisfied
          foreach($this->mappings as $key => $data) {
              if ($data['required'] && !array_key_exists($key, $maps)) {
                  throw new MappingIncompleteException($key);
              }
          }
  
          return $maps;
      }
code: public function map(array $columns)
      {
          $maps = [];
  
          $seenKeys = [];
  
          foreach($columns as $index => $column_name) {
              $key = $this->getMapping($column_name);
  
              if ($key === false) {
                  continue;
              }
  
              if (in_array($key, $seenKeys)) {
                  throw new OverlapColumnException($key);
              }
  
              $seenKeys[] = $key;
  
              $this->mappings[$key]['index'] = $index;
  
              $maps[$key] = $index;
          }
  
          // Check all required mappings are satisfied
          foreach($this->mappings as $key => $data) {
              if ($data['required'] && !array_key_exists($key, $maps)) {
                  throw new MappingIncompleteException($key);
              }
          }
  
          return $maps;
      }
code_tokens: public function map ( array $ columns ) { $ maps = [ ] ; $ seenKeys = [ ] ; foreach ( $ columns as $ index => $ column_name ) { $ key = $ this -> getMapping ( $ column_name ) ; if ( $ key === false ) { continue ; } if ( in_array ( $ key , $ seenKeys ) ) { throw new OverlapColumnException ( $ key ) ; } $ seenKeys [ ] = $ key ; $ this -> mappings [ $ key ] [ 'index' ] = $ index ; $ maps [ $ key ] = $ index ; } // Check all required mappings are satisfied foreach ( $ this -> mappings as $ key => $ data ) { if ( $ data [ 'required' ] && ! array_key_exists ( $ key , $ maps ) ) { throw new MappingIncompleteException ( $ key ) ; } } return $ maps ; }
docstring: Map columns on array
  
  @param array $columns Array to map
  @return array mappings
  @throws MappingIncompleteException
  @throws OverlapColumnException
docstring_tokens: Map columns on array