/** * {@inheritdoc} */ public function createTempFile($ext = '') { // Add a dot to the file extension $ext = $ext ? '.' . $ext : ''; $file = $this->filesystem->tempnam($this->dir, $this->prefix); if (!$file) { throw new \Exception('Could not create a temporary file to write to.'); } $this->tempfiles[] = $file; return $file; }