public function set($name, $rotator, array $options = array())
 {
     if (!$rotator instanceof RotatorInterface) {
         $rotator = $this->factory->create($rotator, $options);
     }
     $this->rotators[$name] = $rotator;
     return $this;
 }
Example #2
0
 /**
  * @param $source
  * @param array $options
  * @param null $prefix
  * @param bool|false $addCircularGuard
  * @return $this
  *
  * Add a new key source either an instance of the interface or a name and options. i nal cases a prefix can
  * be given and a boollean stating if they hsould be wrapped in a circular guard
  */
 public function add($source, array $options = array(), $prefix = null, $addCircularGuard = false)
 {
     if (!$source instanceof SourceInterface) {
         if (!$prefix && $prefix !== false) {
             $prefix = $source;
         }
         $source = $this->factory->create($source, $options);
     }
     if ($prefix) {
         $source = new PrefixKeyNameSource($prefix, $source);
     }
     if ($addCircularGuard) {
         $source = new CircularGuardSource($source);
     }
     $this->sources[] = $source;
     return $this;
 }
Example #3
0
 public function testGetRegistry()
 {
     $registry = new Registry();
     $factory = new Factory('', $registry);
     $this->assertSame($registry, $factory->getRegistry());
 }