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;
    }
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;
    }
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 ; }
Map columns on array

@param array $columns Array to map
@return array mappings
@throws MappingIncompleteException
@throws OverlapColumnException
Map columns on array