/** * Inserts an item at the specified position. * This overrides the parent implementation by inserting only {@link THotSpot}. * @param integer the speicified position. * @param mixed new item * @throws TInvalidDataTypeException if the item to be inserted is not a THotSpot. */ public function insertAt($index, $item) { if ($item instanceof THotSpot) { parent::insertAt($index, $item); } else { throw new TInvalidDataTypeException('hotspotcollection_hotspot_required'); } }
/** * Inserts an item at the specified position. * This overrides the parent implementation by inserting only TControl descendants. * @param integer the speicified position. * @param mixed new item * @throws TInvalidDataTypeException if the item to be inserted is not a TControl descendant. */ public function insertAt($index, $item) { if ($item instanceof TControl) { parent::insertAt($index, $item); } else { throw new TInvalidDataTypeException('datalistitemcollection_datalistitem_required'); } }
/** * Inserts an item at the specified position. * This overrides the parent implementation by performing type * check on the item being added. * @param integer the speicified position. * @param mixed new item * @throws TInvalidDataTypeException if the item to be inserted is not a {@link TMetaTag} */ public function insertAt($index, $item) { if ($item instanceof TMetaTag) { parent::insertAt($index, $item); } else { throw new TInvalidDataTypeException('metatagcollection_metatag_invalid'); } }
/** * Inserts an item at the specified position. * This overrides the parent implementation by performing additional type checking * for each newly added item. * @param integer the specified position. * @param mixed new item * @throws TInvalidDataTypeException if the item to be inserted is not a dependency instance */ public function insertAt($index, $item) { if ($item instanceof ICacheDependency) { parent::insertAt($index, $item); } else { throw new TInvalidDataTypeException('cachedependencylist_cachedependency_required'); } }
/** * Inserts an item at the specified position. * This overrides the parent implementation by inserting only objects that are descendant of {@link TControl}. * @param integer the speicified position. * @param TControl new item * @throws TInvalidDataTypeException if the item to be inserted is not a control. */ public function insertAt($index, $item) { if ($item instanceof \Prado\Web\UI\TControl) { parent::insertAt($index, $item); } else { throw new TInvalidDataTypeException('repeateritemcollection_item_invalid'); } }
/** * Inserts an item at the specified position. * This overrides the parent implementation by performing additional * operations for each newly added TAuthorizationRule object. * @param integer the specified position. * @param mixed new item * @throws TInvalidDataTypeException if the item to be inserted is not a TAuthorizationRule object. */ public function insertAt($index, $item) { if ($item instanceof TAuthorizationRule) { parent::insertAt($index, $item); } else { throw new TInvalidDataTypeException('authorizationrulecollection_authorizationrule_required'); } }
/** * Inserts an item at the specified position. * This overrides the parent implementation by inserting only TDataGridColumn. * @param integer the speicified position. * @param mixed new item * @throws TInvalidDataTypeException if the item to be inserted is not a TDataGridColumn. */ public function insertAt($index, $item) { if ($item instanceof TDataGridColumn) { $item->setOwner($this->_o); parent::insertAt($index, $item); } else { throw new TInvalidDataTypeException('datagridcolumncollection_datagridcolumn_required'); } }
/** * Inserts an item at the specified position. * This method overrides the parent implementation by checking if * the item being added is a {@link TWizardStep}. * @param integer the speicified position. * @param mixed new item * @throws TInvalidDataTypeException if the item being added is not TWizardStep. */ public function insertAt($index, $item) { if ($item instanceof TWizardStep) { parent::insertAt($index, $item); $this->_wizard->getMultiView()->getViews()->insertAt($index, $item); $this->_wizard->addedWizardStep($item); } else { throw new TInvalidDataTypeException('wizardstepcollection_wizardstep_required'); } }
/** * Inserts an item at the specified position. * This overrides the parent implementation by performing additional * operations for each newly added THttpCookie object. * @param integer the specified position. * @param mixed new item * @throws TInvalidDataTypeException if the item to be inserted is not a THttpCookie object. */ public function insertAt($index, $item) { if ($item instanceof THttpCookie) { parent::insertAt($index, $item); if ($this->_o instanceof THttpResponse) { $this->_o->addCookie($item); } } else { throw new TInvalidDataTypeException('httpcookiecollection_httpcookie_required'); } }
/** * Inserts an item at the specified position. * This overrides the parent implementation by performing additional * operations for each newly added TXmlElement object. * @param integer the specified position. * @param mixed new item * @throws TInvalidDataTypeException if the item to be inserted is not a TXmlElement object. */ public function insertAt($index, $item) { if ($item instanceof TXmlElement) { parent::insertAt($index, $item); if ($item->getParent() !== null) { $item->getParent()->getElements()->remove($item); } $item->setParent($this->_o); } else { throw new TInvalidDataTypeException('xmlelementlist_xmlelement_required'); } }
/** * Inserts an item at the specified position. * This overrides the parent implementation by performing additional * operations for each newly added child control. * @param integer the speicified position. * @param mixed new item * @throws TInvalidDataTypeException if the item to be inserted is neither a string nor a TControl. */ public function insertAt($index, $item) { if ($item instanceof TControl) { parent::insertAt($index, $item); $this->_o->addedControl($item); } else { if (is_string($item) || $item instanceof IRenderable) { parent::insertAt($index, $item); } else { throw new TInvalidDataTypeException('controlcollection_control_required'); } } }
public function testCanNotInsertAtWhenReadOnly() { $list = new TList(array(), true); try { $list->insertAt(1, 2); self::fail('An expected TInvalidOperationException was not raised'); } catch (TInvalidOperationException $e) { } try { $list->insertAt(0, 2); self::fail('An expected TInvalidOperationException was not raised'); } catch (TInvalidOperationException $e) { } }