/**
* runs before the build
*
* @param array $fields
* @param string|null $file
* @param string $format
*
* @return \Browscap\Generator\BuildCustomFileGenerator
*/
protected function preBuild($fields = [], $file = null, $format = self::OUTPUT_FORMAT_PHP)
{
parent::preBuild();
$this->getLogger()->info('started creating the custom output file');
if (null === $this->collectionCreator) {
$this->setCollectionCreator(new CollectionCreator());
}
if (null === $this->writerCollection) {
$factory = new Writer\Factory\CustomWriterFactory();
$this->setWriterCollection($factory->createCollection($this->getLogger(), $this->buildFolder, $file, $fields, $format));
}
return $this;
}