コード例 #1
0
ファイル: Class.php プロジェクト: vinnivinsachi/Vincent-DR
 /**
  * Add a class property
  *
  * @param object a class property object
  */
 function addProperty(CodeGen_PECL_Element_Property $property)
 {
     $name = $property->getName();
     if (isset($this->properties[$name])) {
         return PEAR::raiseError("property '{$name}' already exists");
     }
     $this->properties[$name] = $property;
 }
コード例 #2
0
 function tagstart_class_property($attr)
 {
     $err = $this->checkAttributes($attr, array("name", "type", "value", "access", "static"));
     if (PEAR::isError($err)) {
         return $err;
     }
     $prop = new CodeGen_PECL_Element_Property();
     if (!isset($attr["name"])) {
         return PEAR::raiseError("name attribute missing for property");
     }
     $err = $prop->setName($attr["name"]);
     if (PEAR::isError($err)) {
         return $err;
     }
     if (isset($attr["type"])) {
         $err = $prop->setType($attr["type"]);
         if (PEAR::isError($err)) {
             return $err;
         }
     }
     if (isset($attr["value"])) {
         if (!isset($attr["type"])) {
             return PEAR::raiseError("property value can only be set together with type");
         }
         $err = $prop->setValue($attr["value"]);
         if (PEAR::isError($err)) {
             return $err;
         }
     }
     if (isset($attr["access"])) {
         $err = $prop->setAccess($attr["access"]);
         if (PEAR::isError($err)) {
             return $err;
         }
     }
     if (isset($attr["static"]) && $this->toBool($attr["static"])) {
         $prop->isStatic();
     }
     return $this->helper->addProperty($prop);
 }