public function merge($output)
    {
        if (empty($this->files)) {
            throw new \LogicException("You need to add some files to merge by calling one of addFile, addFiles, setFiles methods");
        }

        /**
         * @var string $outputFiles
         */
        $outputFiles = array();
        foreach ($this->files as $file) {
            if (!$this->supports($file)) {
                if (!$this->omitUnsupported) {
                    throw new UnsupportedException(sprintf("Transformer for file '%s' not found, mime: %s", $file->getPath(), $file->getMimeType()));
                }
                continue;
            }
            if (!$this->driver->supports($file)) {
                $outputFile = $this->getTransformer($file)->transform($file);
                if (!$outputFile) {
                    throw new \LogicException(sprintf("Transformer should return NeuroSys\\FileMerger\\File in '%s' format", $this->driver->getFormat()));
                }
                $outputFiles[] = $outputFile->getPath();
            } else {
                $outputFiles[] = $file->getPath();
            }
        }

        if (count($outputFiles) == 1) {
            copy(end($outputFiles), $output);
        } elseif ($outputFiles) {
            $this->driver->merge($outputFiles, $output);
        }

        // reset files array
        $this->files = array();
    }