setBucket() public method

Set the Swivel Bucket.
See also: Zumba\Swivel\ManagerInterface
public setBucket ( Zumba\Swivel\BucketInterface $bucket = null ) : Zumba\Swivel\ManagerInterface
$bucket Zumba\Swivel\BucketInterface
return Zumba\Swivel\ManagerInterface
Beispiel #1
0
 public function testSetBucketReturnsManager()
 {
     $manager = new Manager(new Config());
     $map = $this->getMock('Zumba\\Swivel\\Map');
     $bucket = $this->getMock('Zumba\\Swivel\\Bucket', null, [$map]);
     $this->assertInstanceOf('Zumba\\Swivel\\Manager', $manager->setBucket($bucket));
 }
Beispiel #2
0
 /**
  * Used to set the bucket index before loading swivel.
  *
  * @param integer $index Number between 1 and 10
  * @return void
  * @throws InvalidArgumentException if $index is not valid
  */
 public function setBucketIndex($index)
 {
     if (!is_numeric($index) || $index < 1 || $index > 10) {
         throw new InvalidArgumentException("{$index} is not a valid bucket index.");
     }
     if (empty($this->manager)) {
         $this->options['BucketIndex'] = $index;
     } else {
         $config = $this->getConfig();
         $config->setBucketIndex($index);
         $this->manager->setBucket($config->getBucket());
     }
 }