/** * Constructor * * @param null|string|TableIdentifier $table */ public function __construct($table = null) { if ($table) { $this->table($table); } $this->where = new Where(); $this->set = new PriorityList(); $this->set->isLIFO(false); }
/** * @param DataMapperManager $dataMapperManager * @param PasswordInterface $password */ public function __construct(DataMapperManager $dataMapperManager, PasswordInterface $password, $addDefaultUserCredentialsStrategy = true) { $this->setDataMapperManager($dataMapperManager); $this->setPassword($password); $this->userCredentialsStrategies = new PriorityList(); $this->userCredentialsStrategies->isLIFO(false); if ($addDefaultUserCredentialsStrategy) { $this->addUserCredentialsStrategy(new PasswordStrategy($password), 'default'); } }
/** * 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; }
public function testFIFOOnly() { $this->list->isLIFO(false); $this->list->insert('foo', new \stdClass()); $this->list->insert('bar', new \stdClass()); $this->list->insert('baz', new \stdClass()); $this->list->insert('foobar', new \stdClass()); $this->list->insert('barbaz', new \stdClass()); $order = array(); foreach ($this->list as $key => $value) { $orders[] = $key; } $this->assertEquals(array('foo', 'bar', 'baz', 'foobar', 'barbaz'), $orders); }
/** * 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; } }