0 follower

Final Class Yiisoft\Yii\Debug\Helper\StreamWrapper\StreamWrapper

InheritanceYiisoft\Yii\Debug\Helper\StreamWrapper\StreamWrapper
ImplementsYiisoft\Yii\Debug\Helper\StreamWrapper\StreamWrapperInterface

Public Methods

Hide inherited methods

Method Description Defined By
dir_closedir() Yiisoft\Yii\Debug\Helper\StreamWrapper\StreamWrapper
dir_opendir() Yiisoft\Yii\Debug\Helper\StreamWrapper\StreamWrapper
dir_readdir() Yiisoft\Yii\Debug\Helper\StreamWrapper\StreamWrapper
dir_rewinddir() Yiisoft\Yii\Debug\Helper\StreamWrapper\StreamWrapper
mkdir() Yiisoft\Yii\Debug\Helper\StreamWrapper\StreamWrapper
rename() Yiisoft\Yii\Debug\Helper\StreamWrapper\StreamWrapper
rmdir() Yiisoft\Yii\Debug\Helper\StreamWrapper\StreamWrapper
stream_cast() Yiisoft\Yii\Debug\Helper\StreamWrapper\StreamWrapper
stream_close() Yiisoft\Yii\Debug\Helper\StreamWrapper\StreamWrapper
stream_eof() Yiisoft\Yii\Debug\Helper\StreamWrapper\StreamWrapper
stream_flush() Yiisoft\Yii\Debug\Helper\StreamWrapper\StreamWrapper
stream_lock() Yiisoft\Yii\Debug\Helper\StreamWrapper\StreamWrapper
stream_metadata() Yiisoft\Yii\Debug\Helper\StreamWrapper\StreamWrapper
stream_open() Yiisoft\Yii\Debug\Helper\StreamWrapper\StreamWrapper
stream_read() Yiisoft\Yii\Debug\Helper\StreamWrapper\StreamWrapper
stream_seek() Yiisoft\Yii\Debug\Helper\StreamWrapper\StreamWrapper
stream_set_option() Yiisoft\Yii\Debug\Helper\StreamWrapper\StreamWrapper
stream_stat() Yiisoft\Yii\Debug\Helper\StreamWrapper\StreamWrapper
stream_tell() Yiisoft\Yii\Debug\Helper\StreamWrapper\StreamWrapper
stream_truncate() Yiisoft\Yii\Debug\Helper\StreamWrapper\StreamWrapper
stream_write() Yiisoft\Yii\Debug\Helper\StreamWrapper\StreamWrapper
unlink() Yiisoft\Yii\Debug\Helper\StreamWrapper\StreamWrapper
url_stat() Yiisoft\Yii\Debug\Helper\StreamWrapper\StreamWrapper

Constants

Hide inherited constants

Constant Value Description Defined By
STREAM_OPEN_FOR_INCLUDE 128 Yiisoft\Yii\Debug\Helper\StreamWrapper\StreamWrapper

Property Details

Hide inherited properties

$context public property
public resource|null $context null
$filename public property
public string|null $filename null
$stream public property
public resource|null $stream null

Method Details

Hide inherited methods

dir_closedir() public method

public boolean dir_closedir ( )

                public function dir_closedir(): bool
{
    /**
     * @psalm-suppress PossiblyNullArgument
     */
    closedir($this->stream);
    /**
     * @psalm-suppress RedundantCondition
     */
    return is_resource($this->stream);
}

            
dir_opendir() public method

public boolean dir_opendir ( string $path, integer $options )
$path string
$options integer

                public function dir_opendir(string $path, int $options): bool
{
    $this->filename = $path;
    /**
     * @psalm-suppress PossiblyNullArgument
     */
    $this->stream = opendir($path, $this->context);
    return is_resource($this->stream);
}

            
dir_readdir() public method

public false|string dir_readdir ( )

                public function dir_readdir(): false|string
{
    /**
     * @psalm-suppress PossiblyNullArgument
     */
    return readdir($this->stream);
}

            
dir_rewinddir() public method

public boolean dir_rewinddir ( )

                public function dir_rewinddir(): bool
{
    if (!is_resource($this->stream)) {
        return false;
    }
    rewinddir($this->stream);
    /**
     * @noinspection PhpConditionAlreadyCheckedInspection
     * @psalm-suppress RedundantCondition
     */
    return is_resource($this->stream);
}

            
mkdir() public method

public boolean mkdir ( string $path, integer $mode, integer $options )
$path string
$mode integer
$options integer

                public function mkdir(string $path, int $mode, int $options): bool
{
    $this->filename = $path;
    /**
     * @psalm-suppress PossiblyNullArgument
     */
    return mkdir($path, $mode, ($options & STREAM_MKDIR_RECURSIVE) === STREAM_MKDIR_RECURSIVE, $this->context);
}

            
rename() public method

public boolean rename ( string $path_from, string $path_to )
$path_from string
$path_to string

                public function rename(string $path_from, string $path_to): bool
{
    /**
     * @psalm-suppress PossiblyNullArgument
     */
    return rename($path_from, $path_to, $this->context);
}

            
rmdir() public method

public boolean rmdir ( string $path, integer $options )
$path string
$options integer

                public function rmdir(string $path, int $options): bool
{
    /**
     * @psalm-suppress PossiblyNullArgument
     */
    return rmdir($path, $this->context);
}

            
stream_cast() public method

public void stream_cast ( integer $castAs )
$castAs integer

                public function stream_cast(int $castAs): void
{
    // ???
}

            
stream_close() public method

public void stream_close ( )

                public function stream_close(): void
{
    /**
     * @psalm-suppress InvalidPropertyAssignmentValue
     */
    if ($this->stream !== null) {
        fclose($this->stream);
    }
    $this->stream = null;
}

            
stream_eof() public method

public boolean stream_eof ( )

                public function stream_eof(): bool
{
    /**
     * @psalm-suppress PossiblyNullArgument
     */
    return feof($this->stream);
}

            
stream_flush() public method

public boolean stream_flush ( )

                public function stream_flush(): bool
{
    /**
     * @psalm-suppress PossiblyNullArgument
     */
    return fflush($this->stream);
}

            
stream_lock() public method

public boolean stream_lock ( integer $operation )
$operation integer

                public function stream_lock(int $operation): bool
{
    if ($operation === 0) {
        $operation = LOCK_EX;
    }
    /**
     * @psalm-suppress PossiblyNullArgument
     */
    return flock($this->stream, $operation);
}

            
stream_metadata() public method

public boolean stream_metadata ( string $path, integer $option, mixed $value )
$path string
$option integer
$value mixed

                public function stream_metadata(string $path, int $option, mixed $value): bool
{
    /** @psalm-suppress MixedArgument */
    return match ($option) {
        STREAM_META_TOUCH => touch($path, ...$value),
        STREAM_META_OWNER_NAME, STREAM_META_OWNER => chown($path, $value),
        STREAM_META_GROUP_NAME, STREAM_META_GROUP => chgrp($path, $value),
        STREAM_META_ACCESS => chmod($path, $value),
        default => false
    };
}

            
stream_open() public method

public boolean stream_open ( string $path, string $mode, integer $options, string|null &$opened_path )
$path string
$mode string
$options integer
$opened_path string|null

                public function stream_open(string $path, string $mode, int $options, ?string &$opened_path): bool
{
    $this->filename = realpath($path) ?: $path;
    if ((self::STREAM_OPEN_FOR_INCLUDE & $options) === self::STREAM_OPEN_FOR_INCLUDE && function_exists(
        'opcache_invalidate'
    )) {
        opcache_invalidate($path, false);
    }
    $this->stream = fopen(
        $path,
        $mode,
        ($options & STREAM_USE_PATH) === STREAM_USE_PATH,
        (self::STREAM_OPEN_FOR_INCLUDE & $options) === self::STREAM_OPEN_FOR_INCLUDE ? null : $this->context
    );
    if (!is_resource($this->stream)) {
        return false;
    }
    if ($opened_path !== null) {
        $metaData = stream_get_meta_data($this->stream);
        $opened_path = $metaData['uri'];
    }
    return true;
}

            
stream_read() public method

public string|false stream_read ( integer $count )
$count integer

                public function stream_read(int $count): string|false
{
    /**
     * @psalm-suppress PossiblyNullArgument
     */
    return fread($this->stream, $count);
}

            
stream_seek() public method

public boolean stream_seek ( integer $offset, integer $whence SEEK_SET )
$offset integer
$whence integer

                public function stream_seek(int $offset, int $whence = SEEK_SET): bool
{
    /**
     * @psalm-suppress PossiblyNullArgument
     */
    return fseek($this->stream, $offset, $whence) !== -1;
}

            
stream_set_option() public method

public boolean stream_set_option ( integer $option, integer $arg1, integer $arg2 )
$option integer
$arg1 integer
$arg2 integer

                public function stream_set_option(int $option, int $arg1, int $arg2): bool
{
    /**
     * @psalm-suppress PossiblyNullArgument
     */
    return match ($option) {
        STREAM_OPTION_BLOCKING => stream_set_blocking($this->stream, $arg1 === STREAM_OPTION_BLOCKING),
        STREAM_OPTION_READ_TIMEOUT => stream_set_timeout($this->stream, $arg1, $arg2),
        STREAM_OPTION_WRITE_BUFFER => stream_set_write_buffer($this->stream, $arg2) === 0,
        default => false,
    };
}

            
stream_stat() public method

public array|false stream_stat ( )

                public function stream_stat(): array|false
{
    /**
     * @psalm-suppress PossiblyNullArgument
     */
    return fstat($this->stream);
}

            
stream_tell() public method

public integer stream_tell ( )

                public function stream_tell(): int
{
    /**
     * @psalm-suppress PossiblyNullArgument
     */
    return ftell($this->stream);
}

            
stream_truncate() public method

public boolean stream_truncate ( integer $new_size )
$new_size integer

                public function stream_truncate(int $new_size): bool
{
    /**
     * @psalm-suppress PossiblyNullArgument
     */
    return ftruncate($this->stream, $new_size);
}

            
stream_write() public method

public integer stream_write ( string $data )
$data string

                public function stream_write(string $data): int
{
    /**
     * @psalm-suppress PossiblyNullArgument
     */
    return fwrite($this->stream, $data);
}

            
unlink() public method

public boolean unlink ( string $path )
$path string

url_stat() public method

public array|false url_stat ( string $path, integer $flags )
$path string
$flags integer

                public function url_stat(string $path, int $flags): array|false
{
    try {
        if (($flags & STREAM_URL_STAT_QUIET) === STREAM_URL_STAT_QUIET) {
            return @stat($path);
        }
        return stat($path);
    } catch (Throwable $e) {
        if (($flags & STREAM_URL_STAT_QUIET) === STREAM_URL_STAT_QUIET) {
            return false;
        }
        trigger_error($e->getMessage(), E_USER_ERROR);
    }
}