PHP Class VCR\LibraryHooks\StreamWrapperHook

Inheritance: implements VCR\LibraryHooks\LibraryHook
Mostrar archivo Open project: php-vcr/php-vcr Class Usage Examples

Public Properties

Property Type Description
$context Current stream context.

Protected Properties

Property Type Description
$position Position in the current response body.
$requestCallback Callback which will be executed when a request is intercepted.
$response VCR\Response
$status Current status of this hook, either enabled or disabled.

Public Methods

Method Description
disable ( )
enable ( Closure $requestCallback )
isEnabled ( )
stream_eof ( ) : boolean Tests for end-of-file on a file pointer.
stream_metadata ( string $path, integer $option, mixed $var ) : boolean Change stream options.
stream_open ( string $path, string $mode, integer $options, string &$opened_path ) : boolean This method is called immediately after the wrapper is initialized (f.e. by fopen() and file_get_contents()).
stream_read ( integer $count ) : string Read from stream.
stream_seek ( integer $offset, integer $whence ) : boolean Seeks to specific location in a stream.
stream_stat ( ) : array Retrieve information about a file resource.
stream_tell ( ) : integer Retrieve the current position of a stream.
stream_write ( string $data ) : integer Write to stream.
url_stat ( $path, $flags ) : array Retrieve information about a file resource.

Method Details

disable() public method

public disable ( )

enable() public method

public enable ( Closure $requestCallback )
$requestCallback Closure

isEnabled() public method

public isEnabled ( )

stream_eof() public method

Tests for end-of-file on a file pointer.
public stream_eof ( ) : boolean
return boolean Should return TRUE if the read/write position is at the end of the stream and if no more data is available to be read, or FALSE otherwise.

stream_metadata() public method

Change stream options.
public stream_metadata ( string $path, integer $option, mixed $var ) : boolean
$path string The file path or URL to set metadata.
$option integer One of the stream options.
$var mixed Value depending on the option.
return boolean Returns TRUE on success or FALSE on failure.

stream_open() public method

This method is called immediately after the wrapper is initialized (f.e. by fopen() and file_get_contents()).
public stream_open ( string $path, string $mode, integer $options, string &$opened_path ) : boolean
$path string Specifies the URL that was passed to the original function.
$mode string The mode used to open the file, as detailed for fopen().
$options integer Holds additional flags set by the streams API.
$opened_path string If the path is opened successfully, and STREAM_USE_PATH is set.
return boolean Returns TRUE on success or FALSE on failure.

stream_read() public method

Read from stream.
public stream_read ( integer $count ) : string
$count integer How many bytes of data from the current position should be returned.
return string If there are less than count bytes available, return as many as are available. If no more data is available, return either FALSE or an empty string.

stream_seek() public method

Seeks to specific location in a stream.
public stream_seek ( integer $offset, integer $whence ) : boolean
$offset integer The stream offset to seek to.
$whence integer Possible values: SEEK_SET - Set position equal to offset bytes. SEEK_CUR - Set position to current location plus offset. SEEK_END - Set position to end-of-file plus offset.
return boolean Return TRUE if the position was updated, FALSE otherwise.

stream_stat() public method

Retrieve information about a file resource.
public stream_stat ( ) : array
return array See stat().

stream_tell() public method

This method is called in response to fseek() to determine the current position.
public stream_tell ( ) : integer
return integer Should return the current position of the stream.

stream_write() public method

Write to stream.
public stream_write ( string $data ) : integer
$data string Should be stored into the underlying stream.
return integer

url_stat() public method

Retrieve information about a file resource.
public url_stat ( $path, $flags ) : array
return array See stat().

Property Details

$context public_oe property

Current stream context.
public $context

$position protected_oe property

Position in the current response body.
protected $position

$requestCallback protected_oe static_oe property

Callback which will be executed when a request is intercepted.
protected static $requestCallback

$response protected_oe property

protected Response,VCR $response
return VCR\Response

$status protected_oe property

Current status of this hook, either enabled or disabled.
protected $status