creates writer

@param string $file
503347
private function createWriter($file = null)
    {
        if ($file || $this->_useTemporaryFile) {
            if (!($this->_writer instanceof PHPRtfLite_StreamOutput)) {
                $this->_writer = new PHPRtfLite_StreamOutput();
            }
            if (is_null($file)) {
                $file = sys_get_temp_dir() . '/' . md5(microtime(true)) . '.rtf';
            }
            $this->_writer->setFilename($file);
        }
        else if (!($this->_writer instanceof PHPRtfLite_Writer_String)) {
            $this->_writer = new PHPRtfLite_Writer_String();
        }
    }
1000445
public function writePoFile(string $file): void
    {
        $source = $this->dumpString();
        $testName = file_exists($file) ? $file : dirname($file);
        $status = is_writable($testName);
        if ($status === true) {
            $status = file_put_contents($file, $source);
        }
        if (false === $status) {
            throw new FileNotWritableException($file);
        }
    }
1283529
public function create(string $file) : ModularParser
    {
        $clone = clone $this;
        $clone->valid = null;
        $clone->file = false;
        $clone->class = null;
        return $clone->setFileToLoad($file);
    }
1300289
public static function generate($file)
    {
        $filePointer = fopen($file, 'rb');

        $names = '';
        $extensions = '';

        $header = true;
        while (($row = fgetcsv($filePointer))) {
            if ($header) {
                $header = false;
                continue;
            }

            $mime = trim($row[0]);
            $name = trim(addslashes($row[1]));
            $extension = trim($row[2]);

            $extensions .= "\t\t'$mime' => '$extension',\n";
            $names .= "\t\t'$mime' => '$name',\n";
        }

        $class = '';
        $class .= self::getHeader();
        $class .= self::getFunctions();
        $class .= self::getPropertyMimesHeader();
        $class .= $extensions;
        $class .= self::getPropertyMimesFooter();
        $class .= self::getPropertyNamesHeader();
        $class .= $names;
        $class .= self::getPropertyNamesFooter();
        $class .= self::getFooter();

        file_put_contents(__DIR__ . '/FileMimes.php', $class);
    }
217314
public function setOutputFile($file)
    {
        if (!is_writable(dirname($file))) {
            throw new NotWritableException(sprintf('Output file is not writeable by PhantomJs: %s', $file));
        }

        $this->outputFile = $file;

        return $this;
    }
1061287
public function write($file, $settings)
    {
        $file = '/settings/' . $file;

        /**
         * @todo validate that $file is a string
         * @todo validate that $settings is a string
         */

        $settings = json_decode(json_encode($settings), true);

        $settings = $this->yaml->dump($settings);

        $this->source_filesystem->put($file . '.yml', $settings);
    }
1240395
public function copy($file)
    {
        $fs = new Filesystem;

        if (! $fs->exists(dirname($file))) {
            $fs->mkdir(dirname($file), 0755);
        }

        $fs->copy($this->source, $file, true);
    }
630659
public function setFile($file) {
        $f = $file;
        if (preg_match('#^compress\.(.*)://(.*)#', $file, $r)) {
            $f = $r[2];
        }
        if(is_readable($f)) {
            $open = fopen($file, "rb");
            $this->file = $open;
        } else {
            $this->handleError("{$file} is not readable.");
        }

	}
1268495
public static function createFromFile($file)
    {
        // If the file is not readable
        if (!is_readable($file)) {
            throw new InvalidArgumentException(
                sprintf(InvalidArgumentException::INVALID_FILE_STR, $file),
                InvalidArgumentException::INVALID_FILE
            );
        }

        return self::createFromString(file_get_contents($file));
    }
177612
public function save($file = null, $quality = 95): void
	{
		$file = $file ?? $this->image;

		// Mage sure that the file or directory is writable

		if(file_exists($file))
		{
			if(!is_writable($file))
			{
				throw new RuntimeException(vsprintf('The file [ %s ] isn\'t writable.', [$file]));
			}
		}
		else
		{
			$pathInfo = pathinfo($file);

			if(!is_writable($pathInfo['dirname']))
			{
				throw new RuntimeException(vsprintf('The directory [ %s ] isn\'t writable.', [$pathInfo['dirname']]));
			}
		}

		// Save the image

		$this->processor->save($file, $this->normalizeImageQuality($quality));
	}
299270
public function create($file = '')
    {
        $this->file   = $file;
        $this->memory = '';
        $this->fh     = 0;

        if ($this->file) {
            $this->fh = @fopen($this->file, 'wb');

            if (!$this->fh) {
                throw new ArchiveIOException('Could not open file for writing: '.$this->file);
            }
        }
        $this->writeaccess = true;
        $this->closed      = false;
        $this->ctrl_dir    = array();
    }
38580
public function init($file)
	{
		try {
			
			$this->load($file);

		} catch (Exceptions\FileNotExists $e) {

			$this->create($file);
		}
	}
191877
public function saveFile($data, $file)
    {
        $openfile = @fopen($file, "wb") or die("saveFile: Error opening file '{$file}'.");
        @fwrite($openfile, $data) or die("saveFile: Error writing data into file '{$file}'.");
        @fclose($openfile);
    }
250441
protected function write($content, $file)
    {
        if (file_exists($file)) { // Do not create a new file
            return file_put_contents($file, $content) !== false;
        }

        return false;
    }
1349374
protected function write($file, $value)
    {
        $key  = $file;
        $path = $this->getFilePath();

        if ( !file_exists($dir) )
        {
            mkdir($path, 0777, true);
        }

        $file = $this->getFileName($key);

        $value = serialize($value);
        $value = ($this->base64Encode) ? base64_encode($value) : $value;

        if ( !file_put_contents($file, $value) )
        {
            throw new FileCacheException('File write failure.');
        }

        if ( !chmod($file, 0777) )
        {
            throw new FileCacheException('Failed to set file permissions.');
        }

        if ( !touch($file, time() + $this->expireTime) )
        {
            throw new FileCacheException('Failed to change file time.');
        }

        static::$keys[$key] = true;

        return true;
    }
709440
protected function createFromUrl($file)
	{
		$ch = curl_init ($file);
		curl_setopt($ch, CURLOPT_HEADER, 0);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
		$rawFile = curl_exec($ch);
		curl_close ($ch);

		// Get the original name of the file
		$ori_name = pathinfo($file);
		$name = $ori_name['basename'];
		
		// Create a filepath for the file by storing it on disk.
		$filePath = sys_get_temp_dir() . "/$name";
		file_put_contents($filePath, $rawFile);

		return new File($filePath);
	}
1054408
public function setFile($file)
    {
        if (is_string($file)) {
            $file = new PhingFile($file);
        }
        $this->file = $file;
    }