PHP Class VCR\Configuration

Those configuration options might be: - which LibraryHook to use, - where to store cassettes or - which files to scan when filtering source code.
Show file Open project: php-vcr/php-vcr Class Usage Examples

Public Methods

Method Description
addRequestMatcher ( string $name, callable $callback ) : Configuration Adds a new RequestMatcher callback.
enableLibraryHooks ( string | string[] $hooks ) : Configuration Enables specified LibraryHook(s) by its name.
enableRequestMatchers ( array $matchers ) : Configuration Enables specified RequestMatchers by its name.
getBlackList ( ) : array Returns the current blacklist.
getCassettePath ( ) : string Returns the path to where cassettes are stored.
getLibraryHooks ( ) : string[] Returns a list of enabled LibraryHook class names.
getMode ( ) : string Returns the current mode.
getRequestMatchers ( ) : array Returns a list of enabled RequestMatcher callbacks.
getStorage ( ) : string Returns the class name of the storage to use.
getWhiteList ( ) : array Returns a list of whitelisted paths.
setBlackList ( string | string[] $paths ) : Configuration Sets one or more paths to blacklist.
setCassettePath ( string $cassettePath ) : Configuration Sets the cassette path where a cassettes should be stored in.
setMode ( string $mode ) : Configuration Sets the current mode.
setStorage ( string $storageName ) Enables a storage by name.
setWhiteList ( string | array $paths ) : Configuration Sets a list of paths to whitelist when processing in the StreamProcessor.

Private Methods

Method Description
assertValidCassettePath ( string $cassettePath ) Validates a specified cassette path.

Method Details

addRequestMatcher() public method

Adds a new RequestMatcher callback.
public addRequestMatcher ( string $name, callable $callback ) : Configuration
$name string Name of the RequestMatcher.
$callback callable A callback taking two Request objects as parameters and returns true if those match.
return Configuration

enableLibraryHooks() public method

Enables specified LibraryHook(s) by its name.
public enableLibraryHooks ( string | string[] $hooks ) : Configuration
$hooks string | string[] Name of the LibraryHook(s) to enable.
return Configuration

enableRequestMatchers() public method

Enables specified RequestMatchers by its name.
public enableRequestMatchers ( array $matchers ) : Configuration
$matchers array List of RequestMatcher names to enable.
return Configuration

getBlackList() public method

Returns the current blacklist.
public getBlackList ( ) : array
return array

getCassettePath() public method

Returns the path to where cassettes are stored.
public getCassettePath ( ) : string
return string Path to where cassettes are stored.

getLibraryHooks() public method

Only class names are returned, any object creation happens in the VCRFactory.
public getLibraryHooks ( ) : string[]
return string[] List of LibraryHook class names.

getMode() public method

Returns the current mode.
public getMode ( ) : string
return string

getRequestMatchers() public method

Returns a list of enabled RequestMatcher callbacks.
public getRequestMatchers ( ) : array
return array List of enabled RequestMatcher callbacks.

getStorage() public method

Objects are created in the VCRFactory.
public getStorage ( ) : string
return string Class name of the storage to use.

getWhiteList() public method

Returns a list of whitelisted paths.
public getWhiteList ( ) : array
return array

setBlackList() public method

Sets one or more paths to blacklist.
public setBlackList ( string | string[] $paths ) : Configuration
$paths string | string[] Path(s) to blacklist.
return Configuration

setCassettePath() public method

Sets the cassette path where a cassettes should be stored in.
public setCassettePath ( string $cassettePath ) : Configuration
$cassettePath string Path where to store cassettes.
return Configuration

setMode() public method

Sets the current mode.
public setMode ( string $mode ) : Configuration
$mode string The mode to set VCR to
return Configuration

setStorage() public method

Enables a storage by name.
public setStorage ( string $storageName )
$storageName string Name of the storage to enable.

setWhiteList() public method

Sets a list of paths to whitelist when processing in the StreamProcessor.
public setWhiteList ( string | array $paths ) : Configuration
$paths string | array Single path or list of path which are whitelisted.
return Configuration