More CamelCase
authorgggeek <giunta.gaetano@gmail.com>
Sun, 29 Mar 2015 16:13:43 +0000 (17:13 +0100)
committergggeek <giunta.gaetano@gmail.com>
Sun, 29 Mar 2015 16:13:43 +0000 (17:13 +0100)
src/Request.php
src/Server.php
src/Value.php
src/Wrapper.php

index 12cbf68..9192b81 100644 (file)
@@ -227,19 +227,19 @@ class Request
         }
 
         // try to 'guestimate' the character encoding of the received response
-        $resp_encoding = Encoder::guess_encoding(@$this->httpResponse['headers']['content-type'], $data);
+        $respEncoding = Encoder::guess_encoding(@$this->httpResponse['headers']['content-type'], $data);
 
         // if response charset encoding is not known / supported, try to use
         // the default encoding and parse the xml anyway, but log a warning...
-        if (!in_array($resp_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII'))) {
+        if (!in_array($respEncoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII'))) {
             // the following code might be better for mb_string enabled installs, but
             // makes the lib about 200% slower...
-            //if (!is_valid_charset($resp_encoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
+            //if (!is_valid_charset($respEncoding, array('UTF-8', 'ISO-8859-1', 'US-ASCII')))
 
-            error_log('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of received response: ' . $resp_encoding);
-            $resp_encoding = PhpXmlRpc::$xmlrpc_defencoding;
+            error_log('XML-RPC: ' . __METHOD__ . ': invalid charset encoding of received response: ' . $respEncoding);
+            $respEncoding = PhpXmlRpc::$xmlrpc_defencoding;
         }
-        $parser = xml_parser_create($resp_encoding);
+        $parser = xml_parser_create($respEncoding);
         xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true);
         // G. Giunta 2005/02/13: PHP internally uses ISO-8859-1, so we have to tell
         // the xml parser to give us back data in the expected charset.
index ec9ebb4..113ead4 100644 (file)
@@ -342,7 +342,7 @@ class Server
      *
      * @return mixed null on success or a Response
      */
-    protected function parseRequestHeaders(&$data, &$reqEncoding, &$respEncoding, &$resp_compression)
+    protected function parseRequestHeaders(&$data, &$reqEncoding, &$respEncoding, &$respCompression)
     {
         // check if $_SERVER is populated: it might have been disabled via ini file
         // (this is true even when in CLI mode)
@@ -360,22 +360,22 @@ class Server
         }
 
         if (isset($_SERVER['HTTP_CONTENT_ENCODING'])) {
-            $content_encoding = str_replace('x-', '', $_SERVER['HTTP_CONTENT_ENCODING']);
+            $contentEncoding = str_replace('x-', '', $_SERVER['HTTP_CONTENT_ENCODING']);
         } else {
-            $content_encoding = '';
+            $contentEncoding = '';
         }
 
         // check if request body has been compressed and decompress it
-        if ($content_encoding != '' && strlen($data)) {
-            if ($content_encoding == 'deflate' || $content_encoding == 'gzip') {
+        if ($contentEncoding != '' && strlen($data)) {
+            if ($contentEncoding == 'deflate' || $contentEncoding == 'gzip') {
                 // if decoding works, use it. else assume data wasn't gzencoded
-                if (function_exists('gzinflate') && in_array($content_encoding, $this->accepted_compression)) {
-                    if ($content_encoding == 'deflate' && $degzdata = @gzuncompress($data)) {
+                if (function_exists('gzinflate') && in_array($contentEncoding, $this->accepted_compression)) {
+                    if ($contentEncoding == 'deflate' && $degzdata = @gzuncompress($data)) {
                         $data = $degzdata;
                         if ($this->debug > 1) {
                             $this->debugmsg("\n+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++");
                         }
-                    } elseif ($content_encoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) {
+                    } elseif ($contentEncoding == 'gzip' && $degzdata = @gzinflate(substr($data, 10))) {
                         $data = $degzdata;
                         if ($this->debug > 1) {
                             $this->debugmsg("+++INFLATED REQUEST+++[" . strlen($data) . " chars]+++\n" . $data . "\n+++END+++");
@@ -402,11 +402,11 @@ class Server
                 // here we should check if we can match the client-requested encoding
                 // with the encodings we know we can generate.
                 /// @todo we should parse q=0.x preferences instead of getting first charset specified...
-                $client_accepted_charsets = explode(',', strtoupper($_SERVER['HTTP_ACCEPT_CHARSET']));
+                $clientAcceptedCharsets = explode(',', strtoupper($_SERVER['HTTP_ACCEPT_CHARSET']));
                 // Give preference to internal encoding
-                $known_charsets = array(PhpXmlRpc::$xmlrpc_internalencoding, 'UTF-8', 'ISO-8859-1', 'US-ASCII');
-                foreach ($known_charsets as $charset) {
-                    foreach ($client_accepted_charsets as $accepted) {
+                $knownCharsets = array(PhpXmlRpc::$xmlrpc_internalencoding, 'UTF-8', 'ISO-8859-1', 'US-ASCII');
+                foreach ($knownCharsets as $charset) {
+                    foreach ($clientAcceptedCharsets as $accepted) {
                         if (strpos($accepted, $charset) === 0) {
                             $respEncoding = $charset;
                             break;
@@ -422,9 +422,9 @@ class Server
         }
 
         if (isset($_SERVER['HTTP_ACCEPT_ENCODING'])) {
-            $resp_compression = $_SERVER['HTTP_ACCEPT_ENCODING'];
+            $respCompression = $_SERVER['HTTP_ACCEPT_ENCODING'];
         } else {
-            $resp_compression = '';
+            $respCompression = '';
         }
 
         // 'guestimate' request encoding
index 1e5f1bf..0d963b5 100644 (file)
@@ -228,7 +228,7 @@ class Value
         }
     }
 
-    protected function serializedata($typ, $val, $charset_encoding = '')
+    protected function serializedata($typ, $val, $charsetEncoding = '')
     {
         $rs = '';
 
@@ -248,7 +248,7 @@ class Value
                     case static::$xmlrpcString:
                         // G. Giunta 2005/2/13: do NOT use htmlentities, since
                         // it will produce named html entities, which are invalid xml
-                        $rs .= "<${typ}>" . Charset::instance()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charset_encoding) . "</${typ}>";
+                        $rs .= "<${typ}>" . Charset::instance()->encodeEntities($val, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</${typ}>";
                         break;
                     case static::$xmlrpcInt:
                     case static::$xmlrpcI4:
@@ -296,9 +296,9 @@ class Value
                 }
                 $charsetEncoder = Charset::instance();
                 foreach ($val as $key2 => $val2) {
-                    $rs .= '<member><name>' . $charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charset_encoding) . "</name>\n";
+                    $rs .= '<member><name>' . $charsetEncoder->encodeEntities($key2, PhpXmlRpc::$xmlrpc_internalencoding, $charsetEncoding) . "</name>\n";
                     //$rs.=$this->serializeval($val2);
-                    $rs .= $val2->serialize($charset_encoding);
+                    $rs .= $val2->serialize($charsetEncoding);
                     $rs .= "</member>\n";
                 }
                 $rs .= '</struct>';
@@ -308,7 +308,7 @@ class Value
                 $rs .= "<array>\n<data>\n";
                 foreach ($val as $element) {
                     //$rs.=$this->serializeval($val[$i]);
-                    $rs .= $element->serialize($charset_encoding);
+                    $rs .= $element->serialize($charsetEncoding);
                 }
                 $rs .= "</data>\n</array>";
                 break;
index be3cdb8..71abda5 100644 (file)
@@ -513,16 +513,16 @@ class Wrapper
         $encodePhpObjects = isset($extraOptions['encode_php_objs']) ? (bool)$extraOptions['encode_php_objs'] : false;
         $decodePhpObjects = isset($extraOptions['decode_php_objs']) ? (bool)$extraOptions['decode_php_objs'] : false;
         // it seems like the meaning of 'simple_client_copy' here is swapped wrt client_copy_mode later on...
-        $simple_client_copy = isset($extraOptions['simple_client_copy']) ? (int)($extraOptions['simple_client_copy']) : 0;
+        $simpleClientCopy = isset($extraOptions['simple_client_copy']) ? (int)($extraOptions['simple_client_copy']) : 0;
         $buildIt = isset($extraOptions['return_source']) ? !($extraOptions['return_source']) : true;
         $prefix = isset($extraOptions['prefix']) ? $extraOptions['prefix'] : 'xmlrpc';
         $namespace = '\\PhpXmlRpc\\';
         if (isset($extraOptions['return_on_fault'])) {
-            $decode_fault = true;
-            $fault_response = $extraOptions['return_on_fault'];
+            $decodeFault = true;
+            $faultResponse = $extraOptions['return_on_fault'];
         } else {
-            $decode_fault = false;
-            $fault_response = '';
+            $decodeFault = false;
+            $faultResponse = '';
         }
         $debug = isset($extraOptions['debug']) ? ($extraOptions['debug']) : 0;
 
@@ -579,9 +579,9 @@ class Wrapper
                 }
 
                 $results = $this->build_remote_method_wrapper_code($client, $methodName,
-                    $xmlrpcFuncName, $msig, $mdesc, $timeout, $protocol, $simple_client_copy,
-                    $prefix, $decodePhpObjects, $encodePhpObjects, $decode_fault,
-                    $fault_response, $namespace);
+                    $xmlrpcFuncName, $msig, $mdesc, $timeout, $protocol, $simpleClientCopy,
+                    $prefix, $decodePhpObjects, $encodePhpObjects, $decodeFault,
+                    $faultResponse, $namespace);
                 //print_r($code);
                 if ($buildIt) {
                     $allOK = 0;
@@ -714,14 +714,14 @@ class Wrapper
      * Note: real spaghetti code follows...
      */
     public function build_remote_method_wrapper_code($client, $methodName, $xmlrpcFuncName,
-                                                        $msig, $mdesc = '', $timeout = 0, $protocol = '', $client_copy_mode = 0, $prefix = 'xmlrpc',
-                                                        $decodePhpObjects = false, $encodePhpObjects = false, $decode_fault = false,
-                                                        $fault_response = '', $namespace = '\\PhpXmlRpc\\')
+                                                        $msig, $mdesc = '', $timeout = 0, $protocol = '', $clientCopyMode = 0, $prefix = 'xmlrpc',
+                                                        $decodePhpObjects = false, $encodePhpObjects = false, $decdoeFault = false,
+                                                        $faultResponse = '', $namespace = '\\PhpXmlRpc\\')
     {
         $code = "function $xmlrpcFuncName (";
-        if ($client_copy_mode < 2) {
+        if ($clientCopyMode < 2) {
             // client copy mode 0 or 1 == partial / full client copy in emitted code
-            $innerCode = $this->build_client_wrapper_code($client, $client_copy_mode, $prefix, $namespace);
+            $innerCode = $this->build_client_wrapper_code($client, $clientCopyMode, $prefix, $namespace);
             $innerCode .= "\$client->setDebug(\$debug);\n";
             $this_ = '';
         } else {
@@ -760,7 +760,7 @@ class Wrapper
             $innerCode .= "\$msg->addparam(\$p$i);\n";
             $mdesc .= '* @param ' . $this->xmlrpc_2_php_type($ptype) . " \$p$i\n";
         }
-        if ($client_copy_mode < 2) {
+        if ($clientCopyMode < 2) {
             $plist[] = '$debug=0';
             $mdesc .= "* @param int \$debug when 1 (or 2) will enable debugging of the underlying {$prefix} call (defaults to 0)\n";
         }
@@ -768,11 +768,11 @@ class Wrapper
         $mdesc .= '* @return ' . $this->xmlrpc_2_php_type($msig[0]) . " (or an {$namespace}Response obj instance if call fails)\n*/\n";
 
         $innerCode .= "\$res = \${$this_}client->send(\$msg, $timeout, '$protocol');\n";
-        if ($decode_fault) {
-            if (is_string($fault_response) && ((strpos($fault_response, '%faultCode%') !== false) || (strpos($fault_response, '%faultString%') !== false))) {
-                $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '" . str_replace("'", "''", $fault_response) . "')";
+        if ($decdoeFault) {
+            if (is_string($faultResponse) && ((strpos($faultResponse, '%faultCode%') !== false) || (strpos($faultResponse, '%faultString%') !== false))) {
+                $respCode = "str_replace(array('%faultCode%', '%faultString%'), array(\$res->faultCode(), \$res->faultString()), '" . str_replace("'", "''", $faultResponse) . "')";
             } else {
-                $respCode = var_export($fault_response, true);
+                $respCode = var_export($faultResponse, true);
             }
         } else {
             $respCode = '$res';