PHP 클래스 VCR\Videorecorder

If turned on, a videorecorder will intercept HTTP requests using hooks into libraries like cUrl, SOAP and streamWrappers. Requests and responses will be recorded on a inserted cassette. If a request is already recorded on a cassette the videorecorder will play back its response and not issue a HTTP request. If turned off, HTTP requests won't be intercepted and will hit their original servers.
저자: Adrian Philipp ([email protected])
파일 보기 프로젝트 열기: php-vcr/php-vcr 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$cassette Cassette on which to store requests and responses.
$client Client to use to issue HTTP requests.
$config Config options like which library hooks to use.
$eventDispatcher Symfony\Component\EventDispatcher\EventDispatcherInterface
$factory Factory which can create instances and resolve dependencies.
$isOn Flag if this videorecorder is turned on or not.

공개 메소드들

메소드 설명
__construct ( Configuration $config, VCR\Util\HttpClient $client, vcr\VCRFactory $factory ) Creates a videorecorder instance.
__destruct ( ) Turns off this videorecorder when instance is destroyed.
configure ( ) : Configuration Returns the current Configuration for this videorecorder.
eject ( ) : void Eject the currently inserted cassette.
getEventDispatcher ( ) : Symfony\Component\EventDispatcher\EventDispatcherInterface
handleRequest ( Request $request ) : Response Records, sends or plays back a intercepted request.
insertCassette ( string $cassetteName ) : void Inserts a cassette to record responses and requests on.
setEventDispatcher ( Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher )
turnOff ( ) : void Turns off this videorecorder.
turnOn ( ) : void Turns on this videorecorder.

보호된 메소드들

메소드 설명
disableLibraryHooks ( ) : void Disables all library hooks.
enableLibraryHooks ( ) : void Enables configured library hooks.

비공개 메소드들

메소드 설명
dispatch ( string $eventName, Symfony\Component\EventDispatcher\Event $event = null ) : Symfony\Component\EventDispatcher\Event Dispatches an event to all registered listeners.

메소드 상세

__construct() 공개 메소드

Creates a videorecorder instance.
public __construct ( Configuration $config, VCR\Util\HttpClient $client, vcr\VCRFactory $factory )
$config Configuration Config options like which library hooks to use.
$client VCR\Util\HttpClient Client which is used to issue HTTP requests.
$factory vcr\VCRFactory Factory which can create instances and resolve dependencies.

__destruct() 공개 메소드

Turns off this videorecorder when instance is destroyed.
public __destruct ( )

configure() 공개 메소드

Returns the current Configuration for this videorecorder.
public configure ( ) : Configuration
리턴 Configuration Configuration for this videorecorder.

disableLibraryHooks() 보호된 메소드

Disables all library hooks.
protected disableLibraryHooks ( ) : void
리턴 void

eject() 공개 메소드

Recording and playing back requests won't be possible after ejecting.
public eject ( ) : void
리턴 void

enableLibraryHooks() 보호된 메소드

Enables configured library hooks.
protected enableLibraryHooks ( ) : void
리턴 void

getEventDispatcher() 공개 메소드

public getEventDispatcher ( ) : Symfony\Component\EventDispatcher\EventDispatcherInterface
리턴 Symfony\Component\EventDispatcher\EventDispatcherInterface

handleRequest() 공개 메소드

If a request was already recorded on a cassette it's response is returned, otherwise the request is issued and it's response recorded (and returned).
public handleRequest ( Request $request ) : Response
$request Request Intercepted request.
리턴 Response Response for the intercepted request.

insertCassette() 공개 메소드

Inserts a cassette to record responses and requests on.
public insertCassette ( string $cassetteName ) : void
$cassetteName string Name of the cassette (used for the cassette filename).
리턴 void

setEventDispatcher() 공개 메소드

public setEventDispatcher ( Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher )
$dispatcher Symfony\Component\EventDispatcher\EventDispatcherInterface

turnOff() 공개 메소드

Library hooks will be disabled and cassettes ejected.
public turnOff ( ) : void
리턴 void

turnOn() 공개 메소드

This enables configured library hooks.
public turnOn ( ) : void
리턴 void

프로퍼티 상세

$cassette 보호되어 있는 프로퍼티

Cassette on which to store requests and responses.
protected $cassette

$client 보호되어 있는 프로퍼티

Client to use to issue HTTP requests.
protected $client

$config 보호되어 있는 프로퍼티

Config options like which library hooks to use.
protected $config

$eventDispatcher 보호되어 있는 프로퍼티

protected EventDispatcherInterface,Symfony\Component\EventDispatcher $eventDispatcher
리턴 Symfony\Component\EventDispatcher\EventDispatcherInterface

$factory 보호되어 있는 프로퍼티

Factory which can create instances and resolve dependencies.
protected $factory

$isOn 보호되어 있는 프로퍼티

Flag if this videorecorder is turned on or not.
protected $isOn