cvs: pear /Services_Webservice/Webservice Definition.php
| From: | Philippe Jausions | Date: | Mon, 19 Sep 2005 17:30:14 +0000 |
| Subject: | cvs: pear /Services_Webservice/Webservice Definition.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-34868@lists.php.net to get a copy of this message | ||
jausions Mon Sep 19 13:30:14 2005 EDT
Modified files:
/pear/Services_Webservice/Webservice Definition.php
Log:
Fixed typo in docblock
Added a isMethodExposed() method
http://cvs.php.net/diff.php/pear/Services_Webservice/Webservice/Definition.php?r1=1.18&r2=1.19&ty=u
Index: pear/Services_Webservice/Webservice/Definition.php
diff -u pear/Services_Webservice/Webservice/Definition.php:1.18
pear/Services_Webservice/Webservice/Definition.php:1.19
--- pear/Services_Webservice/Webservice/Definition.php:1.18 Sun Aug 14 23:36:08 2005
+++ pear/Services_Webservice/Webservice/Definition.php Mon Sep 19 13:30:13 2005
@@ -19,7 +19,7 @@
* @author Philippe Jausions <Philippe.Jausions@11abacus.com>
* @copyright 2005 The PHP Group
* @license http://www.php.net/license/3_0.txt
PHP License 3.0
- * @version CVS: $Id: Definition.php,v 1.18 2005/08/15 03:36:08 jausions Exp $
+ * @version CVS: $Id: Definition.php,v 1.19 2005/09/19 17:30:13 jausions Exp $
* @link http://pear.php.net/package/Services_Webservice
*/
@@ -162,7 +162,7 @@
/**
* Returns the structure of classes as parsed by intoStruct
*
- * @retirn array
+ * @return array
* @access public
*/
public function getStruct()
@@ -560,6 +560,53 @@
return $info;
}
+
+ /**
+ * Checks if a given method is exposed for the web service
+ *
+ * @param string $methodName method name to check accessibility for
+ * @return boolean TRUE if exposed, FALSE otherwise
+ * @access public
+ * @throws Services_Webservice_Definition_NoDocCommentException
+ * @throws Services_Webservice_Definition_Exception
+ */
+ public function isMethodExposed($methodName)
+ {
+ if ($this->_wsdlStruct) {
+ return isset($this->_wsdlStruct[$this->_classname][$methodName]);
+ }
+
+ if (in_array($methodName, $this->_hiddenMethods)) {
+ return false;
+ }
+
+ $class = new ReflectionClass($this->_classname);
+ if (!$class->hasMethod($methodName)) {
+ return false;
+ }
+ $method = $class->getMethod($methodName);
+
+ if (!$method->isPublic()) {
+ return false;
+ }
+
+ try {
+ $docComments = $this->_parseDocBlock($method->getDocComment());
+ } catch (Services_Webservice_Definition_Exception $e) {
+ throw new Services_Webservice_Definition_Exception('Error in ' .
$this->_classname . '::' . $methodName . '() docblock', $e);
+ }
+
+ if (!$docComments) {
+ throw new Services_Webservice_Definition_NoDocCommentException('empty or missing
docblock for ' . $this->_classname . '::' . $methodName . '() method');
+ }
+
+ // Skip method?
+ if (isset($docComments['webservice.hidden'])) {
+ return false;
+ }
+
+ return true;
+ }
}
?>
\ No newline at end of file