/** * {@inheritDoc} */ public function open(StreamMode $mode) { $fileHandle = fopen($this->path, $mode->getMode()); if (false === $fileHandle) { return false; } $this->mode = $mode; $this->fileHandle = $fileHandle; return true; }
/** * {@inheritDoc} */ public function open(StreamMode $mode) { $fileHandle = @fopen($this->path, $mode->getMode()); if (false === $fileHandle) { throw new \RuntimeException(sprintf('File "%s" cannot be opened', $this->path)); } $this->mode = $mode; $this->fileHandle = $fileHandle; return true; }
/** * {@inheritdoc} */ public function open(StreamMode $mode) { $baseDirPath = \Gaufrette\Util\Path::dirname($this->path); if ($mode->allowsWrite() && !is_dir($baseDirPath)) { @mkdir($baseDirPath, 0755, true); } try { $fileHandle = @fopen($this->path, $mode->getMode()); } catch (\Exception $e) { $fileHandle = false; } if (false === $fileHandle) { throw new \RuntimeException(sprintf('File "%s" cannot be opened', $this->path)); } $this->mode = $mode; $this->fileHandle = $fileHandle; return true; }