public function transform() {
        $originalFile = $this->getOriginalFile();
        $transformedFiles = array();
        $error = null;

        if (!$originalFile) {
            throw new IoException('No original file detected');
        }

        // Apply transformations to original
        if ($this->_selfTransformers) {
            foreach ($this->_selfTransformers as $transformer) {
                try {
                    $originalFile = $transformer->transform($originalFile, true);

                } catch (Exception $e) {
                    $error = $e->getMessage();
                    break;
                }
            }

            $originalFile->reset();
        }

        // Create transformed files based off original
        if ($this->_transformers && !$error) {
            foreach ($this->_transformers as $transformer) {
                try {
                    $transformedFiles[] = $transformer->transform($originalFile, false);

                } catch (Exception $e) {
                    $error = $e->getMessage();
                    break;
                }
            }
        }

        $this->_file = $originalFile;
        $this->_files = $transformedFiles;

        // Throw error and rollback
        if ($error) {
            $this->rollback();

            throw new TransformationException($error);
        }

        return true;
    }
public function transform() {
        $originalFile = $this->getOriginalFile();
        $transformedFiles = array();
        $error = null;

        if (!$originalFile) {
            throw new IoException('No original file detected');
        }

        // Apply transformations to original
        if ($this->_selfTransformers) {
            foreach ($this->_selfTransformers as $transformer) {
                try {
                    $originalFile = $transformer->transform($originalFile, true);

                } catch (Exception $e) {
                    $error = $e->getMessage();
                    break;
                }
            }

            $originalFile->reset();
        }

        // Create transformed files based off original
        if ($this->_transformers && !$error) {
            foreach ($this->_transformers as $transformer) {
                try {
                    $transformedFiles[] = $transformer->transform($originalFile, false);

                } catch (Exception $e) {
                    $error = $e->getMessage();
                    break;
                }
            }
        }

        $this->_file = $originalFile;
        $this->_files = $transformedFiles;

        // Throw error and rollback
        if ($error) {
            $this->rollback();

            throw new TransformationException($error);
        }

        return true;
    }
public function transform ( ) { $ originalFile = $ this -> getOriginalFile ( ) ; $ transformedFiles = array ( ) ; $ error = null ; if ( ! $ originalFile ) { throw new IoException ( 'No original file detected' ) ; } // Apply transformations to original if ( $ this -> _selfTransformers ) { foreach ( $ this -> _selfTransformers as $ transformer ) { try { $ originalFile = $ transformer -> transform ( $ originalFile , true ) ; } catch ( Exception $ e ) { $ error = $ e -> getMessage ( ) ; break ; } } $ originalFile -> reset ( ) ; } // Create transformed files based off original if ( $ this -> _transformers && ! $ error ) { foreach ( $ this -> _transformers as $ transformer ) { try { $ transformedFiles [ ] = $ transformer -> transform ( $ originalFile , false ) ; } catch ( Exception $ e ) { $ error = $ e -> getMessage ( ) ; break ; } } } $ this -> _file = $ originalFile ; $ this -> _files = $ transformedFiles ; // Throw error and rollback if ( $ error ) { $ this -> rollback ( ) ; throw new TransformationException ( $ error ) ; } return true ; }
Apply transformations to the original file and generate new transformed files.

@return bool
@throws \Transit\Exception\IoException
@throws \Transit\Exception\TransformationException
Apply transformations to the original file and generate new transformed files .