Example #1
0
 /**
  * Gets an iterator to iterate over the enabled formulars.
  *
  * @return \ArrayIterator
  * @see IteratorAggregate::getIterator()
  */
 public function getIterator()
 {
     $iterator = new PriorityList();
     $iterator->isLIFO(false);
     foreach ($this->activeForms as $key) {
         $spec = $this->forms[$key];
         $priority = isset($spec['priority']) ? $spec['priority'] : 0;
         $iterator->insert($key, $this->getForm($key), $priority);
     }
     return $iterator;
 }
Example #2
0
 public function testToArray()
 {
     $this->list->insert('foo', 'foo_value', null);
     $this->list->insert('bar', 'bar_value', 1);
     $this->list->insert('baz', 'baz_value', -1);
     $this->assertEquals(array('bar' => 'bar_value', 'foo' => 'foo_value', 'baz' => 'baz_value'), $this->list->toArray());
     $this->assertEquals(array('bar' => array('data' => 'bar_value', 'priority' => 1, 'serial' => 1), 'foo' => array('data' => 'foo_value', 'priority' => 0, 'serial' => 0), 'baz' => array('data' => 'baz_value', 'priority' => -1, 'serial' => 2)), $this->list->toArray(PriorityList::EXTR_BOTH));
 }
Example #3
0
 /**
  * @param string $handle
  */
 private function fetchHandle($handle)
 {
     foreach ($this->collectors->getIterator() as $collector) {
         $tempStructure = $collector->collect($handle, $this->getArea());
         if ($includes = $tempStructure->get(self::INSTRUCTION_INCLUDE)) {
             foreach ($includes as $include) {
                 $this->fetchHandle($include);
             }
         }
         $this->layoutStructure->merge($tempStructure);
     }
 }
Example #4
0
 /**
  * Make a deep clone of a fieldset
  *
  * @return void
  */
 public function __clone()
 {
     $items = $this->iterator->toArray(PriorityList::EXTR_BOTH);
     $this->elements = array();
     $this->fieldsets = array();
     $this->iterator = new PriorityList();
     $this->iterator->isLIFO(false);
     foreach ($items as $name => $item) {
         $elementOrFieldset = clone $item['data'];
         $this->iterator->insert($name, $elementOrFieldset, $item['priority']);
         if ($elementOrFieldset instanceof FieldsetInterface) {
             $this->fieldsets[$name] = $elementOrFieldset;
         } elseif ($elementOrFieldset instanceof ElementInterface) {
             $this->elements[$name] = $elementOrFieldset;
         }
     }
     $this->iterator->rewind();
     // Also make a deep copy of the object in case it's used within a collection
     if (is_object($this->object)) {
         $this->object = clone $this->object;
     }
 }
 public function getRawState($key = null)
 {
     $rawState = ['emptyWhereProtection' => $this->emptyWhereProtection, 'table' => $this->table, 'set' => $this->set->toArray(), 'where' => $this->where];
     return isset($key) && array_key_exists($key, $rawState) ? $rawState[$key] : $rawState;
 }
 /**
  * @param string $name
  */
 public function removeUserCredentialsStrategy($name)
 {
     $this->userCredentialsStrategies->remove($name);
 }
 /**
  * Gets the iterator of the view model list.
  *
  * @return PriorityList Sorted list for iteration.
  */
 public function getViewModels()
 {
     return $this->models->getIterator();
 }
Example #8
0
 /**
  * @inheritDoc
  */
 public function detachGenerator($name)
 {
     $this->generators->remove($name);
     return $this;
 }