src/Mapping.php
public function addMapping($key, array $accepted_names, $required = true)
    {
        $lower_accepted_names = [];

        foreach($accepted_names as $name) {
            $lower_name = strtolower($name);

            if ($this->getMapping($lower_name) !== false) {
                throw new MappingOverlapException(sprintf('Column name %s already mapped on %s', $name, $key));
            }

            $lower_accepted_names[] = $lower_name;
        }

        $this->mappings[$key] = [
            'accepted_names' => $lower_accepted_names,
            'required' => $required,
            'index' => null,
        ];

        return $this;
    }
public function addMapping($key, array $accepted_names, $required = true)
    {
        $lower_accepted_names = [];

        foreach($accepted_names as $name) {
            $lower_name = strtolower($name);

            if ($this->getMapping($lower_name) !== false) {
                throw new MappingOverlapException(sprintf('Column name %s already mapped on %s', $name, $key));
            }

            $lower_accepted_names[] = $lower_name;
        }

        $this->mappings[$key] = [
            'accepted_names' => $lower_accepted_names,
            'required' => $required,
            'index' => null,
        ];

        return $this;
    }
public function addMapping ( $ key , array $ accepted_names , $ required = true ) { $ lower_accepted_names = [ ] ; foreach ( $ accepted_names as $ name ) { $ lower_name = strtolower ( $ name ) ; if ( $ this -> getMapping ( $ lower_name ) !== false ) { throw new MappingOverlapException ( sprintf ( 'Column name %s already mapped on %s' , $ name , $ key ) ) ; } $ lower_accepted_names [ ] = $ lower_name ; } $ this -> mappings [ $ key ] = [ 'accepted_names' => $ lower_accepted_names , 'required' => $ required , 'index' => null , ] ; return $ this ; }
Add a mapping expectation

@param string $key Mapping identifier
@param array $accepted_names Allowed columns names
@param boolean $required Column is required
@return $this
@throws MappingOverlapException
Add a mapping expectation