comments
authorgggeek <giunta.gaetano@gmail.com>
Wed, 30 Dec 2020 17:28:48 +0000 (17:28 +0000)
committergggeek <giunta.gaetano@gmail.com>
Wed, 30 Dec 2020 17:28:48 +0000 (17:28 +0000)
src/Client.php
src/Encoder.php
src/Helper/Logger.php
src/Helper/XMLParser.php
src/Request.php
src/Response.php
src/Server.php
src/Value.php

index 3d29093..e29ba20 100644 (file)
@@ -71,12 +71,12 @@ class Client
      * Name of compression scheme to be used for sending requests.
      * Either null, gzip or deflate.
      */
-
     public $request_compression = '';
 
     /**
      * CURL handle: used for keep-alive connections (PHP 4.3.8 up, see:
      * http://curl.haxx.se/docs/faq.html#7.3).
+     * @internal
      */
     public $xmlrpc_curl_handle = null;
 
index 82deef0..c7f44d5 100644 (file)
@@ -8,6 +8,7 @@ use PhpXmlRpc\Helper\XMLParser;
 /**
  * A helper class to easily convert between Value objects and php native values
  * @todo implement an interface
+ * @todo add class constants for the options values
  */
 class Encoder
 {
@@ -22,7 +23,7 @@ class Encoder
      * This means that the remote communication end can decide which php code will get executed on your server, leaving
      * the door possibly open to 'php-injection' style of attacks (provided you have some classes defined on your server
      * that might wreak havoc if instances are built outside an appropriate context).
-     * Make sure you trust the remote server/client before eanbling this!
+     * Make sure you trust the remote server/client before enabling this!
      *
      * @author Dan Libby (dan@libby.com)
      *
@@ -278,12 +279,12 @@ class Encoder
 
         // What if internal encoding is not in one of the 3 allowed? We use the broadest one, ie. utf8!
         if (!in_array(PhpXmlRpc::$xmlrpc_internalencoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII'))) {
-            $options = array(XML_OPTION_TARGET_ENCODING => 'UTF-8');
+            $parserOptions = array(XML_OPTION_TARGET_ENCODING => 'UTF-8');
         } else {
-            $options = array(XML_OPTION_TARGET_ENCODING => PhpXmlRpc::$xmlrpc_internalencoding);
+            $parserOptions = array(XML_OPTION_TARGET_ENCODING => PhpXmlRpc::$xmlrpc_internalencoding);
         }
 
-        $xmlRpcParser = new XMLParser($options);
+        $xmlRpcParser = new XMLParser($parserOptions);
         $xmlRpcParser->parse($xmlVal, XMLParser::RETURN_XMLRPCVALS, XMLParser::ACCEPT_REQUEST | XMLParser::ACCEPT_RESPONSE | XMLParser::ACCEPT_VALUE | XMLParser::ACCEPT_FAULT);
 
         if ($xmlRpcParser->_xh['isf'] > 1) {
@@ -333,5 +334,4 @@ class Encoder
                 return false;
         }
     }
-
 }
index 01804c8..61da391 100644 (file)
@@ -2,6 +2,9 @@
 
 namespace PhpXmlRpc\Helper;
 
+/**
+ * @todo make constructor private to force users to go through `instance`
+ */
 class Logger
 {
     protected static $instance = null;
index 10ffaa4..37f9884 100644 (file)
@@ -159,6 +159,7 @@ class XMLParser
 
     /**
      * xml parser handler function for opening element tags.
+     * @internal
      * @param resource $parser
      * @param string $name
      * @param $attrs
@@ -335,6 +336,7 @@ class XMLParser
 
     /**
      * xml parser handler function for close element tags.
+     * @internal
      * @param resource $parser
      * @param string $name
      * @param int $rebuildXmlrpcvals >1 for rebuilding xmlrpcvals, 0 for rebuilding php values, -1 for xmlrpc-extension compatibility
@@ -521,6 +523,7 @@ class XMLParser
 
     /**
      * Used in decoding xmlrpc requests/responses without rebuilding xmlrpc Values.
+     * @internal
      * @param resource $parser
      * @param string $name
      */
@@ -531,6 +534,7 @@ class XMLParser
 
     /**
      * Used in decoding xmlrpc requests/responses while building xmlrpc-extension Values (plain php for all but base64 and datetime).
+     * @internal
      * @param resource $parser
      * @param string $name
      */
@@ -541,6 +545,7 @@ class XMLParser
 
     /**
      * xml parser handler function for character data.
+     * @internal
      * @param resource $parser
      * @param string $data
      */
@@ -559,6 +564,7 @@ class XMLParser
     /**
      * xml parser handler function for 'other stuff', ie. not char data or
      * element start/end tag. In fact it only gets called on unknown entities...
+     * @internal
      * @param $parser
      * @param string data
      */
index 1c9b0d3..655344c 100644 (file)
@@ -15,7 +15,9 @@ class Request
 {
     /// @todo: do these need to be public?
     public $payload;
+    /** @internal */
     public $methodname;
+    /** @internal */
     public $params = array();
     public $debug = 0;
     public $content_type = 'text/xml';
@@ -35,6 +37,11 @@ class Request
         }
     }
 
+    /**
+     * @internal this function will become protected in the future
+     * @param string $charsetEncoding
+     * @return string
+     */
     public function xml_header($charsetEncoding = '')
     {
         if ($charsetEncoding != '') {
@@ -44,11 +51,19 @@ class Request
         }
     }
 
+    /**
+     * @internal this function will become protected in the future
+     * @return string
+     */
     public function xml_footer()
     {
         return '</methodCall>';
     }
 
+    /**
+     * @internal this function will become protected in the future
+     * @param string $charsetEncoding
+     */
     public function createPayload($charsetEncoding = '')
     {
         if ($charsetEncoding != '') {
@@ -176,6 +191,8 @@ class Request
      *                           'phpvals'
      *
      * @return Response
+     *
+     * @todo parsing Responses is not really the responsibility of the Request class. Maybe of the Client...
      */
     public function parseResponse($data = '', $headersProcessed = false, $returnType = 'xmlrpcvals')
     {
@@ -231,7 +248,7 @@ class Request
             }
         }
 
-        // if user wants back raw xml, give it to him
+        // if user wants back raw xml, give it to her
         if ($returnType == 'xml') {
             $r = new Response($data, 0, '', 'xml');
             $r->hdrs = $this->httpResponse['headers'];
index 9884acc..a7b9492 100644 (file)
@@ -12,14 +12,18 @@ use PhpXmlRpc\Helper\Charset;
 class Response
 {
     /// @todo: do these need to be public?
+    /** @internal */
     public $val = 0;
+    /** @internal */
     public $valtyp;
+    /** @internal */
     public $errno = 0;
+    /** @internal */
     public $errstr = '';
     public $payload;
+    public $content_type = 'text/xml';
     public $hdrs = array();
     public $_cookies = array();
-    public $content_type = 'text/xml';
     public $raw_data = '';
 
     /**
index 117e71e..f6523e3 100644 (file)
@@ -2,8 +2,8 @@
 
 namespace PhpXmlRpc;
 
-use PhpXmlRpc\Helper\Logger;
 use PhpXmlRpc\Helper\Charset;
+use PhpXmlRpc\Helper\Logger;
 use PhpXmlRpc\Helper\XMLParser;
 
 /**
@@ -20,6 +20,7 @@ class Server
      * 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'
+     * @todo create class constants for these
      */
     public $functions_parameters_type = 'xmlrpcvals';
 
index 2627e58..6bcb8b4 100644 (file)
@@ -40,7 +40,10 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess
     /// @todo: do these need to be public?
     /** @var Value[]|mixed */
     public $me = array();
-    /** @var int $mytype */
+    /**
+     * @var int $mytype
+     * @internal
+     */
     public $mytype = 0;
     /** @var string|null $_php_class */
     public $_php_class = null;
@@ -513,6 +516,12 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess
         }
     }
 
+    /**
+     * @internal required to be public to implement an Interface
+     * @param mixed $offset
+     * @param mixed $value
+     * @throws \Exception
+     */
     public function offsetSet($offset, $value)
     {
         switch ($this->mytype) {
@@ -553,6 +562,11 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess
         }
     }
 
+    /**
+     * @internal required to be public to implement an Interface
+     * @param mixed $offset
+     * @return bool
+     */
     public function offsetExists($offset)
     {
         switch ($this->mytype) {
@@ -568,6 +582,11 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess
         }
     }
 
+    /**
+     * @internal required to be public to implement an Interface
+     * @param mixed $offset
+     * @throws \Exception
+     */
     public function offsetUnset($offset)
     {
         switch ($this->mytype) {
@@ -585,6 +604,12 @@ class Value implements \Countable, \IteratorAggregate, \ArrayAccess
         }
     }
 
+    /**
+     * @internal required to be public to implement an Interface
+     * @param mixed $offset
+     * @return mixed|Value|null
+     * @throws \Exception
+     */
     public function offsetGet($offset)
     {
         switch ($this->mytype) {