public function setOldValues($object) { $properties = DocBlockParser::parseClass($object)->properties; if (isset($properties[$this->name])) { $this->_oldReadType = $properties[$this->name]['type']; $this->_oldReadComment = $properties[$this->name]['comment']; } else { $key = $this->name . '-write'; if (isset($properties[$key])) { $this->_oldWriteType = $properties[$key]['type']; $this->_oldWriteComment = $properties[$key]['comment']; } $key = $this->name . '-read'; if (isset($properties[$key])) { $this->_oldReadType = $properties[$key]['type']; $this->_oldReadComment = $properties[$key]['comment']; } } }
/** * Get a Service information for a Method * * @param ReflectionMethod $method The method to get the Service Information * @return WsdlMethod The Service Information object */ private function getWsdlMethod(ReflectionMethod $method) { $doc = $method->getDocComment(); $wsdlMethod = new WsdlMethod(); $wsdlMethod->setName($method->getName()); $wsdlMethod->setDesc(DocBlockParser::getDescription($doc)); $params = DocBlockParser::getTagInfo($doc); for ($i = 0, $c = count($params); $i < $c; $i++) { foreach ($params[$i] as $tag => $param) { switch ($tag) { case "@param": if (isset($param['type']) && isset($param['name'])) { $wsdlMethod->addParameter($param['type'], $param['name'], $param['desc']); } break; case "@return": $wsdlMethod->setReturn($param['type'], $param['desc']); default: break; } } } return $wsdlMethod; }
public function setOldValues($object) { parent::_setOldValues(DocBlockParser::parseClass($object)->methods); }
/** * @return string[] */ protected function getDocTags() { if (null === $this->docTags) { $this->docTags = DocBlockParser::parse($this->getReflector()->getDocComment()); } return $this->docTags; }
/** * @param $class * @param $object * * @return string final dockBlock */ protected function getDockBlock($class, $object) { $props = $this->getPropertyIterator($object); $parser = DocBlockParser::parseClass($class); //add commets and stars :-) $result = "/** \n"; foreach (explode("\n", $this->getRawDockBlock($parser, $props)) as $line) { $result .= " * " . trim($line) . PHP_EOL; } return $result . " */"; }
/** * Get information for a Property * * @param ReflectionProperty $property The property to get Information for * @return WsdlService The Service Information object */ private static function getWsdlProperty(ReflectionProperty $property) { $propertyInfo = DocBlockParser::getPropertyInfo($property); // Return Nothing if the Property Was not Documented if (!isset($propertyInfo['type']) || $propertyInfo['type'] == "") { return null; } $wsdlProperty = new WsdlProperty(); $wsdlProperty->setName($property->getName()); $wsdlProperty->setType($propertyInfo['type']); $wsdlProperty->setDesc($propertyInfo['desc']); return $wsdlProperty; }
/** * get users properties * * @return array */ public function getUsers($object, $props) { //try to get or set all @property from current doc, for finding user writable properties $parser = DocBlockParser::parseClass(get_class($object)); $tmp = array(); foreach ($parser->properties as $prop => $data) { if (array_key_exists($prop, $props)) { continue; } try { $object->{$prop}; } catch (Exception $e) { try { $object->{$prop} = true; } catch (Exception $e) { continue; } } $tmp[] = $prop; } $res = $this->instantAll($tmp, $this->propertyOptions); $tmp = array(); foreach ($parser->methods as $method => $data) { if (array_key_exists($method, $props)) { continue; } try { $object->{$method}(); } catch (Exception $e) { continue; } $tmp[] = $method; } $res = array_merge($res, $this->instantAll($tmp, $this->methodOptions)); $this->addComment($res, 'users'); return $res; }
/** * Get a Service information for a Method * * @param ReflectionMethod $method The method to get the Service Information * @return WsdlMethod The Service Information object */ private function getWsdlMethod(ReflectionMethod $method) { $doc = $method->getDocComment(); $wsdlMethod = new WsdlMethod(); $wsdlMethod->setName($method->getName()); $wsdlMethod->setDesc(DocBlockParser::getDescription($doc)); $params = DocBlockParser::getTagInfo($doc); for ($i = 0, $c = count($params); $i < $c; $i++) { foreach ($params[$i] as $tag => $param) { switch ($tag) { case "@param": if (isset($param['type']) && isset($param['name'])) { $wsdlMethod->addParameter($param['type'], $param['name'], $param['desc']); } break; case "@return": $wsdlMethod->setReturn($param['type'], $param['desc']); break; case "@internal": if (trim(strtolower($param['usage'])) == 'soapheader') { $wsdlMethod->setIsHeader(true); } if (substr(trim(strtolower($param['usage'])), 0, 13) == 'soaprequires ') { $wsdlMethod->setRequiredHeaders(explode(' ', substr(trim($param['usage']), 13))); } break; default: break; } } } return $wsdlMethod; }