PHP Class Zumba\Swivel\Bucket

Inheritance: implements Zumba\Swivel\BucketInterface, use trait Psr\Log\LoggerAwareTrait
Show file Open project: zumba/swivel Class Usage Examples

Protected Properties

Property Type Description
$callback callable Callback to handle a missing slug from Map
$featureMap Zumba\Swivel\MapInterface The feature map.
$index The user's index.

Public Methods

Method Description
__construct ( Zumba\Swivel\MapInterface $featureMap, integer | null $index = null, Psr\Log\LoggerInterface $logger = null, callable $callback = null ) Zumba\Swivel\Bucket.
enabled ( Zumba\Swivel\BehaviorInterface $behavior ) : boolean Check if a behavior is enabled for a particular context/bucket combination.
getIndex ( ) : integer Get the bucket index.

Protected Methods

Method Description
randomIndex ( ) : integer Get a random index.

Method Details

__construct() public method

Zumba\Swivel\Bucket.
public __construct ( Zumba\Swivel\MapInterface $featureMap, integer | null $index = null, Psr\Log\LoggerInterface $logger = null, callable $callback = null )
$featureMap Zumba\Swivel\MapInterface
$index integer | null
$logger Psr\Log\LoggerInterface
$callback callable

enabled() public method

Check if a behavior is enabled for a particular context/bucket combination.
See also: Zumba\Swivel\BucketInterface
public enabled ( Zumba\Swivel\BehaviorInterface $behavior ) : boolean
$behavior Zumba\Swivel\BehaviorInterface
return boolean

getIndex() public method

Useful for metrics.
public getIndex ( ) : integer
return integer

randomIndex() protected method

Get a random index.
protected randomIndex ( ) : integer
return integer

Property Details

$callback protected property

Callback to handle a missing slug from Map
protected callable $callback
return callable

$featureMap protected property

The feature map.
protected MapInterface,Zumba\Swivel $featureMap
return Zumba\Swivel\MapInterface

$index protected property

The user's index.
protected $index