From 418dd9dd40bd9dc26301ac43ad482c4bf63681e2 Mon Sep 17 00:00:00 2001 From: gggeek Date: Sat, 7 Jan 2023 09:55:13 +0000 Subject: [PATCH] more phpdoc to help phpdocumentor --- src/Client.php | 54 +++++++++++++++++++++++++------ src/Encoder.php | 11 +++++-- src/Helper/Charset.php | 4 +-- src/Helper/Date.php | 5 ++- src/Helper/Http.php | 2 -- src/Helper/Logger.php | 2 ++ src/Helper/XMLParser.php | 9 +++++- src/PhpXmlRpc.php | 69 +++++++++++++++++++++++++++++++--------- src/Request.php | 24 +++++++++----- src/Response.php | 8 +++-- src/Server.php | 42 ++++++++++++++++-------- src/Value.php | 29 +++++++++-------- src/Wrapper.php | 21 +++--------- 13 files changed, 189 insertions(+), 91 deletions(-) diff --git a/src/Client.php b/src/Client.php index 95e91c19..5b9686b2 100644 --- a/src/Client.php +++ b/src/Client.php @@ -50,6 +50,10 @@ class Client public $cookies = array(); public $extracurlopts = array(); + + /** + * @var int + */ public $use_curl = self::USE_CURL_AUTO; /** @@ -63,6 +67,8 @@ class Client public $no_multicall = false; /** + * @var array + * * List of http compression methods accepted by the client for responses. * NB: PHP supports deflate, gzip compressions out of the box if compiled w. zlib. * @@ -73,8 +79,10 @@ class Client public $accepted_compression = array(); /** + * @var string|null + * * Name of compression scheme to be used for sending requests. - * Either null, gzip or deflate. + * Either null, 'gzip' or 'deflate'. */ public $request_compression = ''; @@ -84,13 +92,23 @@ class Client */ public $xmlrpc_curl_handle = null; - /// Whether to use persistent connections for http 1.1 and https + /** + * @var bool + * + * Whether to use persistent connections for http 1.1 and https. + */ public $keepalive = false; - /// Charset encodings that can be decoded without problems by the client + /** + * @var string[] + * + * Charset encodings that can be decoded without problems by the client + */ public $accepted_charset_encodings = array(); /** + * @var string + * * The charset encoding that will be used for serializing request sent by the client. * It defaults to NULL, which means using US-ASCII and encoding all characters outside the ASCII printable range * using their xml character entity representation (this has the benefit that line end characters will not be mangled @@ -101,6 +119,8 @@ class Client public $request_charset_encoding = ''; /** + * @var string + * * Decides the content of Response objects returned by calls to send() and multicall(). * Valid values are 'xmlrpcvals', 'phpvals' or 'xml'. * @@ -116,6 +136,8 @@ class Client public $return_type = XMLParser::RETURN_XMLRPCVALS; /** + * @var string + * * Sent to servers in http headers. */ public $user_agent; @@ -128,6 +150,10 @@ class Client return self::$logger; } + /** + * @param $logger + * @return void + */ public static function setLogger($logger) { self::$logger = $logger; @@ -230,6 +256,7 @@ class Client * the server returns. Never leave it enabled for production! * * @param integer $level values 0, 1 and 2 are supported (2 = echo sent msg too, before received response) + * @return void */ public function setDebug($level) { @@ -249,6 +276,7 @@ class Client * @param integer $authType auth type. See curl_setopt man page for supported auth types. Defaults to CURLAUTH_BASIC * (basic auth). Note that auth types NTLM and Digest will only work if the Curl php * extension is enabled. + * @return void */ public function setCredentials($user, $password, $authType = 1) { @@ -266,6 +294,7 @@ class Client * * @param string $cert the name of a file containing a PEM formatted certificate * @param string $certPass the password required to use it + * @return void */ public function setCertificate($cert, $certPass = '') { @@ -280,6 +309,7 @@ class Client * * @param string $caCert certificate file name (or dir holding certificates) * @param bool $isDir set to true to indicate cacert is a dir. defaults to false + * @return void */ public function setCaCertificate($caCert, $isDir = false) { @@ -298,6 +328,7 @@ class Client * * @param string $key The name of a file containing a private SSL key * @param string $keyPass The secret password needed to use the private SSL key + * @return void */ public function setKey($key, $keyPass) { @@ -313,6 +344,7 @@ class Client * To specify custom SSL certificates to validate the server with, use the setCaCertificate method. * * @param bool $i enable/disable verification of peer certificate + * @return void */ public function setSSLVerifyPeer($i) { @@ -325,6 +357,7 @@ class Client * Note that support for value 1 has been removed in cURL 7.28.1 * * @param int $i Set to 1 to only the existence of a CN, not that it matches + * @return void */ public function setSSLVerifyHost($i) { @@ -335,6 +368,7 @@ class Client * Set attributes for SSL communication: SSL version to use. Best left at 0 (default value): let cURL decide * * @param int $i + * @return void */ public function setSSLVersion($i) { @@ -352,6 +386,7 @@ class Client * @param string $proxyPassword Leave blank if proxy has public access * @param int $proxyAuthType defaults to CURLAUTH_BASIC (Basic authentication protocol); set to constant CURLAUTH_NTLM * to use NTLM auth with proxy (has effect only when the client uses the HTTP 1.1 protocol) + * @return void */ public function setProxy($proxyHost, $proxyPort, $proxyUsername = '', $proxyPassword = '', $proxyAuthType = 1) { @@ -371,6 +406,7 @@ class Client * It is up to the xmlrpc server to return compressed responses when receiving such requests. * * @param string $compMethod either 'gzip', 'deflate', 'any' or '' + * @return void */ public function setAcceptedCompression($compMethod) { @@ -391,6 +427,7 @@ class Client * uncompressed requests is not yet implemented). * * @param string $compMethod either 'gzip', 'deflate' or '' + * @return void */ public function setRequestCompression($compMethod) { @@ -411,6 +448,7 @@ class Client * @param string $path leave this empty unless the xml-rpc server only accepts RFC 2109 cookies * @param string $domain leave this empty unless the xml-rpc server only accepts RFC 2109 cookies * @param int $port leave this empty unless the xml-rpc server only accepts RFC 2109 cookies + * @return void * * @todo check correctness of urlencoding cookie value (copied from php way of doing it, but php is generally sending * response not requests. We do the opposite...) @@ -435,6 +473,7 @@ class Client * It allows eg. to bind client to a specific IP interface / address. * * @param array $options + * @return void */ public function setCurlOptions($options) { @@ -443,6 +482,7 @@ class Client /** * @param int $useCurlMode self::USE_CURL_ALWAYS, self::USE_CURL_AUTO or self::USE_CURL_NEVER + * @return void */ public function setUseCurl($useCurlMode) { @@ -456,6 +496,7 @@ class Client * The default user agent string includes the name of this library and the version number. * * @param string $agentString + * @return void */ public function setUserAgent($agentString) { @@ -488,7 +529,6 @@ class Client * for http/2 without tls. Note that 'h2c' will not use the h2c 'upgrade' method, and be * thus incompatible with any server/proxy not supporting http/2. This is because POST * request are not compatible with h2c upgrade. - * * @return Response|Response[] Note that the client will always return a Response object, even if the call fails * * @todo allow throwing exceptions instead of returning responses in case of failed calls and/or Fault responses @@ -589,7 +629,6 @@ class Client * @param string $proxyPassword * @param int $proxyAuthType * @param string $method - * * @return Response */ protected function sendPayloadHTTP10($req, $server, $port, $timeout = 0, $username = '', $password = '', @@ -624,7 +663,6 @@ class Client * @param string $key * @param string $keyPass * @param int $sslVersion - * * @return Response */ protected function sendPayloadHTTPS($req, $server, $port, $timeout = 0, $username = '', $password = '', @@ -660,7 +698,6 @@ class Client * @param string $key * @param string $keyPass @todo not implemented yet. * @param int $sslVersion @todo not implemented yet. See http://php.net/manual/en/migration56.openssl.php - * * @return Response * * @todo refactor: we get many options for the call passed in, but some we use from $this. We should clean that up @@ -886,7 +923,6 @@ class Client * @param string $key * @param string $keyPass * @param int $sslVersion - * * @return Response * * @todo refactor: we get many options for the call passed in, but some we use from $this. We should clean that up @@ -1197,7 +1233,6 @@ class Client * @param string $method the http protocol variant to be used. See the details in the docs for the send() method * @param boolean $fallback When true, upon receiving an error during multicall, multiple single calls will be * attempted - * * @return Response[] */ public function multicall($reqs, $timeout = 0, $method = '', $fallback = true) @@ -1256,7 +1291,6 @@ class Client * @param Request[] $reqs * @param int $timeout * @param string $method - * * @return Response[]|string|false|Response string when return_type=xml, a single Response when the call returned a * fault, false when the returned response does not conform to what we expect * from a multicall response diff --git a/src/Encoder.php b/src/Encoder.php index 4890ff35..063afc6e 100644 --- a/src/Encoder.php +++ b/src/Encoder.php @@ -24,6 +24,10 @@ class Encoder return self::$logger; } + /** + * @param $logger + * @return void + */ public static function setLogger($logger) { self::$logger = $logger; @@ -37,6 +41,10 @@ class Encoder return self::$parser; } + /** + * @param $parser + * @return void + */ public static function setParser($parser) { self::$parser = $parser; @@ -64,7 +72,6 @@ class Encoder * objects, see the details above; * - 'dates_as_objects': when set xmlrpc dateTimes are decoded as php DateTime objects * - 'extension_api': reserved for usage by phpxmlrpc-polyfill - * * @return mixed * * Feature creep -- add an option to allow converting xmlrpc dateTime values to unix timestamps (integers) @@ -186,7 +193,6 @@ class Encoder * - 'auto_dates': when set, any string which respects the xmlrpc datetime format will be converted to a dateTime Value * - 'null_extension': when set, php NULL values will be converted to an xmlrpc (or ) Value * - 'extension_api': reserved for usage by phpxmlrpc-polyfill - * * @return Value * * Feature creep -- could support more types via optional type argument (string => datetime support has been added, @@ -300,7 +306,6 @@ class Encoder * * @param string $xmlVal * @param array $options - * * @return Value|Request|Response|false false on error, or an instance of either Value, Request or Response * * @todo is this a good name/class for this method? It does something quite different from 'decode' after all diff --git a/src/Helper/Charset.php b/src/Helper/Charset.php index c04fe6b5..0e2196e2 100644 --- a/src/Helper/Charset.php +++ b/src/Helper/Charset.php @@ -50,6 +50,7 @@ class Charset /** * @param string $tableName + * @return void * * @throws \Exception for unsupported $tableName * @@ -127,7 +128,6 @@ class Charset * @param string $data * @param string $srcEncoding * @param string $destEncoding - * * @return string * * @todo do a bit of basic benchmarking (strtr vs. str_replace) @@ -285,7 +285,6 @@ class Charset * * @param string $encoding charset to be tested * @param string|array $validList comma separated list of valid charsets (or array of charsets) - * * @return bool */ public function isValidCharset($encoding, $validList) @@ -313,7 +312,6 @@ class Charset * @deprecated * * @param string $charset - * * @return array * @throws \Exception for unknown/unsupported charsets */ diff --git a/src/Helper/Date.php b/src/Helper/Date.php index 12301adf..2c8c790f 100644 --- a/src/Helper/Date.php +++ b/src/Helper/Date.php @@ -19,8 +19,7 @@ class Date * adjustment for the local timezone's offset is made * * @param int $timet (timestamp) - * @param int $utc (0 or 1) - * + * @param bool|int $utc (0 or 1) * @return string */ public static function iso8601Encode($timet, $utc = 0) @@ -38,7 +37,7 @@ class Date * Given an ISO8601 date string, return a timestamp in the localtime, or UTC. * * @param string $idate - * @param int $utc either 0 (assume date is in local time) or 1 (assume date is in UTC) + * @param bool|int $utc either 0 (assume date is in local time) or 1 (assume date is in UTC) * * @return int (timestamp) 0 if the source string does not match the xmlrpc dateTime format */ diff --git a/src/Helper/Http.php b/src/Helper/Http.php index e3f4e805..38cfab6b 100644 --- a/src/Helper/Http.php +++ b/src/Helper/Http.php @@ -14,7 +14,6 @@ class Http * @internal this function will become protected in the future * * @param string $buffer the string to be decoded - * * @return string */ public static function decodeChunked($buffer) @@ -68,7 +67,6 @@ class Http * @param string $data the http response, headers and body. It will be stripped of headers * @param bool $headersProcessed when true, we assume that response inflating and dechunking has been already carried out * @param int $debug when != 0, logs to screen messages detailing info about the parsed data - * * @return array with keys 'headers', 'cookies', 'raw_data' and 'status_code' * @throws HttpException * diff --git a/src/Helper/Logger.php b/src/Helper/Logger.php index 54b3be4d..1f452c4f 100644 --- a/src/Helper/Logger.php +++ b/src/Helper/Logger.php @@ -31,6 +31,7 @@ class Logger * * @param string $message * @param string $encoding + * @return void */ public function debugMessage($message, $encoding = null) { @@ -64,6 +65,7 @@ class Logger /** * Writes a message to the error log. * @param string $message + * @return void */ public function errorLog($message) { diff --git a/src/Helper/XMLParser.php b/src/Helper/XMLParser.php index f1678b43..375424cf 100644 --- a/src/Helper/XMLParser.php +++ b/src/Helper/XMLParser.php @@ -99,6 +99,7 @@ class XMLParser * @param string $returnType * @param int $accept a bit-combination of self::ACCEPT_REQUEST, self::ACCEPT_RESPONSE, self::ACCEPT_VALUE * @param array $options passed to the xml parser, in addition to the options received in the constructor + * @return void */ public function parse($data, $returnType = self::RETURN_XMLRPCVALS, $accept = 3, $options = array()) { @@ -180,6 +181,7 @@ class XMLParser * @param string $name * @param $attrs * @param bool $acceptSingleVals DEPRECATED use the $accept parameter instead + * @return void */ public function xmlrpc_se($parser, $name, $attrs, $acceptSingleVals = false) { @@ -344,6 +346,7 @@ class XMLParser * @param resource $parser * @param $name * @param $attrs + * @return void */ public function xmlrpc_se_any($parser, $name, $attrs) { @@ -357,6 +360,7 @@ class XMLParser * @param resource $parser * @param string $name * @param int $rebuildXmlrpcvals >1 for rebuilding xmlrpcvals, 0 for rebuilding php values, -1 for xmlrpc-extension compatibility + * @return void */ public function xmlrpc_ee($parser, $name, $rebuildXmlrpcvals = 1) { @@ -544,6 +548,7 @@ class XMLParser * * @param resource $parser * @param string $name + * @return void */ public function xmlrpc_ee_fast($parser, $name) { @@ -556,6 +561,7 @@ class XMLParser * * @param resource $parser * @param string $name + * @return void */ public function xmlrpc_ee_epi($parser, $name) { @@ -568,6 +574,7 @@ class XMLParser * * @param resource $parser * @param string $data + * @return void */ public function xmlrpc_cd($parser, $data) { @@ -588,6 +595,7 @@ class XMLParser * * @param $parser * @param string data + * @return void */ public function xmlrpc_dh($parser, $data) { @@ -703,7 +711,6 @@ class XMLParser * Helper function: checks if an xml chunk has a charset declaration (BOM or in the xml declaration). * * @param string $xmlChunk - * * @return bool */ public static function hasEncoding($xmlChunk) diff --git a/src/PhpXmlRpc.php b/src/PhpXmlRpc.php index aae219b8..3d7faa12 100644 --- a/src/PhpXmlRpc.php +++ b/src/PhpXmlRpc.php @@ -7,6 +7,9 @@ namespace PhpXmlRpc; */ class PhpXmlRpc { + /** + * @var int[] + */ static public $xmlrpcerr = array( 'unknown_method' => 1, /// @deprecated. left in for BC @@ -42,6 +45,9 @@ class PhpXmlRpc 'server_decompress_fail' => 107, ); + /** + * @var string[] + */ static public $xmlrpcstr = array( 'unknown_method' => 'Unknown method', /// @deprecated. left in for BC @@ -76,44 +82,75 @@ class PhpXmlRpc 'server_decompress_fail' => 'Received from client invalid compressed HTTP request', ); - // The charset encoding used by the server for received requests and by the client for received responses when - // received charset cannot be determined and mbstring extension is not enabled + /** + * @var string + * The charset encoding used by the server for received requests and by the client for received responses when + * received charset cannot be determined and mbstring extension is not enabled. + */ public static $xmlrpc_defencoding = "UTF-8"; - // The list of encodings used by the server for requests and by the client for responses to detect the charset of - // the received payload when - // - the charset cannot be determined by looking at http headers, xml declaration or BOM - // - mbstring extension is enabled + /** + * @var string[] + * The list of encodings used by the server for requests and by the client for responses to detect the charset of + * the received payload when + * - the charset cannot be determined by looking at http headers, xml declaration or BOM + * - mbstring extension is enabled + */ public static $xmlrpc_detectencodings = array(); - // The encoding used internally by PHP. - // String values received as xml will be converted to this, and php strings will be converted to xml as if - // having been coded with this. - // Valid also when defining names of xmlrpc methods + /** + * @var string + * The encoding used internally by PHP. + * String values received as xml will be converted to this, and php strings will be converted to xml as if + * having been coded with this. + * Valid also when defining names of xmlrpc methods + */ public static $xmlrpc_internalencoding = "UTF-8"; + /** + * @var string + */ public static $xmlrpcName = "XML-RPC for PHP"; + /** + * @var string + */ public static $xmlrpcVersion = "4.9.3"; - // let user errors start at 800 + /** + * @var int + * Let user errors start at 800 + */ public static $xmlrpcerruser = 800; - // let XML parse errors start at 100 + /** + * @var int + * Let XML parse errors start at 100 + */ public static $xmlrpcerrxml = 100; - // set to TRUE to enable correct decoding of and values + /** + * @var bool + * Set to TRUE to enable correct decoding of and values + */ public static $xmlrpc_null_extension = false; - // set to TRUE to enable encoding of php NULL values to instead of + /** + * @var bool + * Set to TRUE to enable encoding of php NULL values to instead of + */ public static $xmlrpc_null_apache_encoding = false; public static $xmlrpc_null_apache_encoding_ns = "http://ws.apache.org/xmlrpc/namespaces/extensions"; - // number of decimal digits used to serialize Double values + /** + * @var int + * Number of decimal digits used to serialize Double values. + */ public static $xmlpc_double_precision = 128; /** * A function to be used for compatibility with legacy code: it creates all global variables which used to be declared, * such as library version etc... + * @return void */ public static function exportGlobals() { @@ -152,6 +189,8 @@ class PhpXmlRpc * 2. set the values, e.g. $GLOBALS['xmlrpc_internalencoding'] = 'UTF-8'; * 3. import them: PhpXmlRpc\PhpXmlRpc::importGlobals(); * 4. run your own code. + * + * @return void */ public static function importGlobals() { diff --git a/src/Request.php b/src/Request.php index 00313202..12f2cd39 100644 --- a/src/Request.php +++ b/src/Request.php @@ -39,6 +39,10 @@ class Request return self::$logger; } + /** + * @param $logger + * @return void + */ public static function setLogger($logger) { self::$logger = $logger; @@ -52,6 +56,10 @@ class Request return self::$parser; } + /** + * @param $parser + * @return void + */ public static function setParser($parser) { self::$parser = $parser; @@ -65,7 +73,12 @@ class Request return self::$charsetEncoder; } - /// @todo this should be a static method + /** + * @param $charsetEncoder + * @return void + * + * @todo this should be a static method + */ public function setCharsetEncoder($charsetEncoder) { self::$charsetEncoder = $charsetEncoder; @@ -87,7 +100,6 @@ class Request * @internal this function will become protected in the future * * @param string $charsetEncoding - * * @return string */ public function xml_header($charsetEncoding = '') @@ -113,6 +125,7 @@ class Request * @internal this function will become protected in the future * * @param string $charsetEncoding + * @return void */ public function createPayload($charsetEncoding = '') { @@ -137,7 +150,6 @@ class Request * Gets/sets the xmlrpc method to be invoked. * * @param string $methodName the method to be set (leave empty not to set it) - * * @return string the method that will be invoked */ public function method($methodName = '') @@ -153,7 +165,6 @@ class Request * Returns xml representation of the message. XML prologue included. * * @param string $charsetEncoding - * * @return string the xml representation of the message, xml prologue included */ public function serialize($charsetEncoding = '') @@ -168,7 +179,6 @@ class Request * Checks that $params is actually a Value object and not a plain php value. * * @param Value $param - * * @return boolean false on failure */ public function addParam($param) @@ -187,7 +197,6 @@ class Request * Returns the nth parameter in the request. The index zero-based. * * @param integer $i the index of the parameter to fetch (zero based) - * * @return Value the i-th parameter */ public function getParam($i) @@ -216,7 +225,6 @@ class Request * @param resource $fp stream pointer * @param bool $headersProcessed * @param string $returnType - * * @return Response */ public function parseResponseFile($fp, $headersProcessed = false, $returnType = 'xmlrpcvals') @@ -238,7 +246,6 @@ class Request * consequent decoding * @param string $returnType decides return type, i.e. content of response->value(). Either 'xmlrpcvals', 'xml' or * 'phpvals' - * * @return Response * * @todo parsing Responses is not really the responsibility of the Request class. Maybe of the Client... @@ -422,6 +429,7 @@ class Request * Enables/disables the echoing to screen of the xmlrpc responses received. * * @param integer $level values 0, 1, 2 are supported + * @return void */ public function setDebug($level) { diff --git a/src/Response.php b/src/Response.php index afde3ba9..5d297ab6 100644 --- a/src/Response.php +++ b/src/Response.php @@ -38,7 +38,12 @@ class Response return self::$charsetEncoder; } - /// @todo this should be a static method + /** + * @param $charsetEncoder + * @return void + * + * @todo this should be a static method + */ public function setCharsetEncoder($charsetEncoder) { self::$charsetEncoder = $charsetEncoder; @@ -144,7 +149,6 @@ class Response * Returns xml representation of the response. XML prologue not included. * * @param string $charsetEncoding the charset to be used for serialization. If null, US-ASCII is assumed - * * @return string the xml representation of the response * @throws \Exception */ diff --git a/src/Server.php b/src/Server.php index a483b384..02463210 100644 --- a/src/Server.php +++ b/src/Server.php @@ -16,6 +16,7 @@ class Server protected static $charsetEncoder; /** + * @var string * Defines how functions in dmap will be invoked: either using an xmlrpc request object or plain php values. * Valid strings are 'xmlrpcvals', 'phpvals' or 'epivals'. * @@ -24,6 +25,7 @@ class Server public $functions_parameters_type = 'xmlrpcvals'; /** + * @var array * Option used for fine-tuning the encoding the php values returned from functions registered in the dispatch map * when the functions_parameters_types member is set to 'phpvals'. * @see Encoder::encode for a list of values @@ -31,12 +33,14 @@ class Server public $phpvals_encoding_options = array('auto_dates'); /** + * @var int * Controls whether the server is going to echo debugging messages back to the client as comments in response body. * Valid values: 0,1,2,3 */ public $debug = 1; /** + * @var int * Controls behaviour of server when the invoked user function throws an exception: * 0 = catch it and return an 'internal error' xmlrpc response (default) * 1 = catch it and return an xmlrpc response with the error corresponding to the exception @@ -45,6 +49,7 @@ class Server public $exception_handling = 0; /** + * @var bool * When set to true, it will enable HTTP compression of the response, in case the client has declared its support * for compression in the request. * Set at constructor time. @@ -52,12 +57,14 @@ class Server public $compress_response = false; /** + * @var string[] * List of http compression methods accepted by the server for requests. Set at constructor time. * NB: PHP supports deflate, gzip compressions out of the box if compiled w. zlib */ public $accepted_compression = array(); /** + * @var bool * Shall we serve calls to system.* methods? */ public $allow_system_funcs = true; @@ -70,6 +77,7 @@ class Server public $accepted_charset_encodings = array(); /** + * @var string * Charset encoding to be used for response. * NB: if we can, we will convert the generated response from internal_encoding to the intended one. * Can be: a supported xml encoding (only UTF-8 and ISO-8859-1 at present, unless mbstring is enabled), @@ -80,6 +88,7 @@ class Server public $response_charset_encoding = ''; /** + * @var mixed * Extra data passed at runtime to method handling functions. Used only by EPI layer */ public $user_data = null; @@ -107,6 +116,10 @@ class Server return self::$logger; } + /** + * @param $logger + * @return void + */ public static function setLogger($logger) { self::$logger = $logger; @@ -120,6 +133,10 @@ class Server return self::$parser; } + /** + * @param $parser + * @return void + */ public static function setParser($parser) { self::$parser = $parser; @@ -133,7 +150,12 @@ class Server return self::$charsetEncoder; } - /// @todo this should be a static method + /** + * @param $charsetEncoder + * @return void + * + * @todo this should be a static method + */ public function setCharsetEncoder($charsetEncoder) { self::$charsetEncoder = $charsetEncoder; @@ -189,6 +211,7 @@ class Server * particular, triggering an USER_ERROR level error will not halt script * execution anymore, but just end up logged in the xmlrpc response) * Note that info added at level 2 and 3 will be base64 encoded + * @return void */ public function setDebug($level) { @@ -201,6 +224,7 @@ class Server * character set. * * @param string $msg + * @return void */ public static function xmlrpc_debugmsg($msg) { @@ -212,6 +236,7 @@ class Server * (base64 encoded, only when debug level >= 2) * * @param string $msg + * @return void */ public static function error_occurred($msg) { @@ -355,6 +380,7 @@ class Server * @param string $doc method documentation * @param array[] $sigDoc the array of valid method signatures docs, following the format of $sig but with * descriptions instead of types (one string for return type, one per param) + * @return void * * @todo raise a warning if the user tries to register a 'system.' method * @todo allow setting parameters_type @@ -378,7 +404,6 @@ class Server * * @param array|Request $in array of either xmlrpc value objects or xmlrpc type definitions * @param array $sigs array of known signatures to match against - * * @return array int, string */ protected function verifySignature($in, $sigs) @@ -535,7 +560,6 @@ class Server * * @param string $data the xml request * @param string $reqEncoding (optional) the charset encoding of the xml request - * * @return Response * @throws \Exception in case the executed method does throw an exception (and depending on server configuration) * @@ -631,7 +655,6 @@ class Server * @param Request|string $req either a Request obj or a method name * @param mixed[] $params array with method parameters as php types (only if m is method name) * @param string[] $paramTypes array with xmlrpc types of method parameters (only if m is method name) - * * @return Response * * @throws \Exception in case the executed method does throw an exception (and depending on server configuration) @@ -795,6 +818,7 @@ class Server * Add a string to the 'internal debug message' (separate from 'user debug message'). * * @param string $string + * @return void */ protected function debugmsg($string) { @@ -803,7 +827,6 @@ class Server /** * @param string $charsetEncoding - * * @return string */ protected function xml_header($charsetEncoding = '') @@ -817,7 +840,6 @@ class Server /** * @param string $methName - * * @return bool */ protected function isSyscall($methName) @@ -918,7 +940,6 @@ class Server * * @param Server $server * @param Request $req - * * @return Response */ public static function _xmlrpcs_getCapabilities($server, $req = null) @@ -932,7 +953,6 @@ class Server * * @param Server $server * @param Request $req if called in plain php values mode, second param is missing - * * @return Response */ public static function _xmlrpcs_listMethods($server, $req = null) @@ -953,7 +973,6 @@ class Server * * @param Server $server * @param Request $req - * * @return Response */ public static function _xmlrpcs_methodSignature($server, $req) @@ -998,7 +1017,6 @@ class Server * * @param Server $server * @param Request $req - * * @return Response */ public static function _xmlrpcs_methodHelp($server, $req) @@ -1032,7 +1050,6 @@ class Server * @internal this function will become protected in the future * * @param $err - * * @return Value */ public static function _xmlrpcs_multicall_error($err) @@ -1056,7 +1073,6 @@ class Server * * @param Server $server * @param Value $call - * * @return Value */ public static function _xmlrpcs_multicall_do_call($server, $call) @@ -1107,7 +1123,6 @@ class Server * * @param Server $server * @param Value $call - * * @return Value */ public static function _xmlrpcs_multicall_do_call_phpvals($server, $call) @@ -1158,7 +1173,6 @@ class Server * * @param Server $server * @param Request|array $req - * * @return Response */ public static function _xmlrpcs_multicall($server, $req) diff --git a/src/Value.php b/src/Value.php index d23f766e..acc1609e 100644 --- a/src/Value.php +++ b/src/Value.php @@ -44,11 +44,11 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess /** @var Value[]|mixed */ public $me = array(); /** - * @var int $mytype + * @var int * @internal */ public $mytype = 0; - /** @var string|null $_php_class */ + /** @var string|null */ public $_php_class = null; public function getLogger() @@ -59,6 +59,10 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess return self::$logger; } + /** + * @param $logger + * @return void + */ public static function setLogger($logger) { self::$logger = $logger; @@ -72,7 +76,12 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess return self::$charsetEncoder; } - /// @todo this should be a static method + /** + * @param $charsetEncoder + * @return void + * + * @todo this should be a static method + */ public function setCharsetEncoder($charsetEncoder) { self::$charsetEncoder = $charsetEncoder; @@ -134,7 +143,6 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess * * @param mixed $val * @param string $type allowed values: i4, i8, int, boolean, string, double, dateTime.iso8601, base64, null. - * * @return int 1 or 0 on failure */ public function addScalar($val, $type = 'string') @@ -189,7 +197,6 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess * Fails otherwise. * * @param Value[] $values - * * @return int 1 or 0 on failure * * @todo add some checking for $values to be an array of xmlrpc values? @@ -220,7 +227,6 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess * Fails otherwise. * * @param Value[] $values - * * @return int 1 or 0 on failure * * @todo add some checking for $values to be an array? @@ -266,7 +272,6 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess * @param string $typ * @param Value[]|mixed $val * @param string $charsetEncoding - * * @return string */ protected function serializedata($typ, $val, $charsetEncoding = '') @@ -367,7 +372,6 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess * Returns the xml representation of the value. XML prologue not included. * * @param string $charsetEncoding the charset to be used for serialization. if null, US-ASCII is assumed - * * @return string */ public function serialize($charsetEncoding = '') @@ -384,7 +388,6 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess * Works only on xmlrpc values of type struct. * * @param string $key the name of the struct member to be looked up - * * @return boolean * * @deprecated use array access, e.g. isset($val[$key]) @@ -401,7 +404,6 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess * Will raise a php warning if struct member of given name does not exist. * * @param string $key the name of the struct member to be looked up - * * @return Value * * @deprecated use array access, e.g. $val[$key] @@ -415,6 +417,8 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess /** * Reset internal pointer for xmlrpc values of type struct. + * @return void + * * @deprecated iterate directly over the object using foreach instead */ public function structreset() @@ -541,7 +545,6 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess * @internal required to be public to implement an Interface * * @return \ArrayIterator - * */ #[\ReturnTypeWillChange] public function getIterator() @@ -563,6 +566,7 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess * * @param mixed $offset * @param mixed $value + * @return void * * @throws \Exception */ @@ -611,7 +615,6 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess * @internal required to be public to implement an Interface * * @param mixed $offset - * * @return bool */ #[\ReturnTypeWillChange] @@ -634,6 +637,7 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess * @internal required to be public to implement an Interface * * @param mixed $offset + * @return void * * @throws \Exception */ @@ -659,7 +663,6 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess * @internal required to be public to implement an Interface * * @param mixed $offset - * * @return mixed|Value|null * @throws \Exception */ diff --git a/src/Wrapper.php b/src/Wrapper.php index bf310000..36aa7b28 100644 --- a/src/Wrapper.php +++ b/src/Wrapper.php @@ -34,6 +34,10 @@ class Wrapper return self::$logger; } + /** + * @param $logger + * @return void + */ public static function setLogger($logger) { self::$logger = $logger; @@ -49,7 +53,6 @@ class Wrapper * - for 'void' and 'null' returns 'undefined' * * @param string $phpType - * * @return string * * @todo support notation `something[]` as 'array' @@ -100,7 +103,6 @@ class Wrapper * Given a string defining a phpxmlrpc type return the corresponding php type. * * @param string $xmlrpcType - * * @return string */ public function xmlrpc2PhpType($xmlrpcType) @@ -160,7 +162,6 @@ class Wrapper * - bool encode_php_objs let php objects be sent to server using the 'improved' xmlrpc notation, so server can deserialize them as php objects * - bool decode_php_objs --- WARNING !!! possible security hazard. only use it with trusted servers --- * - bool suppress_warnings remove from produced xml any warnings generated at runtime by the php function being invoked - * * @return array|false false on error, or an array containing the name of the new php function, * its signature and docs, to be used in the server dispatch map * @@ -242,7 +243,6 @@ class Wrapper * * @param callable $callable * @param string $plainFuncName - * * @return array|false */ protected function introspectFunction($callable, $plainFuncName) @@ -348,7 +348,6 @@ class Wrapper * Given the method description given by introspection, create method signature data * * @param array $funcDesc as generated by self::introspectFunction() - * * @return array * * @todo support better docs with multiple types separated by pipes by creating multiple signatures @@ -420,7 +419,6 @@ class Wrapper * @param array $extraOptions * @param string $plainFuncName * @param array $funcDesc - * * @return \Closure * * @todo validate params? In theory all validation is left to the dispatch map... @@ -489,7 +487,6 @@ class Wrapper * Return a name for a new function, based on $callable, insuring its uniqueness * @param mixed $callable a php callable, or the name of an xmlrpc method * @param string $newFuncName when not empty, it is used instead of the calculated version - * * @return string */ protected function newFunctionName($callable, $newFuncName, $extraOptions) @@ -531,7 +528,6 @@ class Wrapper * @param array $extraOptions * @param string $plainFuncName * @param array $funcDesc - * * @return string * * @todo add a nice phpdoc block in the generated source @@ -629,7 +625,6 @@ class Wrapper * - string method_filter a regexp used to filter methods to wrap based on their names * - string prefix used for the names of the xmlrpc methods created. * - string replace_class_name use to completely replace the class name with the prefix in the generated method names. e.g. instead of \Some\Namespace\Class.method use prefixmethod - * * @return array|false false on failure, or on array useable for the dispatch map */ public function wrapPhpClass($className, $extraOptions = array()) @@ -663,7 +658,6 @@ class Wrapper * @param string|object $className * @param string $classMethod * @param array $extraOptions - * * @return string */ protected function generateMethodNameForClassMethod($className, $classMethod, $extraOptions = array()) @@ -712,7 +706,6 @@ class Wrapper * - mixed return_on_fault a php value to be returned when the xmlrpc call fails/returns a fault response (by default the Response object is returned in this case). If a string is used, '%faultCode%' and '%faultString%' tokens will be substituted with actual error values * - bool debug set it to 1 or 2 to see debug results of querying server for method synopsis * - int simple_client_copy set it to 1 to have a lightweight copy of the $client object made in the generated code (only used when return_source = true) - * * @return \Closure|string[]|false false on failure, closure by default and array for return_source = true * * @todo allow the created function to throw exceptions on method calls failures @@ -754,7 +747,6 @@ class Wrapper * @param Client $client * @param string $methodName * @param array $extraOptions - * * @return false|array */ protected function retrieveMethodSignature($client, $methodName, array $extraOptions = array()) @@ -797,7 +789,6 @@ class Wrapper * @param Client $client * @param string $methodName * @param array $extraOptions - * * @return string in case of any error, an empty string is returned, no warnings generated */ protected function retrieveMethodHelp($client, $methodName, array $extraOptions = array()) @@ -831,7 +822,6 @@ class Wrapper * @param string $methodName * @param array $extraOptions * @param array $mSig - * * @return \Closure * * @todo should we allow usage of parameter simple_client_copy to mean 'do not clone' in this case? @@ -927,7 +917,6 @@ class Wrapper * @param string $newFuncName * @param array $mSig * @param string $mDesc - * * @return string[] keys: source, docstring */ public function buildWrapMethodSource($client, $methodName, array $extraOptions, $newFuncName, $mSig, $mDesc='') @@ -1034,7 +1023,6 @@ class Wrapper * - string new_class_name * - string prefix * - bool simple_client_copy set it to true to avoid copying all properties of $client into the copy made in the new class - * * @return string|array|false false on error, the name of the created class if all ok or an array with code, class name and comments (if the appropriate option is set in extra_options) * * @todo add support for anonymous classes in the 'buildIt' case for php > 7 @@ -1139,7 +1127,6 @@ class Wrapper * @param bool $verbatimClientCopy when true, copy the whole state of the client, except for 'debug' and 'return_type' * @param string $prefix used for the return_type of the created client * @param string $namespace - * * @return string */ protected function buildClientWrapperCode($client, $verbatimClientCopy, $prefix = 'xmlrpc', $namespace = '\\PhpXmlRpc\\') -- 2.47.0