PHP 클래스 Namshi\AB\Test

상속: implements Countabl\Countable
파일 보기 프로젝트 열기: namshi/ab 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$hasRun
$isEnabled
$name
$parameters
$seed
$variation
$variations

공개 메소드들

메소드 설명
__construct ( string $name, array $variations = [], array $parameters = [] ) Creates a test with the given $name and the specified $variations.
count ( ) : integer Returns how many variations the test contains.
disable ( ) Disables the test: this is useful when, for example, you want to exclude this test to run for specific request (for example, bots).
get ( string $parameter ) : mixed Returns a test's parameter.
getName ( ) : string Returns the name of the test.
getParameters ( ) : array Gets the parameters for this test.
getSeed ( ) : integer Gets the seed for this test.
getVariation ( ) : string Returns the variation of this test.
getVariations ( ) : array Returns the variations of this test.
hasRun ( boolean $ran = null ) : boolean Checks whether the test has run or not.
isDisabled ( ) : boolean Checks whether the test is disabled or not.
isEnabled ( ) : boolean Checks whether the test is enabled or not.
run ( ) Runs the test.
set ( string $parameter, mixed $value ) Returns a test's parameter.
setName ( string $name ) Sets the test's $name.
setParameters ( array $parameters ) Sets the parameters for this test.
setSeed ( integer $seed ) Sets the seed for this test.
setVariations ( array $variations ) Sets the $variations of this test.

보호된 메소드들

메소드 설명
calculateVariation ( ) Calculates the variation of this test.
validateVariations ( array $variations ) Validates an array of variations.

메소드 상세

__construct() 공개 메소드

Variations must have an absolute value, not a percentage; for example, - a: 100 - b: 100 means that both variations have 50% of probability.
public __construct ( string $name, array $variations = [], array $parameters = [] )
$name string
$variations array
$parameters array

calculateVariation() 보호된 메소드

Calculates the variation of this test.
protected calculateVariation ( )

count() 공개 메소드

Returns how many variations the test contains.
public count ( ) : integer
리턴 integer

disable() 공개 메소드

Disables the test: this is useful when, for example, you want to exclude this test to run for specific request (for example, bots).
public disable ( )

get() 공개 메소드

Returns a test's parameter.
public get ( string $parameter ) : mixed
$parameter string
리턴 mixed

getName() 공개 메소드

Returns the name of the test.
public getName ( ) : string
리턴 string

getParameters() 공개 메소드

Gets the parameters for this test.
public getParameters ( ) : array
리턴 array

getSeed() 공개 메소드

Gets the seed for this test.
public getSeed ( ) : integer
리턴 integer

getVariation() 공개 메소드

You must run the test before getting the variation, else a BadMethodCallException is thrown. If the test is disabled, the first variation will always be returned, even if its odd is set to 0.
public getVariation ( ) : string
리턴 string

getVariations() 공개 메소드

Returns the variations of this test.
public getVariations ( ) : array
리턴 array

hasRun() 공개 메소드

Checks whether the test has run or not.
public hasRun ( boolean $ran = null ) : boolean
$ran boolean
리턴 boolean

isDisabled() 공개 메소드

Checks whether the test is disabled or not.
public isDisabled ( ) : boolean
리턴 boolean

isEnabled() 공개 메소드

Checks whether the test is enabled or not.
public isEnabled ( ) : boolean
리턴 boolean

run() 공개 메소드

Runs the test.
public run ( )

set() 공개 메소드

Returns a test's parameter.
public set ( string $parameter, mixed $value )
$parameter string
$value mixed

setName() 공개 메소드

Sets the test's $name.
public setName ( string $name )
$name string

setParameters() 공개 메소드

Sets the parameters for this test.
public setParameters ( array $parameters )
$parameters array

setSeed() 공개 메소드

Sets the seed for this test.
public setSeed ( integer $seed )
$seed integer

setVariations() 공개 메소드

Sets the $variations of this test.
public setVariations ( array $variations )
$variations array

validateVariations() 보호된 메소드

All the variations must have an integer value.
protected validateVariations ( array $variations )
$variations array

프로퍼티 상세

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

protected $hasRun

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

protected $isEnabled

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

protected $name

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

protected $parameters

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

protected $seed

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

protected $variation

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

protected $variations