public function testTypedSequence() { $object1 = new \ArrayObject([1, 2, 3]); $object2 = new \ArrayObject([3, 2, 1]); $sequence = new TypedSequence('\\ArrayObject', [$object1]); $this->assertSame([$object1], $sequence->all()); $sequence->add($object2); $this->assertSame([$object1, $object2], $sequence->all()); $sequence->update(0, $object2)->update(1, $object1); $this->assertSame([$object2, $object1], $sequence->all()); $sequence = new TypedSequence('\\ArrayObject'); $sequence->addAll([$object1, $object2]); $this->assertSame([$object1, $object2], $sequence->all()); $sequence->removeElement($object2); $this->assertSame([$object1], $sequence->all()); }
/** * Add a match * * @param ValueAttrib $match * @return self */ public function addMatch(ValueAttrib $match) { $this->_matches->add($match); return $this; }
/** * Add a condition * * @param SearchFilterCondition $condition * @return self */ public function addCondition(SearchFilterCondition $condition) { $this->_conditions->add($condition); return $this; }
/** * Add a right * * @param Right $right * @return self */ public function addRight(Right $right) { $this->_rights->add($right); return $this; }
/** * Add a field * * @param QueueQueryField $field * @return self */ public function addField(QueueQueryField $field) { $this->_fields->add($field); return $this; }
/** * Add a xprop * * @param XProp $xprop * @return self */ public function addXProp(XProp $xprop) { $this->_xprops->add($xprop); return $this; }
/** * Get string of change * * @return string */ public function getChanges() { return count($this->_changes) ? implode(',', $this->_changes->all()) : NULL; }
/** * Add XNameRule * * @param XNameRule $ruleXName * @return self */ public function addXNameRule(XNameRule $ruleXName) { $this->_ruleXNames->add($ruleXName); return $this; }
/** * Add a mime part info * * @param MimePartInfo $mp * @return self */ public function addMimePart(MimePartInfo $mp) { $this->_mimeParts->add($mp); return $this; }
/** * Add xparam * * @param WkDay $xparam * @return self */ public function addWkDay(WkDay $wkday) { $this->_wkday->add($wkday); return $this; }
/** * Add an ace * * @param ACE $aces * @return self */ public function addAce(ACE $aces) { $this->_aces->add($aces); return $this; }
/** * Add a stat * * @param NamedElement $stat * @return self */ public function addStat(NamedElement $stat) { $this->_stats->add($stat); return $this; }
/** * Add any * * @param Base $any * @return self */ public function addAny(Base $any) { $this->_any->add($tz); return $this; }
/** * Get string of change * * @return string */ public function changes() { return count($this->_changes) ? implode(',', $this->_changes->all()) : ''; }
/** * Add an item * * @param ItemSpec $item * @return self */ public function addItem(ItemSpec $item) { $this->_items->add($item); return $this; }
/** * Add extra element * * @param Base $extra * @return self */ public function addExtra(Base $extra) { $this->_extras->add($extra); return $this; }