예제 #1
0
파일: Attribute.php 프로젝트: hoswey/gagawa
 public function setValue($value)
 {
     if (GagawaUtil::gagawaIsEmpty($value)) {
         throw new Exception("Attribute values cannot be " . "empty!");
     }
     $this->value_ = $value;
 }
예제 #2
0
 /**
  * Removes the first instance of child from this
  * FertileNode.  Once the first instance of the child
  * is removed, this function will return.  It returns
  * true if a child was removed and false if no child
  * was removed.
  */
 public function removeChild($childNode = NULL)
 {
     if (GagawaUtil::gagawaIsEmpty($childNode)) {
         throw new Exception("You cannot remove an empty " . "child node!");
     }
     for ($i = 0; $i < count($this->children_); $i++) {
         $child = $this->children_[$i];
         if ($child === $childNode) {
             unset($this->children_[$i]);
             return true;
         }
     }
     return false;
 }
예제 #3
0
파일: Node.php 프로젝트: hoswey/gagawa
 /**
  * Removes an attribute from this Node, by name.  The name
  * of the attribute to remove cannot be NULL; if so, this
  * function will throw an Exception.
  */
 public function removeAttribute($name = NULL)
 {
     if (GagawaUtil::gagawaIsEmpty($name)) {
         throw new Exception("Attribute name cannot " . "be empty!");
     }
     for ($i = 0; $i < count($this->attributes_); $i++) {
         $attribute = $this->attributes_[$i];
         if ($attribute->getName() === $name) {
             unset($this->attributes_[$i]);
             return true;
         }
     }
     // Couldn't find the attribute, so
     // it wasn't removed.
     return false;
 }
예제 #4
0
 public function __construct($xmlns = NULL)
 {
     parent::__construct("html");
     if (!GagawaUtil::gagawaIsEmpty($xmlns)) {
         $this->setXmlns($xmlns);
     }
 }