/** * Opens file or URL * * @param string $path * @param string $mode * @param int $options * @param string $opened_path * * @return bool */ public function stream_open($path, $mode, $options, &$opened_path) { $this->openFile($path); if (!$this->stream) { $this->stream = $this->file->getStream(); $mode = new StreamMode($mode); if ($this->stream->open($mode)) { if ($options & STREAM_USE_PATH) { $opened_path = $path; } return true; } return false; } return true; }
public static function streamCopy(File $source, File $target) { $sourceStream = $source->getStream(); $sourceStream->open(new StreamMode('rb')); $targetStream = $target->getStream(); $targetStream->open(new StreamMode('wb')); return (bool) stream_copy_to_stream($sourceStream->getRessource(), $targetStream->getRessource()); }