/** * @param OutputInterface $output * @param string $filename * @param bool $append */ public function __construct(OutputInterface $output, $filename, $append = true) { parent::__construct($output); $this->append = $append; $dir = pathinfo($filename, PATHINFO_DIRNAME); if (!is_dir($dir) && true !== @mkdir($dir, 0755, true)) { throw new IOException('Failed to create the export directory: ' . $dir); } if (!($this->handle = @fopen($filename, 'w'))) { throw new IOException('Failed to open the export file: ' . $filename); } }