PHP Class VCR\Storage\AbstractStorage

A Storage can be iterated using standard loops. New recordings can be stored.
Inheritance: implements VCR\Storage\Storage
Mostrar archivo Open project: php-vcr/php-vcr Class Usage Examples

Protected Properties

Property Type Description
$current Current parsed record.
$filePath Path to storage file.
$handle File handle.
$isEOF True when parser is at the end of the file.
$isNew If the cassette file is new.
$isValidPosition If the current position is valid.
$position Number of the current recording.

Public Methods

Method Description
__construct ( string $cassettePath, string $cassetteName, string $defaultContent = '[]' ) Creates a new file store.
__destruct ( ) Closes file handle.
current ( ) : array Returns the current record.
isNew ( ) : boolean Returns true if the file did not exist and had to be created.
key ( ) : integer Returns the current key.

Method Details

__construct() public method

If the cassetteName contains PATH_SEPARATORs, subfolders of the cassettePath are autocreated when not existing.
public __construct ( string $cassettePath, string $cassetteName, string $defaultContent = '[]' )
$cassettePath string Path to the cassette directory.
$cassetteName string Path to the cassette file, relative to the path.
$defaultContent string Default data for this cassette if its not existing

__destruct() public method

Closes file handle.
public __destruct ( )

current() public method

Returns the current record.
public current ( ) : array
return array Parsed current record.

isNew() public method

Returns true if the file did not exist and had to be created.
public isNew ( ) : boolean
return boolean TRUE if created, FALSE if not

key() public method

Returns the current key.
public key ( ) : integer
return integer

Property Details

$current protected_oe property

Current parsed record.
protected $current

$filePath protected_oe property

Path to storage file.
protected $filePath

$handle protected_oe property

File handle.
protected $handle

$isEOF protected_oe property

True when parser is at the end of the file.
protected $isEOF

$isNew protected_oe property

If the cassette file is new.
protected $isNew

$isValidPosition protected_oe property

If the current position is valid.
protected $isValidPosition

$position protected_oe property

Number of the current recording.
protected $position