turnTypeWillChange] public function stream_flush() { return fflush($this->handle); } /** * @return int|false */ #[\ReturnTypeWillChange] public function stream_tell() { return ftell($this->handle); } /** * @return array */ #[\ReturnTypeWillChange] public function stream_stat() { return fstat($this->handle) ?: []; } /** * @param int $option * @param int $arg1 * @param int $arg2 * @return bool|int */ #[\ReturnTypeWillChange] public function stream_set_option($option, $arg1, $arg2) { switch ($option) { case STREAM_OPTION_BLOCKING: return stream_set_blocking($this->handle, (bool)$arg1); case STREAM_OPTION_READ_TIMEOUT: return stream_set_timeout($this->handle, $arg1, $arg2); case STREAM_OPTION_WRITE_BUFFER: return stream_set_write_buffer($this->handle, $arg2); default: return false; } } /** * @param string $uri * @return bool */ #[\ReturnTypeWillChange] public function unlink($uri) { $path = $this->getPath($uri); if (!$path) { return false; } return unlink($path); } /** * @param string $fromUri * @param string $toUri * @return bool */ #[\ReturnTypeWillChange] public function rename($fromUri, $toUri) { $fromPath = $this->getPath($fromUri); $toPath = $this->getPath($toUri, 'w'); if (!$fromPath || !$toPath) { return false; } if (static::$locator instanceof UniformResourceLocator) { static::$locator->clearCache($fromUri); static::$locator->clearCache($toUri); } return rename($fromPath, $toPath); } /** * @param string $uri * @param int $mode * @param int $options * @return bool */ #[\ReturnTypeWillChange] public function mkdir($uri, $mode, $options) { $recursive = (bool) ($options & STREAM_MKDIR_RECURSIVE); $path = $this->getPath($uri, $recursive ? 'd' : 'w'); if (!$path) { if ($options & STREAM_REPORT_ERRORS) { trigger_error(sprintf('mkdir(): Could not create directory for %s', $uri), E_USER_WARNING); } return false; } if (static::$locator instanceof UniformResourceLocator) { static::$locator->clearCache($uri); } return ($options & STREAM_REPORT_ERRORS) ? mkdir($path, $mode, $recursive) : @mkdir($path, $mode, $recursive); } /** * @param string $uri * @param int $options * @return bool */ #[\ReturnTypeWillChange] public function rmdir($uri, $options) { $path = $this->getPath($uri); if (!$path) { if ($options & STREAM_REPORT_ERRORS) { trigger_error(sprintf('rmdir(): Directory not found for %s', $uri), E_USER_WARNING); } return false; } if (static::$locator instanceof UniformResourceLocator) { static::$locator->clearCache($uri); } return ($options & STREAM_REPORT_ERRORS) ? rmdir($path) : @rmdir($path); } /** * @param string $uri * @param int $flags * @return array|false */ #[\ReturnTypeWillChange] public function url_stat($uri, $flags) { $path = $this->getPath($uri); if (!$path) { return false; } // Suppress warnings if requested or if the file or directory does not // exist. This is consistent with PHPs plain filesystem stream wrapper. return ($flags & STREAM_URL_STAT_QUIET || !file_exists($path)) ? @stat($path) : stat($path); } /** * @param string $uri * @param int $options * @return bool */ #[\ReturnTypeWillChange] public function dir_opendir($uri, $options) { $path = $this->getPath($uri); if ($path === false) { return false; } $this->uri = $uri; $handle = opendir($path); if ($handle) { $this->handle = $handle; return true; } return false; } /** * @return string|false */ #[\ReturnTypeWillChange] public function dir_readdir() { return readdir($this->handle); } /** * @return bool */ #[\ReturnTypeWillChange] public function dir_rewinddir() { rewinddir($this->handle); return true; } /** * @return bool */ #[\ReturnTypeWillChange] public function dir_closedir() { closedir($this->handle); return true; } /** * @param string $uri * @param string|null $mode * @return string|false */ protected function getPath($uri, $mode = null) { if ($mode === null) { $mode = 'r'; } $path = $this->findPath($uri); if ($path && file_exists($path)) { return $path; } if (strpos($mode[0], 'r') === 0) { return false; } // We are either opening a file or creating directory. list($scheme, $target) = explode('://', $uri, 2); if ($target === '') { return false; } $target = explode('/', $target); $filename = []; do { $filename[] = array_pop($target); $path = $this->findPath($scheme . '://' . implode('/', $target)); } while ($target && !$path); if (!$path) { return false; } return $path . '/' . implode('/', array_reverse($filename)); } /** * @param string $uri * @return string|false */ protected function findPath($uri) { return static::$locator && static::$locator->isStream($uri) ? static::$locator->findResource($uri) : false; } }
You may not be able to visit this page because of:
Please try one of the following pages:
If difficulties persist, please contact the System Administrator of this site and report the error below.
Class 'RocketTheme\Toolbox\StreamWrapper\Stream' not found