Пример #1
0
 /**
  * Detaches observer object
  *
  * @param \SplObserver $_oObserver Observer object
  * @return void
  */
 public function detach(\SplObserver $_oObserver)
 {
     $this->_oObservers->detach($_oObserver);
 }
Пример #2
0
 /**
  * Adds a new child to the node
  *
  * This adds a new node at the end of the XML and content array:
  * <code>
  * $xml->addChild(new Xml('div', 'hello world'));
  * </code>
  *
  * This adds a new node at a specific position within the XML structure (index 3)
  * igonring its position within the content stream:
  * <code>
  * $xml->addChild(new Xml('div', 'hello world'), 3);
  * </code>
  *
  * This adds a new node at a specific position within the content stream,
  * automatically positioning it within the XML array.
  * <code>
  * $xml->addChild(new Xml('div', 'hello world'), null, 2);
  * </code>
  *
  * @param object $xmlNode [node]
  * @param int $intIndex The desired position of the new child node (overrides $intContentIndex!) [n:index]
  * @param int $intContentIndex The desired position within the content stream [n:content_index]
  * @return Xml
  * @category iXML
  */
 public function addChild($xmlNode, $intIndex = null, $intContentIndex = null)
 {
     if (!$xmlNode instanceof Xml) {
         throw new Exception('Could not add XML node. Function requires a Xml object.');
     }
     $xmlNode->detach();
     $xmlNode->setParent($this);
     $xmlNode->setRoot($this->root());
     if (!is_null($intIndex) && $intIndex < sizeof($this->arrChildren)) {
         for ($i = sizeof($this->arrChildren); $i > $intIndex; $i--) {
             $this->arrChildren[$i] = $this->arrChildren[$i - 1];
             $this->arrChildren[$i]->setIndex($i);
         }
         $this->arrChildren[$intIndex] = $xmlNode;
         $this->arrChildren[$intIndex]->setIndex($intIndex);
         $intContentIndex = is_null($intContentIndex) ? $this->getContentIndex($intIndex) : $intContentIndex;
     } else {
         // Check if the XML tag should be inserted at a specific position of the content stream
         $intIndex = $intContentIndex ? $this->getContentTarget($intContentIndex) : sizeof($this->arrChildren);
         $this->arrChildren[] = $xmlNode;
     }
     if ($intContentIndex) {
         if ($intContentIndex > 0) {
             // Check, if the desired content index is valid
             if ($intCheckIndex = $this->getContentIndex($intIndex)) {
                 if ($intCheckIndex < $intContentIndex - 1) {
                     throw new Exception('Content index is not valid. Select an index > ' . $intCheckIndex);
                 }
             }
         } else {
             // If the ContentIndex is negative, the content index is forces without prior checking
             $intContentIndex = $intContentIndex * -1;
         }
     }
     $this->addContentEntry($intIndex, 1, $intContentIndex);
     return $this;
 }
Пример #3
0
 /**
  * Remove filter from collection.
  * 
  * @param  object $filter
  */
 public function remove($filter)
 {
     $this->filters->detach($filter);
 }
Пример #4
0
 /**
  * Detach an Observer class from this Subject
  *
  * @param \SplObserver $observer
  */
 public function detach(\SplObserver $observer)
 {
     if ($observer instanceof View) {
         $this->observers->detach($observer);
     }
 }