Last active
November 25, 2015 22:22
-
-
Save hannesvdvreken/f7110168c35e24d6b7ed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class CsvExporter | |
{ | |
protected $repository; | |
protected $file; | |
protected $writer; | |
protected $parameters; | |
public function __construct(RepositoryInterface $repository, TransformerInterface $transformer, array $parameters) | |
{ | |
$this->repository = $repository; | |
$this->parameters = $parameters; | |
$this->file = new SplTempFileObject(); | |
$this->writer = Writer::createFromFileObject($this->file); | |
$this->writer->insertOne($transformer->getHeaders()); | |
$this->writer->addFormatter([$transformer, 'transform']); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment