public function wrapException(
        array $columnNames = array(),
        \Exception $parent = null,
        $className = '\TechDivision\Import\Exceptions\WrappedColumnException'
    ) {

        // initialize the message
        $message = $parent->getMessage();

        // query whether or not has been a result of invalid data of a previous column of a CSV file
        if ($this->hasOriginalData()) {
            // load the original data
            $originalData = $this->getOriginalData();

            // replace old filename and line number of the original message
            $message = $this->appendExceptionSuffix(
                $this->stripExceptionSuffix($message),
                $originalData[ColumnKeys::ORIGINAL_FILENAME],
                $originalData[ColumnKeys::ORIGINAL_LINE_NUMBER]
            );
        } else {
            // append filename and line number to the original message
            $message = $this->appendExceptionSuffix(
                $this->stripExceptionSuffix($message),
                $this->filename,
                $this->lineNumber
            );
        }

        // query whether or not, column names has been passed
        if (sizeof($columnNames) > 0) {
            // prepare the original column names
            $originalColumnNames = array();
            foreach ($columnNames as $columnName) {
                $originalColumnNames[] = $this->resolveOriginalColumnName($columnName);
            }

            // append the column information
            $message = sprintf('%s in column(s) %s', $message, implode(', ', $originalColumnNames));
        }

        // create a new exception and wrap the parent one
        return new $className($message, null, $parent);
    }
public function wrapException(
        array $columnNames = array(),
        \Exception $parent = null,
        $className = '\TechDivision\Import\Exceptions\WrappedColumnException'
    ) {

        // initialize the message
        $message = $parent->getMessage();

        // query whether or not has been a result of invalid data of a previous column of a CSV file
        if ($this->hasOriginalData()) {
            // load the original data
            $originalData = $this->getOriginalData();

            // replace old filename and line number of the original message
            $message = $this->appendExceptionSuffix(
                $this->stripExceptionSuffix($message),
                $originalData[ColumnKeys::ORIGINAL_FILENAME],
                $originalData[ColumnKeys::ORIGINAL_LINE_NUMBER]
            );
        } else {
            // append filename and line number to the original message
            $message = $this->appendExceptionSuffix(
                $this->stripExceptionSuffix($message),
                $this->filename,
                $this->lineNumber
            );
        }

        // query whether or not, column names has been passed
        if (sizeof($columnNames) > 0) {
            // prepare the original column names
            $originalColumnNames = array();
            foreach ($columnNames as $columnName) {
                $originalColumnNames[] = $this->resolveOriginalColumnName($columnName);
            }

            // append the column information
            $message = sprintf('%s in column(s) %s', $message, implode(', ', $originalColumnNames));
        }

        // create a new exception and wrap the parent one
        return new $className($message, null, $parent);
    }
public function wrapException ( array $ columnNames = array ( ) , \ Exception $ parent = null , $ className = '\TechDivision\Import\Exceptions\WrappedColumnException' ) { // initialize the message $ message = $ parent -> getMessage ( ) ; // query whether or not has been a result of invalid data of a previous column of a CSV file if ( $ this -> hasOriginalData ( ) ) { // load the original data $ originalData = $ this -> getOriginalData ( ) ; // replace old filename and line number of the original message $ message = $ this -> appendExceptionSuffix ( $ this -> stripExceptionSuffix ( $ message ) , $ originalData [ ColumnKeys :: ORIGINAL_FILENAME ] , $ originalData [ ColumnKeys :: ORIGINAL_LINE_NUMBER ] ) ; } else { // append filename and line number to the original message $ message = $ this -> appendExceptionSuffix ( $ this -> stripExceptionSuffix ( $ message ) , $ this -> filename , $ this -> lineNumber ) ; } // query whether or not, column names has been passed if ( sizeof ( $ columnNames ) > 0 ) { // prepare the original column names $ originalColumnNames = array ( ) ; foreach ( $ columnNames as $ columnName ) { $ originalColumnNames [ ] = $ this -> resolveOriginalColumnName ( $ columnName ) ; } // append the column information $ message = sprintf ( '%s in column(s) %s' , $ message , implode ( ', ' , $ originalColumnNames ) ) ; } // create a new exception and wrap the parent one return new $ className ( $ message , null , $ parent ) ; }
Wraps the passed exeception into a new one by trying to resolve the original filname,
line number and column names and use it for a detailed exception message.

@param array      $columnNames The column names that should be resolved and wrapped
@param \Exception $parent      The exception we want to wrap
@param string     $className   The class name of the exception type we want to wrap the parent one

@return \Exception the wrapped exception
Wraps the passed exeception into a new one by trying to resolve the original filname line number and column names and use it for a detailed exception message .