本文整理汇总了PHP中PHPParser::getClassesVars方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPParser::getClassesVars方法的具体用法?PHP PHPParser::getClassesVars怎么用?PHP PHPParser::getClassesVars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPParser
的用法示例。
在下文中一共展示了PHPParser::getClassesVars方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createWSDL
/**
* Generate the WSDL
*
*/
public function createWSDL()
{
$this->classes = $this->PHPParser->getClasses();
foreach ($this->classes as $class => $methods) {
$pbs = array();
ksort($methods);
foreach ($methods as $method => $components) {
if ($components["type"] == "public" || $components["type"] == "") {
if (array_key_exists("params", $components)) {
$this->createMessage($method, $components["returnType"], $components["params"]);
} else {
$this->createMessage($method, $components["returnType"]);
}
$pbs[$class][$method]["documentation"] = $components["description"];
$pbs[$class][$method]["input"] = $method;
$pbs[$class][$method]["output"] = $method;
}
}
$this->createPortType($pbs);
$this->createBinding($pbs);
$this->createService($pbs);
}
// adding typens
foreach ($this->typens as $typenNo => $url) {
$this->WSDLXML->setAttribute("xmlns:" . $typenNo, $url);
}
// add types
if (is_array($this->typensDefined) && count($this->typensDefined) > 0) {
$types = new XMLCreator("types");
$xsdSchema = new XMLCreator("xsd:schema");
$xsdSchema->setAttribute("xmlns", "http://www.w3.org/2001/XMLSchema");
$xsdSchema->setAttribute("targetNamespace", "urn:" . $this->name);
$vars = $this->PHPParser->getClassesVars();
foreach ($this->typensDefined as $typensDefined) {
$complexType = new XMLCreator("xsd:complexType");
$complexType->setAttribute("name", $typensDefined);
$all = new XMLCreator("xsd:all");
if (isset($vars[$typensDefined]) && is_array($vars[$typensDefined])) {
ksort($vars[$typensDefined]);
foreach ($vars[$typensDefined] as $varName => $varType) {
$element = new XMLCreator("xsd:element");
$element->setAttribute("name", $varName);
$varType = isset($this->xsd[$varType]) ? "xsd:" . $this->xsd[$varType] : "anyType";
$element->setAttribute("type", $this->xsd[$varType]);
$all->addChild($element);
}
}
$complexType->addChild($all);
$xsdSchema->addChild($complexType);
}
$types->addChild($xsdSchema);
$this->WSDLXML->addChild($types);
}
// adding messages
foreach ($this->messages as $message) {
$this->WSDLXML->addChild($message);
}
// adding port types
foreach ($this->portTypes as $portType) {
$this->WSDLXML->addChild($portType);
}
// adding bindings
foreach ($this->bindings as $binding) {
$this->WSDLXML->addChild($binding);
}
// adding services
$s = new XMLCreator("service");
$s->setAttribute("name", $this->name . "Service");
foreach ($this->services as $service) {
$s->addChild($service);
}
$this->WSDLXML->addChild($s);
$this->WSDL = "<?xml version='1.0' encoding='UTF-8'?>\n";
$this->WSDL .= "<!-- WSDL file generated by PHP WSDLCreator (http://www.protung.ro) -->\n";
$this->WSDL .= $this->WSDLXML->getXML();
}