diff --git a/webservice/classes/soap/IPReflectionClass.class.php b/webservice/classes/soap/IPReflectionClass.class.php index 21e30b9..9e451b2 100755 --- a/webservice/classes/soap/IPReflectionClass.class.php +++ b/webservice/classes/soap/IPReflectionClass.class.php @@ -1,114 +1,114 @@ -classname = $classname; - parent::__construct($classname); - - $this->parseComment(); - } - - /** - *Provides all methods exposed by this class as an array - * - * @param boolean If the method should also return protected functions - * @param boolean If the method should also return private functions - * @return IPReflectionMethod[] - */ - public function getMethods($alsoProtected = true, $alsoPrivate = true){ - $ar = parent::getMethods(); - foreach($ar as $method){ - $m = new IPReflectionMethod($this->classname, $method->name); - if((!$m->isPrivate() || $alsoPrivate) && (!$m->isProtected() || $alsoProtected) && ($m->getDeclaringClass()->name == $this->classname)) - $this->methods[$method->name] = $m; - } - ksort($this->methods); - return $this->methods; - } - - /** - * Exposes an array with public properties of the class - * - * @param boolean If the method should also return protected properties - * @param boolean If the method should also return private properties - * @return IPReflectionProperty[] - */ - public function getProperties($alsoProtected=true,$alsoPrivate=true) { - $ar = parent::getProperties(); - $this->properties = Array(); - foreach($ar as $property){ - if((!$property->isPrivate() || $alsoPrivate) && (!$property->isProtected() || $alsoProtected)){ - try{ - $p = new IPReflectionProperty($this->classname, $property->getName()); - $this->properties[$property->name]=$p; - }catch(ReflectionException $exception){ - echo "Fault on property: ".$property->name."
\n"; - } - } - } - ksort($this->properties); - return $this->properties; - } - - /** - * Exposes annotations of the class - * @param $annotationName String the annotation name - * @param $annotationClass String the annotation class - * @return void - */ - public function getAnnotation($annotationName, $annotationClass = null){ - return IPPhpDoc::getAnnotation($this->comment, $annotationName, $annotationClass); - } - - /** - * Gets all the usefull information from the comments - * @return void - */ - private function parseComment() { - $this->comment = $this->getDocComment(); - new IPReflectionCommentParser($this->comment, $this); - } -} +classname = $classname; + parent::__construct($classname); + + $this->parseComment(); + } + + /** + *Provides all methods exposed by this class as an array + * + * @param boolean If the method should also return protected functions + * @param boolean If the method should also return private functions + * @return IPReflectionMethod[] + */ + public function getMethods($alsoProtected = true, $alsoPrivate = true){ + $ar = parent::getMethods(); + foreach($ar as $method){ + $m = new IPReflectionMethod($this->classname, $method->name); + if((!$m->isPrivate() || $alsoPrivate) && (!$m->isProtected() || $alsoProtected) && ($m->getDeclaringClass()->name == $this->classname)) + $this->methods[$method->name] = $m; + } + ksort($this->methods); + return $this->methods; + } + + /** + * Exposes an array with public properties of the class + * + * @param boolean If the method should also return protected properties + * @param boolean If the method should also return private properties + * @return IPReflectionProperty[] + */ + public function getProperties($alsoProtected=true,$alsoPrivate=true) { + $ar = parent::getProperties(); + $this->properties = Array(); + foreach($ar as $property){ + if((!$property->isPrivate() || $alsoPrivate) && (!$property->isProtected() || $alsoProtected)){ + try{ + $p = new IPReflectionProperty($this->classname, $property->getName()); + $this->properties[$property->name]=$p; + }catch(ReflectionException $exception){ + echo "Fault on property: ".$property->name."
\n"; + } + } + } + ksort($this->properties); + return $this->properties; + } + + /** + * Exposes annotations of the class + * @param $annotationName String the annotation name + * @param $annotationClass String the annotation class + * @return void + */ + public function getAnnotation($annotationName, $annotationClass = null){ + return IPPhpDoc::getAnnotation($this->comment, $annotationName, $annotationClass); + } + + /** + * Gets all the usefull information from the comments + * @return void + */ + private function parseComment() { + $this->comment = $this->getDocComment(); + new IPReflectionCommentParser($this->comment, $this); + } +} ?> \ No newline at end of file diff --git a/webservice/classes/soap/IPReflectionCommentParser.class.php b/webservice/classes/soap/IPReflectionCommentParser.class.php index 9d8340f..b7b6933 100755 --- a/webservice/classes/soap/IPReflectionCommentParser.class.php +++ b/webservice/classes/soap/IPReflectionCommentParser.class.php @@ -1,170 +1,170 @@ -comment = $comment; - $this->obj = $obj; - $this->parse(); - } - /** - * parses the comment, line for line - * - * Will take the type of comment (class, property or function) as an - * argument and split it up in lines. - * @param string Defines if its the comment for a class, public of function - * @return void - */ - function parse() { - //reset object - $descriptionDone = false; - $this->fullDescriptionDone = false; - - //split lines - $lines = split("\n", $this->comment); - - //check lines for description or tags - foreach ($lines as $line) { - $pos = strpos($line,"* @"); - if (trim($line) == "/**" || trim($line) == "*/") { //skip the start and end line - }elseif (!($pos === false)) { //comment - $this->parseTagLine(substr($line,$pos+3)); - $descriptionDone=true; - }elseif(!$descriptionDone){ - $this->parseDescription($line); - } - } - //if full description is empty, put small description in full description - if (trim(str_replace(Array("\n","\r"), Array("", ""), $this->obj->fullDescription)) == "") - $this->obj->fullDescription = $this->obj->smallDescription; - } - - /** - * Parses the description to the small and full description properties - * - * @param string The description line - * @return void - */ - - function parseDescription($descriptionLine) { - if(strpos($descriptionLine,"*") <= 2) $descriptionLine = substr($descriptionLine, (strpos($descriptionLine,"*") + 1)); - - //geen lege comment regel indien al in grote omschrijving - if(trim(str_replace(Array("\n","\r"), Array("", ""), $descriptionLine)) == ""){ - if($this->obj->fullDescription == "") - $descriptionLine = ""; - $this->smallDescriptionDone = true; - } - - if(!$this->smallDescriptionDone)//add to small description - $this->obj->smallDescription.=$descriptionLine; - else{//add to full description - $this->obj->fullDescription.=$descriptionLine; - } - } - - /** - * Parses a tag line and extracts the tagname and values - * - * @param string The tagline - * @return void - */ - function parseTagLine($tagLine) { - $tagArr = explode(" ", $tagLine); - $tag = $tagArr[0]; - - switch(strtolower($tag)){ - case 'abstract': - $this->obj->abstract = true; break; - case 'access': - $this->obj->isPrivate = (strtolower(trim($tagArr[1]))=="private")?true:false; - break; - case 'author': - unset($tagArr[0]); - $this->obj->author = implode(" ",$tagArr); - break; - case 'copyright': - unset($tagArr[0]); - $this->obj->copyright = implode(" ",$tagArr); - break; - case 'deprecated': - case 'deprec': - $this->obj->deprecated = true; - break; - case 'extends': break; - case 'global': - $this->obj->globals[] = $tagArr[1]; - break; - case 'param': - $o = new stdClass(); - $o->type = trim($tagArr[1]); - $o->comment = implode(" ",$tagArr); - $this->obj->params[] = $o; - break; - case 'return': - $this->obj->return = trim($tagArr[1]); break; - case 'link':break; - case 'see':break; - case 'since': - $this->obj->since = trim($tagArr[1]); break; - case 'static': - $this->obj->static = true; break; - case 'throws': - unset($tagArr[0]); - $this->obj->throws = implode(" ",$tagArr); - break; - case 'todo': - unset($tagArr[0]); - $this->obj->todo[] = implode(" ",$tagArr); - break; - case 'var': - $this->obj->type = trim($tagArr[1]); - unset($tagArr[0],$tagArr[1]); - $comment=implode(" ",$tagArr); - //check if its an optional property - $this->obj->optional = strpos($comment,"[OPTIONAL]") !== FALSE; - $this->obj->autoincrement = strpos($comment,"[AUTOINCREMENT]") !== FALSE; - $this->obj->description = str_replace("[OPTIONAL]", "", $comment); - break; - case 'version': - $this->obj->version = $tagArr[1]; - break; - default: - //echo "\nno valid tag: '".strtolower($tag)."' at tagline: '$tagLine'
"; - //do nothing - } - } -} +comment = $comment; + $this->obj = $obj; + $this->parse(); + } + /** + * parses the comment, line for line + * + * Will take the type of comment (class, property or function) as an + * argument and split it up in lines. + * @param string Defines if its the comment for a class, public of function + * @return void + */ + function parse() { + //reset object + $descriptionDone = false; + $this->fullDescriptionDone = false; + + //split lines + $lines = split("\n", $this->comment); + + //check lines for description or tags + foreach ($lines as $line) { + $pos = strpos($line,"* @"); + if (trim($line) == "/**" || trim($line) == "*/") { //skip the start and end line + }elseif (!($pos === false)) { //comment + $this->parseTagLine(substr($line,$pos+3)); + $descriptionDone=true; + }elseif(!$descriptionDone){ + $this->parseDescription($line); + } + } + //if full description is empty, put small description in full description + if (trim(str_replace(Array("\n","\r"), Array("", ""), $this->obj->fullDescription)) == "") + $this->obj->fullDescription = $this->obj->smallDescription; + } + + /** + * Parses the description to the small and full description properties + * + * @param string The description line + * @return void + */ + + function parseDescription($descriptionLine) { + if(strpos($descriptionLine,"*") <= 2) $descriptionLine = substr($descriptionLine, (strpos($descriptionLine,"*") + 1)); + + //geen lege comment regel indien al in grote omschrijving + if(trim(str_replace(Array("\n","\r"), Array("", ""), $descriptionLine)) == ""){ + if($this->obj->fullDescription == "") + $descriptionLine = ""; + $this->smallDescriptionDone = true; + } + + if(!$this->smallDescriptionDone)//add to small description + $this->obj->smallDescription.=$descriptionLine; + else{//add to full description + $this->obj->fullDescription.=$descriptionLine; + } + } + + /** + * Parses a tag line and extracts the tagname and values + * + * @param string The tagline + * @return void + */ + function parseTagLine($tagLine) { + $tagArr = explode(" ", $tagLine); + $tag = $tagArr[0]; + + switch(strtolower($tag)){ + case 'abstract': + $this->obj->abstract = true; break; + case 'access': + $this->obj->isPrivate = (strtolower(trim($tagArr[1]))=="private")?true:false; + break; + case 'author': + unset($tagArr[0]); + $this->obj->author = implode(" ",$tagArr); + break; + case 'copyright': + unset($tagArr[0]); + $this->obj->copyright = implode(" ",$tagArr); + break; + case 'deprecated': + case 'deprec': + $this->obj->deprecated = true; + break; + case 'extends': break; + case 'global': + $this->obj->globals[] = $tagArr[1]; + break; + case 'param': + $o = new stdClass(); + $o->type = trim($tagArr[1]); + $o->comment = implode(" ",$tagArr); + $this->obj->params[] = $o; + break; + case 'return': + $this->obj->return = trim($tagArr[1]); break; + case 'link':break; + case 'see':break; + case 'since': + $this->obj->since = trim($tagArr[1]); break; + case 'static': + $this->obj->static = true; break; + case 'throws': + unset($tagArr[0]); + $this->obj->throws = implode(" ",$tagArr); + break; + case 'todo': + unset($tagArr[0]); + $this->obj->todo[] = implode(" ",$tagArr); + break; + case 'var': + $this->obj->type = trim($tagArr[1]); + unset($tagArr[0],$tagArr[1]); + $comment=implode(" ",$tagArr); + //check if its an optional property + $this->obj->optional = strpos($comment,"[OPTIONAL]") !== FALSE; + $this->obj->autoincrement = strpos($comment,"[AUTOINCREMENT]") !== FALSE; + $this->obj->description = str_replace("[OPTIONAL]", "", $comment); + break; + case 'version': + $this->obj->version = $tagArr[1]; + break; + default: + //echo "\nno valid tag: '".strtolower($tag)."' at tagline: '$tagLine'
"; + //do nothing + } + } +} ?> \ No newline at end of file diff --git a/webservice/classes/soap/IPReflectionMethod.class.php b/webservice/classes/soap/IPReflectionMethod.class.php index 9f11b05..55bcf15 100755 --- a/webservice/classes/soap/IPReflectionMethod.class.php +++ b/webservice/classes/soap/IPReflectionMethod.class.php @@ -1,100 +1,100 @@ -classname = $class; - parent::__construct($class,$method); - $this->parseComment(); - } - - /** - * Returns the full function name, including arguments - * @return string - */ - public function getFullName(){ - $args = $this->getParameters(); - $argstr = ""; - - foreach((array)$args as $arg){ - if($argstr!="")$argstr.=", "; - $argstr.= $arg->type ." $".$arg->name; - } - return $this->return." ".$this->name."(".$argstr.")"; - } - - /** - * Returns an array with parameter objects, containing type info etc. - * - * @return ReflectionParameter[] Associative array with parameter objects - */ - public function getParameters(){ - $this->parameters = Array(); - $ar = parent::getParameters(); - $i = 0; - - foreach((array)$ar as $parameter){ - $parameter->type = $this->params[$i++]->type; - $this->parameters[$parameter->name] = $parameter; - } - - return $this->parameters; - } - - /** - * - * @param $annotationName String the annotation name - * @param $annotationClass String the annotation class - * @return void - */ - public function getAnnotation($annotationName, $annotationClass = null){ - return IPPhpDoc::getAnnotation($this->comment, $annotationName, $annotationClass); - } - - /** - * Parses the comment and adds found properties to this class - * @return void - */ - private function parseComment(){ - $this->comment = $this->getDocComment(); - new IPReflectionCommentParser($this->comment, $this); - } -} +classname = $class; + parent::__construct($class,$method); + $this->parseComment(); + } + + /** + * Returns the full function name, including arguments + * @return string + */ + public function getFullName(){ + $args = $this->getParameters(); + $argstr = ""; + + foreach((array)$args as $arg){ + if($argstr!="")$argstr.=", "; + $argstr.= $arg->type ." $".$arg->name; + } + return $this->return." ".$this->name."(".$argstr.")"; + } + + /** + * Returns an array with parameter objects, containing type info etc. + * + * @return ReflectionParameter[] Associative array with parameter objects + */ + public function getParameters(){ + $this->parameters = Array(); + $ar = parent::getParameters(); + $i = 0; + + foreach((array)$ar as $parameter){ + $parameter->type = $this->params[$i++]->type; + $this->parameters[$parameter->name] = $parameter; + } + + return $this->parameters; + } + + /** + * + * @param $annotationName String the annotation name + * @param $annotationClass String the annotation class + * @return void + */ + public function getAnnotation($annotationName, $annotationClass = null){ + return IPPhpDoc::getAnnotation($this->comment, $annotationName, $annotationClass); + } + + /** + * Parses the comment and adds found properties to this class + * @return void + */ + private function parseComment(){ + $this->comment = $this->getDocComment(); + new IPReflectionCommentParser($this->comment, $this); + } +} ?> \ No newline at end of file diff --git a/webservice/classes/soap/IPReflectionProperty.class.php b/webservice/classes/soap/IPReflectionProperty.class.php index 4feaa29..86984af 100755 --- a/webservice/classes/soap/IPReflectionProperty.class.php +++ b/webservice/classes/soap/IPReflectionProperty.class.php @@ -1,75 +1,75 @@ -classname = $class; - parent::__construct($class, $property); - $this->parseComment(); - } - - /** - * - * @param $annotationName String the annotation name - * @param $annotationClass String the annotation class - * @return void - */ - public function getAnnotation($annotationName, $annotationClass = null){ - return IPPhpDoc::getAnnotation($this->comment, $annotationName, $annotationClass); - } - - private function parseComment(){ - // No getDocComment available for properties in php 5.0.3 :( - $this->comment = $this->getDocComment(); - new IPReflectionCommentParser($this->comment, $this); - } -} +classname = $class; + parent::__construct($class, $property); + $this->parseComment(); + } + + /** + * + * @param $annotationName String the annotation name + * @param $annotationClass String the annotation class + * @return void + */ + public function getAnnotation($annotationName, $annotationClass = null){ + return IPPhpDoc::getAnnotation($this->comment, $annotationName, $annotationClass); + } + + private function parseComment(){ + // No getDocComment available for properties in php 5.0.3 :( + $this->comment = $this->getDocComment(); + new IPReflectionCommentParser($this->comment, $this); + } +} ?> \ No newline at end of file diff --git a/webservice/classes/soap/WSDLException.class.php b/webservice/classes/soap/WSDLException.class.php index df20680..f2bf5ef 100755 --- a/webservice/classes/soap/WSDLException.class.php +++ b/webservice/classes/soap/WSDLException.class.php @@ -1,26 +1,26 @@ -msg = $msg; - } - /** - * @return void - */ - function Display() { - print "Error creating WSDL document:".$this->msg; - //var_dump(debug_backtrace()); - } -} +msg = $msg; + } + /** + * @return void + */ + function Display() { + print "Error creating WSDL document:".$this->msg; + //var_dump(debug_backtrace()); + } +} ?> \ No newline at end of file diff --git a/webservice/classes/soap/WSDLStruct.class.php b/webservice/classes/soap/WSDLStruct.class.php index 4b2c2b4..f9700d4 100755 --- a/webservice/classes/soap/WSDLStruct.class.php +++ b/webservice/classes/soap/WSDLStruct.class.php @@ -1,338 +1,338 @@ -use = $use; - $this->binding_style=$type; - $this->tns = $tns; - $this->url = $url; - $this->doc = new domDocument(); - $this->definitions = $this->addElement("wsdl:definitions",$this->doc); - - $this->typesTag = $this->addElement("wsdl:types", $this->definitions); - $this->xsdSchema = $this->addElement("xsd:schema", $this->typesTag); - $this->xsdSchema->setAttribute("targetNamespace", $this->tns); - $this->xmlSchema = new IPXMLSchema($this->xsdSchema); - - } - - /** - * Adds the class to the services for this WSDL - * - * @param IPReflectionClass The service - * @return void - */ - public function setService(IPReflectionClass $class){ - $this->services[$class->classname] = $class; - $this->services[$class->classname]->getMethods(false, false); - } - /** - * @return string The WSDL document for this structure - */ - public function generateDocument(){ - $this->addToDebug("Generating document"); - - //add all definitions - $definitions=$this->definitions; - $definitions->setAttribute("xmlns", self::NS_WSDL); - $definitions->setAttribute("xmlns:soap", self::NS_SOAP); - $definitions->setAttribute("xmlns:SOAP-ENC", self::NS_ENC); - $definitions->setAttribute("xmlns:wsdl", self::NS_WSDL); - $definitions->setAttribute("xmlns:xsd", self::NS_XSD); - $definitions->setAttribute("xmlns:tns", $this->tns); - $definitions->setAttribute("targetNamespace", $this->tns); - - //add all the services - foreach((array)$this->services as $serviceName => $service){ - //add the portType - $portType = $this->addPortType($serviceName); - - //add binding - $binding = $this->addBinding($serviceName); - - //loop the operations - foreach((array)$service->methods as $operation){ - $operationName = $operation->name; - $operationTag = $this->addOperation($operationName, $serviceName); - - //input - //only when to operation needs arguments - $parameters = $operation->getParameters(); - if(count($parameters)>0 || self::CREATE_EMPTY_INPUTS){ - $messageName = $operationName."Request"; - $input=$this->addElement("wsdl:input", $operationTag); - $input->setAttribute("message", "tns:".$messageName); - $para=Array(); - foreach((array)$parameters as $parameterName => $parameter){ - $para[$parameterName] = $parameter->type; - } - $this->addMessage($messageName, $para); - $this->addInput($this->bindingOperationTags[$serviceName][$operationName]); - } - - - //output - //only when the operation returns something - if(!$operation->return || trim($operation->return) == "") throw new WSDLException('No return type for '.$operationName); - if(strtolower(trim($operation->return))!='void'){ - $messageName = $operationName."Response"; - $output = $this->addElement("wsdl:output", $operationTag); - $output->setAttribute("message", "tns:".$messageName); - $this->addOutput($this->bindingOperationTags[$serviceName][$operationName]); - $this->addMessage($messageName,Array($operation->name."Return" => $operation->return)); - } - } - // SH. now add the portType and binding - $this->definitions->AppendChild($portType); - $this->definitions->AppendChild($binding); - - //add the service - $this->addService($serviceName); - - } - return $this->doc->saveXML(); - } - - /** - * Adds a new operation to the given service - * @param string operation name - * @param string service name - * @return domElement - */ - private function addOperation($operationName, $serviceName){ - $this->addToDebug("Adding Operation: '$operationName : $serviceName'"); - $operationTag = $this->addElement("wsdl:operation",$this->portTypeTags[$serviceName]); - $operationTag->setAttribute("name",$operationName); - - //create operation tag for binding - $bindingOperationTag = $this->addElement("wsdl:operation",$this->bindingTags[$serviceName]); - $bindingOperationTag->setAttribute("name",$operationName); - - //soap operation tag - $soapOperationTag = $this->addElement("soap:operation",$bindingOperationTag); - $soapOperationTag->setAttribute("soapAction",$this->url."&method=".$operationName); - $soapOperationTag->setAttribute("style",($this->binding_style == SOAP_RPC)? "rpc" : "document"); - - //save references - $this->operationTags[$serviceName][$operationName] = $operationTag; - $this->bindingOperationTags[$serviceName][$operationName] = $bindingOperationTag; - - //and return - return $operationTag; - } - - /** - * adds a new service tag to the WSDL file - * @param string the service name - * @return domElement - */ - private function addService($serviceName){ - $this->addToDebug("Adding service: '$serviceName'"); - //create service - $serviceTag=$this->addElement("wsdl:service",$this->definitions); - $serviceTag->setAttribute("name",$serviceName); - - //port tag - $portTag=$this->addElement("wsdl:port", $serviceTag); - $portTag->setAttribute("name", $serviceName."Port"); - $portTag->setAttribute("binding", "tns:".$serviceName."Binding"); - - //address tag - $addressTag = $this->addElement("soap:address", $portTag); - $addressTag->setAttribute("location", $this->url); - - //keep a reference - $this->serviceTags[$serviceName] = $serviceTag; - //and return - return $serviceTag; - } - - /** - * Adds a new portType to the WSDL structure - * @param string the service name for which we create a portType - * @return domElement - */ - private function addPortType($serviceName){ - $this->addToDebug("Adding portType: '$serviceName'"); - // SH don't add to main doc just yet - // $portTypeTag=$this->addElement("wsdl:portType", $this->definitions); - $portTypeTag = $this->addElement("wsdl:portType"); - $portTypeTag->setAttribute("name", $serviceName."PortType"); - - //keep a reference - $this->portTypeTags[$serviceName]=$portTypeTag; - //and return - return $portTypeTag; - } - - /** - * Adds a new binding to the WSDL structure - * @param string serviceName to bind - * @return domElement - */ - private function addBinding($serviceName){ - $this->addToDebug("Adding binding: '$serviceName'"); - // SH. don't add to main doc just yet - // $bindingTag=$this->addElement("binding"); - $bindingTag=$this->addElement("binding",$this->definitions); - $bindingTag->setAttribute("name", $serviceName."Binding"); - $bindingTag->setAttribute("type", "tns:".$serviceName."PortType"); - - //soap binding tag - $soapBindingTag = $this->addElement("soap:binding", $bindingTag); - $soapBindingTag->setAttribute("style", ($this->binding_style == SOAP_RPC)? "rpc" : "document"); - $soapBindingTag->setAttribute("transport", "http://schemas.xmlsoap.org/soap/http"); - - //keep a reference - $this->bindingTags[$serviceName] = $bindingTag; - //and return - return $bindingTag; - } - - /** - * Adds a message tag to the WSDL document - * @param string Message name - * @param Array[string=>string] Array with variables & types - */ - private function addMessage($name, $parts){ - $this->addToDebug("Adding message: '$name'"); - $msg = $this->addElement("message", $this->definitions); - $msg->setAttribute("name", $name); - foreach((array)$parts as $partName => $partType){ - $this->addToDebug("Adding Message part: '$partName => $partType'"); - $part=$this->addElement("part", $msg); - $part->setAttribute("name", $partName); - - //check if it is a valid XML Schema datatype - if($t = IPXMLSchema::checkSchemaType(strtolower($partType))) - $part->setAttribute("type", "xsd:".$t); - else{ - //If it is an array, change the type name - $partName = (substr($partType,-2) == "[]")?substr($partType,0,strpos($partType,"["))."Array":$partType; - - $part->setAttribute("type", "tns:".$partName); - $this->xmlSchema->addComplexType($partType, $partName); - } - } - } - - /** - * Adds an input element to the given parent (an operation tag) - * @param domNode The Parent domNode - * @param boolean Kind of tag. true=input tag, false=output tag - * @return domNode The input/output node - */ - private function addInput($parent, $input=true){ - $name = $input ? "wsdl:input" : "wsdl:output"; - $tag=$this->addElement($name, $parent); - $soapOperation=$this->addElement("soap:body", $tag); - $soapOperation->setAttribute("use", ($this->use == SOAP_ENCODED)? "encoded" : "literal"); - $soapOperation->setAttribute("namespace", $this->tns); - if($this->use == SOAP_ENCODED) - $soapOperation->setAttribute("encodingStyle", self::NS_ENC); - } - - /** - * Adds an output element to the given parent (an operation tag) - * @param domNode The Parent domNode - * @return domNode The output node - */ - private function addOutput($parent){ - return $this->addInput($parent,false); - } - - /************************* Supporting functions ****************************/ - - private function addToDebug($msg){ - if($this->_debug) echo '-'.$msg."
\n"; - } - - /** - * Adds an child element to the parent - * @param string The name element - * @param domNode - * @return domNode - */ - private function addElement($name, $parent=false, $ns=false){ - if($ns) - $el=$this->doc->createElementNS($ns,$name); - else - $el=$this->doc->createElement($name); - if($parent) - $parent->appendChild($el); - return $el; - } -} +use = $use; + $this->binding_style=$type; + $this->tns = $tns; + $this->url = $url; + $this->doc = new domDocument(); + $this->definitions = $this->addElement("wsdl:definitions",$this->doc); + + $this->typesTag = $this->addElement("wsdl:types", $this->definitions); + $this->xsdSchema = $this->addElement("xsd:schema", $this->typesTag); + $this->xsdSchema->setAttribute("targetNamespace", $this->tns); + $this->xmlSchema = new IPXMLSchema($this->xsdSchema); + + } + + /** + * Adds the class to the services for this WSDL + * + * @param IPReflectionClass The service + * @return void + */ + public function setService(IPReflectionClass $class){ + $this->services[$class->classname] = $class; + $this->services[$class->classname]->getMethods(false, false); + } + /** + * @return string The WSDL document for this structure + */ + public function generateDocument(){ + $this->addToDebug("Generating document"); + + //add all definitions + $definitions=$this->definitions; + $definitions->setAttribute("xmlns", self::NS_WSDL); + $definitions->setAttribute("xmlns:soap", self::NS_SOAP); + $definitions->setAttribute("xmlns:SOAP-ENC", self::NS_ENC); + $definitions->setAttribute("xmlns:wsdl", self::NS_WSDL); + $definitions->setAttribute("xmlns:xsd", self::NS_XSD); + $definitions->setAttribute("xmlns:tns", $this->tns); + $definitions->setAttribute("targetNamespace", $this->tns); + + //add all the services + foreach((array)$this->services as $serviceName => $service){ + //add the portType + $portType = $this->addPortType($serviceName); + + //add binding + $binding = $this->addBinding($serviceName); + + //loop the operations + foreach((array)$service->methods as $operation){ + $operationName = $operation->name; + $operationTag = $this->addOperation($operationName, $serviceName); + + //input + //only when to operation needs arguments + $parameters = $operation->getParameters(); + if(count($parameters)>0 || self::CREATE_EMPTY_INPUTS){ + $messageName = $operationName."Request"; + $input=$this->addElement("wsdl:input", $operationTag); + $input->setAttribute("message", "tns:".$messageName); + $para=Array(); + foreach((array)$parameters as $parameterName => $parameter){ + $para[$parameterName] = $parameter->type; + } + $this->addMessage($messageName, $para); + $this->addInput($this->bindingOperationTags[$serviceName][$operationName]); + } + + + //output + //only when the operation returns something + if(!$operation->return || trim($operation->return) == "") throw new WSDLException('No return type for '.$operationName); + if(strtolower(trim($operation->return))!='void'){ + $messageName = $operationName."Response"; + $output = $this->addElement("wsdl:output", $operationTag); + $output->setAttribute("message", "tns:".$messageName); + $this->addOutput($this->bindingOperationTags[$serviceName][$operationName]); + $this->addMessage($messageName,Array($operation->name."Return" => $operation->return)); + } + } + // SH. now add the portType and binding + $this->definitions->AppendChild($portType); + $this->definitions->AppendChild($binding); + + //add the service + $this->addService($serviceName); + + } + return $this->doc->saveXML(); + } + + /** + * Adds a new operation to the given service + * @param string operation name + * @param string service name + * @return domElement + */ + private function addOperation($operationName, $serviceName){ + $this->addToDebug("Adding Operation: '$operationName : $serviceName'"); + $operationTag = $this->addElement("wsdl:operation",$this->portTypeTags[$serviceName]); + $operationTag->setAttribute("name",$operationName); + + //create operation tag for binding + $bindingOperationTag = $this->addElement("wsdl:operation",$this->bindingTags[$serviceName]); + $bindingOperationTag->setAttribute("name",$operationName); + + //soap operation tag + $soapOperationTag = $this->addElement("soap:operation",$bindingOperationTag); + $soapOperationTag->setAttribute("soapAction",$this->url."&method=".$operationName); + $soapOperationTag->setAttribute("style",($this->binding_style == SOAP_RPC)? "rpc" : "document"); + + //save references + $this->operationTags[$serviceName][$operationName] = $operationTag; + $this->bindingOperationTags[$serviceName][$operationName] = $bindingOperationTag; + + //and return + return $operationTag; + } + + /** + * adds a new service tag to the WSDL file + * @param string the service name + * @return domElement + */ + private function addService($serviceName){ + $this->addToDebug("Adding service: '$serviceName'"); + //create service + $serviceTag=$this->addElement("wsdl:service",$this->definitions); + $serviceTag->setAttribute("name",$serviceName); + + //port tag + $portTag=$this->addElement("wsdl:port", $serviceTag); + $portTag->setAttribute("name", $serviceName."Port"); + $portTag->setAttribute("binding", "tns:".$serviceName."Binding"); + + //address tag + $addressTag = $this->addElement("soap:address", $portTag); + $addressTag->setAttribute("location", $this->url); + + //keep a reference + $this->serviceTags[$serviceName] = $serviceTag; + //and return + return $serviceTag; + } + + /** + * Adds a new portType to the WSDL structure + * @param string the service name for which we create a portType + * @return domElement + */ + private function addPortType($serviceName){ + $this->addToDebug("Adding portType: '$serviceName'"); + // SH don't add to main doc just yet + // $portTypeTag=$this->addElement("wsdl:portType", $this->definitions); + $portTypeTag = $this->addElement("wsdl:portType"); + $portTypeTag->setAttribute("name", $serviceName."PortType"); + + //keep a reference + $this->portTypeTags[$serviceName]=$portTypeTag; + //and return + return $portTypeTag; + } + + /** + * Adds a new binding to the WSDL structure + * @param string serviceName to bind + * @return domElement + */ + private function addBinding($serviceName){ + $this->addToDebug("Adding binding: '$serviceName'"); + // SH. don't add to main doc just yet + // $bindingTag=$this->addElement("binding"); + $bindingTag=$this->addElement("binding",$this->definitions); + $bindingTag->setAttribute("name", $serviceName."Binding"); + $bindingTag->setAttribute("type", "tns:".$serviceName."PortType"); + + //soap binding tag + $soapBindingTag = $this->addElement("soap:binding", $bindingTag); + $soapBindingTag->setAttribute("style", ($this->binding_style == SOAP_RPC)? "rpc" : "document"); + $soapBindingTag->setAttribute("transport", "http://schemas.xmlsoap.org/soap/http"); + + //keep a reference + $this->bindingTags[$serviceName] = $bindingTag; + //and return + return $bindingTag; + } + + /** + * Adds a message tag to the WSDL document + * @param string Message name + * @param Array[string=>string] Array with variables & types + */ + private function addMessage($name, $parts){ + $this->addToDebug("Adding message: '$name'"); + $msg = $this->addElement("message", $this->definitions); + $msg->setAttribute("name", $name); + foreach((array)$parts as $partName => $partType){ + $this->addToDebug("Adding Message part: '$partName => $partType'"); + $part=$this->addElement("part", $msg); + $part->setAttribute("name", $partName); + + //check if it is a valid XML Schema datatype + if($t = IPXMLSchema::checkSchemaType(strtolower($partType))) + $part->setAttribute("type", "xsd:".$t); + else{ + //If it is an array, change the type name + $partName = (substr($partType,-2) == "[]")?substr($partType,0,strpos($partType,"["))."Array":$partType; + + $part->setAttribute("type", "tns:".$partName); + $this->xmlSchema->addComplexType($partType, $partName); + } + } + } + + /** + * Adds an input element to the given parent (an operation tag) + * @param domNode The Parent domNode + * @param boolean Kind of tag. true=input tag, false=output tag + * @return domNode The input/output node + */ + private function addInput($parent, $input=true){ + $name = $input ? "wsdl:input" : "wsdl:output"; + $tag=$this->addElement($name, $parent); + $soapOperation=$this->addElement("soap:body", $tag); + $soapOperation->setAttribute("use", ($this->use == SOAP_ENCODED)? "encoded" : "literal"); + $soapOperation->setAttribute("namespace", $this->tns); + if($this->use == SOAP_ENCODED) + $soapOperation->setAttribute("encodingStyle", self::NS_ENC); + } + + /** + * Adds an output element to the given parent (an operation tag) + * @param domNode The Parent domNode + * @return domNode The output node + */ + private function addOutput($parent){ + return $this->addInput($parent,false); + } + + /************************* Supporting functions ****************************/ + + private function addToDebug($msg){ + if($this->_debug) echo '-'.$msg."
\n"; + } + + /** + * Adds an child element to the parent + * @param string The name element + * @param domNode + * @return domNode + */ + private function addElement($name, $parent=false, $ns=false){ + if($ns) + $el=$this->doc->createElementNS($ns,$name); + else + $el=$this->doc->createElement($name); + if($parent) + $parent->appendChild($el); + return $el; + } +} ?> \ No newline at end of file diff --git a/webservice/classes/soap/WSException.class.php b/webservice/classes/soap/WSException.class.php index 93c4de4..989e81d 100755 --- a/webservice/classes/soap/WSException.class.php +++ b/webservice/classes/soap/WSException.class.php @@ -1,24 +1,24 @@ -msg = $msg; - } - /** - * @return void - */ - public function Display() { - echo $this->msg; - } -} +msg = $msg; + } + /** + * @return void + */ + public function Display() { + echo $this->msg; + } +} ?> \ No newline at end of file diff --git a/webservice/classes/soap/WSHelper.class.php b/webservice/classes/soap/WSHelper.class.php index a7e82cb..5bd0058 100755 --- a/webservice/classes/soap/WSHelper.class.php +++ b/webservice/classes/soap/WSHelper.class.php @@ -1,183 +1,183 @@ -uri = $uri; - $this->setWSDLCacheFolder($_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['PHP_SELF'])."/wsdl/"); - if($class) $this->setClass($class); - } - - /** - * Adds the given class name to the list of classes - * to be included in the documentation/WSDL/Request handlers - * @param string - * @return void - */ - public function setClass($name){ - $this->name = $name; - $this->wsdlfile = $this->wsdlFolder.$this->name.".wsdl"; - } - - public function setWSDLCacheFolder($folder) { - $this->wsdlFolder = $folder; - //reset wsdlfile - $this->wsdlfile = $this->wsdlFolder.$this->name.".wsdl"; - } - /** - * Sets the persistence level for the soap class - */ - public function setPersistence($persistence) { - $this->persistence = $persistence; - } - - /** - * Handles everything. Makes sure the webservice is handled, - * documentations is generated, or the wsdl is generated, - * according to the page request - * @return void - */ - public function handle(){ - if(substr($_SERVER['QUERY_STRING'], -4) == 'wsdl'){ - $this->showWSDL(); - }elseif(isset($GLOBALS['HTTP_RAW_POST_DATA']) && strlen($GLOBALS['HTTP_RAW_POST_DATA'])>0){ - $this->handleRequest(); - }else{ - $this->createDocumentation(); - } - } - /** - * Checks if the current WSDL is up-to-date, regenerates if necessary and outputs the WSDL - * @return void - */ - public function showWSDL(){ - //check if it's a legal webservice class - if(!in_array($this->name, $this->classNameArr)) - throw new Exception("No valid webservice class."); - - //@TODO: nog een mooie oplossing voor het cachen zoeken - header("Content-type: text/xml"); - if($this->useWSDLCache && file_exists($this->wsdlfile)){ - readfile($this->wsdlfile); - }else{ - //make sure to refresh PHP WSDL cache system - ini_set("soap.wsdl_cache_enabled",0); - echo $this->createWSDL(); - } - } - - private function createWSDL(){ - $this->class = new IPReflectionClass($this->name); - $wsdl = new WSDLStruct($this->uri, "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']."?class=".$this->name, $this->type, $this->use); - $wsdl->setService($this->class); - - try { - $gendoc = $wsdl->generateDocument(); - } catch (WSDLException $exception) { - $exception->Display(); - exit(); - } - - $fh = fopen($this->wsdlfile, "w+"); - fwrite($fh, $gendoc); - fclose($fh); - - return $gendoc; - } - - /** - * Lets the native PHP5 soap implementation handle the request - * after registrating the class - * @return void - */ - private function handleRequest(){ - //check if it's a legal webservice class - if(!in_array($this->name, $this->classNameArr)) - throw new Exception("No valid webservice class."); - - //check cache - //if(!file_exists($this->wsdlfile)) - $this->createWSDL(); - - $options = Array('actor' => $this->actor, 'classmap' => $this->structureMap); - - header("Content-type: text/xml"); - $this->server = new SoapServer($this->wsdlfile, $options); - $this->server->setClass($this->name); - $this->server->setPersistence($this->persistence); - - use_soap_error_handler(true); - $this->server->handle(); - } - - /** - * @param string code - * @param string string - * @param string actor - * @param mixed details - * @param string name - * @return void - */ - public function fault($code, $string, $actor, $details, $name='') { - return $this->server->fault($code, $string, $actor, $details, $name); - } - - /** - * Generates the documentations for the webservice usage. - * @TODO: "int", "boolean", "double", "float", "string", "void" - * @param string Template filename - * @return void - */ - public function createDocumentation($template="classes/soap/templates/docclass.xsl") { - if(!is_file($template)) - throw new WSException("Could not find the template file: '$template'"); - $this->class = new IPReflectionClass($this->name); - $xtpl = new IPXSLTemplate($template); - $documentation = Array(); - $documentation['menu'] = Array(); - //loop menu items - sort($this->classNameArr); - foreach($this->classNameArr as $className) { - $documentation['menu'][] = new IPReflectionClass($className); - } - - if($this->class){ - $this->class->properties = $this->class->getProperties(false, false); - $this->class->methods = $this->class->getMethods(false, false); - foreach((array)$this->class->methods as $method) { - $method->params = $method->getParameters(); - } - - $documentation['class'] = $this->class; - } - echo $xtpl->execute($documentation); - } -} +uri = $uri; + $this->setWSDLCacheFolder($_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['PHP_SELF'])."/wsdl/"); + if($class) $this->setClass($class); + } + + /** + * Adds the given class name to the list of classes + * to be included in the documentation/WSDL/Request handlers + * @param string + * @return void + */ + public function setClass($name){ + $this->name = $name; + $this->wsdlfile = $this->wsdlFolder.$this->name.".wsdl"; + } + + public function setWSDLCacheFolder($folder) { + $this->wsdlFolder = $folder; + //reset wsdlfile + $this->wsdlfile = $this->wsdlFolder.$this->name.".wsdl"; + } + /** + * Sets the persistence level for the soap class + */ + public function setPersistence($persistence) { + $this->persistence = $persistence; + } + + /** + * Handles everything. Makes sure the webservice is handled, + * documentations is generated, or the wsdl is generated, + * according to the page request + * @return void + */ + public function handle(){ + if(substr($_SERVER['QUERY_STRING'], -4) == 'wsdl'){ + $this->showWSDL(); + }elseif(isset($GLOBALS['HTTP_RAW_POST_DATA']) && strlen($GLOBALS['HTTP_RAW_POST_DATA'])>0){ + $this->handleRequest(); + }else{ + $this->createDocumentation(); + } + } + /** + * Checks if the current WSDL is up-to-date, regenerates if necessary and outputs the WSDL + * @return void + */ + public function showWSDL(){ + //check if it's a legal webservice class + if(!in_array($this->name, $this->classNameArr)) + throw new Exception("No valid webservice class."); + + //@TODO: nog een mooie oplossing voor het cachen zoeken + header("Content-type: text/xml"); + if($this->useWSDLCache && file_exists($this->wsdlfile)){ + readfile($this->wsdlfile); + }else{ + //make sure to refresh PHP WSDL cache system + ini_set("soap.wsdl_cache_enabled",0); + echo $this->createWSDL(); + } + } + + private function createWSDL(){ + $this->class = new IPReflectionClass($this->name); + $wsdl = new WSDLStruct($this->uri, "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']."?class=".$this->name, $this->type, $this->use); + $wsdl->setService($this->class); + + try { + $gendoc = $wsdl->generateDocument(); + } catch (WSDLException $exception) { + $exception->Display(); + exit(); + } + + $fh = fopen($this->wsdlfile, "w+"); + fwrite($fh, $gendoc); + fclose($fh); + + return $gendoc; + } + + /** + * Lets the native PHP5 soap implementation handle the request + * after registrating the class + * @return void + */ + private function handleRequest(){ + //check if it's a legal webservice class + if(!in_array($this->name, $this->classNameArr)) + throw new Exception("No valid webservice class."); + + //check cache + //if(!file_exists($this->wsdlfile)) + $this->createWSDL(); + + $options = Array('actor' => $this->actor, 'classmap' => $this->structureMap); + + header("Content-type: text/xml"); + $this->server = new SoapServer($this->wsdlfile, $options); + $this->server->setClass($this->name); + $this->server->setPersistence($this->persistence); + + use_soap_error_handler(true); + $this->server->handle(); + } + + /** + * @param string code + * @param string string + * @param string actor + * @param mixed details + * @param string name + * @return void + */ + public function fault($code, $string, $actor, $details, $name='') { + return $this->server->fault($code, $string, $actor, $details, $name); + } + + /** + * Generates the documentations for the webservice usage. + * @TODO: "int", "boolean", "double", "float", "string", "void" + * @param string Template filename + * @return void + */ + public function createDocumentation($template="classes/soap/templates/docclass.xsl") { + if(!is_file($template)) + throw new WSException("Could not find the template file: '$template'"); + $this->class = new IPReflectionClass($this->name); + $xtpl = new IPXSLTemplate($template); + $documentation = Array(); + $documentation['menu'] = Array(); + //loop menu items + sort($this->classNameArr); + foreach($this->classNameArr as $className) { + $documentation['menu'][] = new IPReflectionClass($className); + } + + if($this->class){ + $this->class->properties = $this->class->getProperties(false, false); + $this->class->methods = $this->class->getMethods(false, false); + foreach((array)$this->class->methods as $method) { + $method->params = $method->getParameters(); + } + + $documentation['class'] = $this->class; + } + echo $xtpl->execute($documentation); + } +} ?> \ No newline at end of file diff --git a/webservice/classes/soap/common.php b/webservice/classes/soap/common.php index 84324cc..44e3721 100755 --- a/webservice/classes/soap/common.php +++ b/webservice/classes/soap/common.php @@ -40,48 +40,48 @@ * @version Version 0.1 */ - -error_reporting(E_ALL); -ob_start("ob_gzhandler"); - -require_once ("config.php"); - -if(!extension_loaded("soap")) - die("Soap extension not loaded!"); - -session_start(); - + +error_reporting(E_ALL); +ob_start("ob_gzhandler"); + +require_once ("config.php"); + +if(!extension_loaded("soap")) + die("Soap extension not loaded!"); + +session_start(); + /** autoload function for PHP5 * Loads all the classes in the model * -*/ -function __autoload($classname) { - try{ - if(file_exists("classes/soap/model/$classname.class.php")) - include("classes/soap/model/$classname.class.php"); - elseif(file_exists("classes/soap/$classname.class.php")) - include("classes/soap/$classname.class.php"); - elseif(file_exists("classes/soap/$classname.class.php")) - include("classes/soap/$classname.class.php"); - } catch (Exception $e) { - echo $e->getMessage(); - } - -} - -/** Write out debug file */ -function debug($txt,$file="debug.txt"){ - $fp = fopen($file, "a"); - fwrite($fp, str_replace("\n","\r\n","\r\n".$txt)); - fclose($fp); -} - -/** Write out object in the debug log */ -function debugObject($txt,$obj){ - ob_start(); - print_r($obj); - $data = ob_get_contents(); - ob_end_clean(); - debug($txt."\n".$data); -} -?> +*/ +function __autoload($classname) { + try{ + if(file_exists("classes/soap/model/$classname.class.php")) + include("classes/soap/model/$classname.class.php"); + elseif(file_exists("classes/soap/$classname.class.php")) + include("classes/soap/$classname.class.php"); + elseif(file_exists("classes/soap/$classname.class.php")) + include("classes/soap/$classname.class.php"); + } catch (Exception $e) { + echo $e->getMessage(); + } + +} + +/** Write out debug file */ +function debug($txt,$file="debug.txt"){ + $fp = fopen($file, "a"); + fwrite($fp, str_replace("\n","\r\n","\r\n".$txt)); + fclose($fp); +} + +/** Write out object in the debug log */ +function debugObject($txt,$obj){ + ob_start(); + print_r($obj); + $data = ob_get_contents(); + ob_end_clean(); + debug($txt."\n".$data); +} +?> diff --git a/webservice/classes/soap/templates/docclass.xsl b/webservice/classes/soap/templates/docclass.xsl index 380bdc4..a1c9648 100755 --- a/webservice/classes/soap/templates/docclass.xsl +++ b/webservice/classes/soap/templates/docclass.xsl @@ -1,116 +1,116 @@ - - - - - - - - Webservices - - - -
-
-
- -

 [WSDL]

-
-
-
-
- - - - - -
- - - - - -

Full description

-

- -

Properties

- - -
-
- - - - - type
-
- - type
-
-
-
- -
missing type info

-
-
- -
-
- -

Methods

- - -
- ( - - - , - - ) -
- - - - - returns
-
- - returns
-
-
-
- -
missing return value

-
-
- - - throws
-
-
-
-
-
-
-
- -
-
-
- - -
+ + + + + + + + Webservices + + + +
+
+
+ +

 [WSDL]

+
+
+
+
+ + + + + +
+ + + + + +

Full description

+

+ +

Properties

+ + +
+
+ + + + + type
+
+ + type
+
+
+
+ +
missing type info

+
+
+ +
+
+ +

Methods

+ + +
+ ( + + + , + + ) +
+ + + + + returns
+
+ + returns
+
+
+
+ +
missing return value

+
+
+ + + throws
+
+
+
+
+
+
+
+ +
+
+
+ + +
\ No newline at end of file diff --git a/webservice/classes/soap/templates/str.replace.function.xsl b/webservice/classes/soap/templates/str.replace.function.xsl index 5d74e86..626e549 100755 --- a/webservice/classes/soap/templates/str.replace.function.xsl +++ b/webservice/classes/soap/templates/str.replace.function.xsl @@ -1,105 +1,105 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ERROR: function implementation of str:replace() relies on exsl:node-set(). - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ERROR: function implementation of str:replace() relies on exsl:node-set(). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/webservice/tests/annotations.php b/webservice/tests/annotations.php index e10ef44..a0ee1ff 100755 --- a/webservice/tests/annotations.php +++ b/webservice/tests/annotations.php @@ -1,44 +1,44 @@ -'you'); - */ -class something{ - /** - * @var string - * @Controller(type => DefaultController::TYPE_PLAIN, length => 100) - */ - public $propertyA; - - /** - * @var string - * @Controller(type => DefaultController::TYPE_HTML, length => 100) - */ - public function methodB () { - return "aap"; - } -} - -/* Annotation example */ -$rel = new IPReflectionClass("something"); -$properties = $rel->getProperties(); -$methods = $rel->getMethods(); - -var_dump($rel->getAnnotation("ann1", "stdClass")); - -$property = $properties["propertyA"]; -$ann = $property->getAnnotation("Controller", "DefaultController"); -var_dump($ann); - -$method = $methods["methodB"]; -$ann = $method->getAnnotation("Controller", "DefaultController"); -var_dump($ann); +'you'); + */ +class something{ + /** + * @var string + * @Controller(type => DefaultController::TYPE_PLAIN, length => 100) + */ + public $propertyA; + + /** + * @var string + * @Controller(type => DefaultController::TYPE_HTML, length => 100) + */ + public function methodB () { + return "aap"; + } +} + +/* Annotation example */ +$rel = new IPReflectionClass("something"); +$properties = $rel->getProperties(); +$methods = $rel->getMethods(); + +var_dump($rel->getAnnotation("ann1", "stdClass")); + +$property = $properties["propertyA"]; +$ann = $property->getAnnotation("Controller", "DefaultController"); +var_dump($ann); + +$method = $methods["methodB"]; +$ann = $method->getAnnotation("Controller", "DefaultController"); +var_dump($ann); ?> \ No newline at end of file