@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -require_once __DIR__ . "/_prepend.php"; |
|
| 2 | +require_once __DIR__."/_prepend.php"; |
|
| 3 | 3 | |
| 4 | 4 | output('<html lang="en"> |
| 5 | 5 | <head><title>phpxmlrpc - Which toolkit demo</title></head> |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | <methodName>interopEchoTests.whichToolkit</methodName> |
| 20 | 20 | <params/> |
| 21 | 21 | </methodCall>'; |
| 22 | -output("XML custom request:<br/><pre>" . htmlspecialchars($payload) . "</pre>\n"); |
|
| 22 | +output("XML custom request:<br/><pre>".htmlspecialchars($payload)."</pre>\n"); |
|
| 23 | 23 | |
| 24 | 24 | $client = new Client(XMLRPCSERVER); |
| 25 | 25 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | if (!$resp->faultCode()) { |
| 41 | 41 | |
| 42 | 42 | $xml = $resp->value(); |
| 43 | - output("XML response:<br/><pre>" . htmlspecialchars($xml) . "</pre>\n"); |
|
| 43 | + output("XML response:<br/><pre>".htmlspecialchars($xml)."</pre>\n"); |
|
| 44 | 44 | |
| 45 | 45 | $encoder = new Encoder(); |
| 46 | 46 | // from xml to xml-rpc Response |
@@ -52,14 +52,14 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | output("Toolkit info:<br/>\n"); |
| 54 | 54 | output("<pre>"); |
| 55 | - output("name: " . htmlspecialchars($value["toolkitName"]) . "\n"); |
|
| 56 | - output("version: " . htmlspecialchars($value["toolkitVersion"]) . "\n"); |
|
| 57 | - output("docs: " . htmlspecialchars($value["toolkitDocsUrl"]) . "\n"); |
|
| 58 | - output("os: " . htmlspecialchars($value["toolkitOperatingSystem"]) . "\n"); |
|
| 55 | + output("name: ".htmlspecialchars($value["toolkitName"])."\n"); |
|
| 56 | + output("version: ".htmlspecialchars($value["toolkitVersion"])."\n"); |
|
| 57 | + output("docs: ".htmlspecialchars($value["toolkitDocsUrl"])."\n"); |
|
| 58 | + output("os: ".htmlspecialchars($value["toolkitOperatingSystem"])."\n"); |
|
| 59 | 59 | output("</pre>"); |
| 60 | 60 | } else { |
| 61 | 61 | output("An error occurred: "); |
| 62 | - output("Code: " . htmlspecialchars($resp->faultCode()) . " Reason: '" . htmlspecialchars($resp->faultString()) . "'\n"); |
|
| 62 | + output("Code: ".htmlspecialchars($resp->faultCode())." Reason: '".htmlspecialchars($resp->faultString())."'\n"); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | output("</body></html>\n"); |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -require_once __DIR__ . "/_prepend.php"; |
|
| 2 | +require_once __DIR__."/_prepend.php"; |
|
| 3 | 3 | |
| 4 | 4 | output('<html lang="en"> |
| 5 | 5 | <head><title>phpxmlrpc - Proxy demo</title></head> |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -require_once __DIR__ . "/_prepend.php"; |
|
| 2 | +require_once __DIR__."/_prepend.php"; |
|
| 3 | 3 | |
| 4 | 4 | output('<html lang="en"> |
| 5 | 5 | <head><title>phpxmlrpc - Agesort demo</title></head> |
@@ -17,21 +17,21 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | $inAr = array( |
| 19 | 19 | array('name' => 'Dave', 'age' => 24), |
| 20 | - array('name' => 'Edd', 'age' => 45), |
|
| 21 | - array('name' => 'Joe', 'age' => 37), |
|
| 20 | + array('name' => 'Edd', 'age' => 45), |
|
| 21 | + array('name' => 'Joe', 'age' => 37), |
|
| 22 | 22 | array('name' => 'Fred', 'age' => 27), |
| 23 | 23 | ); |
| 24 | 24 | |
| 25 | 25 | output('This is the input data:<br/><pre>'); |
| 26 | 26 | foreach ($inAr as $val) { |
| 27 | - output($val['name'] . ", " . $val['age'] . "\n"); |
|
| 27 | + output($val['name'].", ".$val['age']."\n"); |
|
| 28 | 28 | } |
| 29 | 29 | output('</pre>'); |
| 30 | 30 | |
| 31 | 31 | // Create xml-rpc parameters from the input array: an array of structs |
| 32 | 32 | $encoder = new Encoder(); |
| 33 | 33 | $v = $encoder->encode($inAr); |
| 34 | -output("Encoded into xml-rpc format it looks like this: <pre>\n" . htmlentities($v->serialize()) . "</pre>\n"); |
|
| 34 | +output("Encoded into xml-rpc format it looks like this: <pre>\n".htmlentities($v->serialize())."</pre>\n"); |
|
| 35 | 35 | |
| 36 | 36 | // create client and request objects |
| 37 | 37 | $req = new Request('examples.sortByAge', array($v)); |
@@ -51,15 +51,15 @@ discard block |
||
| 51 | 51 | $value = $resp->value(); |
| 52 | 52 | foreach ($encoder->decode($value) as $struct) { |
| 53 | 53 | // note: here we are trusting the server's response to have the expected format |
| 54 | - output(htmlspecialchars($struct['name']) . ", " . htmlspecialchars($struct['age']) . "\n"); |
|
| 54 | + output(htmlspecialchars($struct['name']).", ".htmlspecialchars($struct['age'])."\n"); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - output('</pre><hr/>For nerds: I got this value back<br/><pre>' . |
|
| 58 | - htmlentities($resp->serialize()) . "</pre><hr/>\n"); |
|
| 57 | + output('</pre><hr/>For nerds: I got this value back<br/><pre>'. |
|
| 58 | + htmlentities($resp->serialize())."</pre><hr/>\n"); |
|
| 59 | 59 | } else { |
| 60 | 60 | output('An error occurred:<pre>'); |
| 61 | - output('Code: ' . htmlspecialchars($resp->faultCode()) . |
|
| 62 | - "\nReason: '" . htmlspecialchars($resp->faultString()) . "'</pre><hr/>"); |
|
| 61 | + output('Code: '.htmlspecialchars($resp->faultCode()). |
|
| 62 | + "\nReason: '".htmlspecialchars($resp->faultString())."'</pre><hr/>"); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | output("</body></html>\n"); |
@@ -91,7 +91,7 @@ |
||
| 91 | 91 | |
| 92 | 92 | // Greek word 'kosme'. NB: NOT a valid ISO8859 string! |
| 93 | 93 | // NB: we can only register this when setting internal encoding to UTF-8, or it will break system.listMethods |
| 94 | - "tests.utf8methodname." . 'κόσμε' => array( |
|
| 94 | + "tests.utf8methodname.".'κόσμε' => array( |
|
| 95 | 95 | "function" => "exampleMethods::stringEcho", |
| 96 | 96 | "signature" => exampleMethods::$stringecho_sig, |
| 97 | 97 | "docstring" => exampleMethods::$stringecho_doc, |
@@ -69,11 +69,12 @@ |
||
| 69 | 69 | $a = $req->getParam(0); |
| 70 | 70 | $b = $req->getParam(1); |
| 71 | 71 | |
| 72 | - if ($a->scalarTyp() == Value::$xmlrpcNull) |
|
| 73 | - return new Response(new Value(plain_findstate($b->scalarVal()))); |
|
| 74 | - else |
|
| 75 | - return new Response(new Value(plain_findstate($a->scalarVal()))); |
|
| 76 | -} |
|
| 72 | + if ($a->scalarTyp() == Value::$xmlrpcNull) { |
|
| 73 | + return new Response(new Value(plain_findstate($b->scalarVal()))); |
|
| 74 | + } else { |
|
| 75 | + return new Response(new Value(plain_findstate($a->scalarVal()))); |
|
| 76 | + } |
|
| 77 | + } |
|
| 77 | 78 | |
| 78 | 79 | return array( |
| 79 | 80 | "tests.getallheaders" => array( |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | function plain_findstate($stateNo) |
| 28 | 28 | { |
| 29 | - if (isset(exampleMethods::$stateNames[$stateNo - 1])) { |
|
| 29 | + if (isset(exampleMethods::$stateNames[$stateNo - 1])) { |
|
| 30 | 30 | return exampleMethods::$stateNames[$stateNo - 1]; |
| 31 | 31 | } else { |
| 32 | 32 | // not, there so complain |
@@ -26,11 +26,11 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | function plain_findstate($stateNo) |
| 28 | 28 | { |
| 29 | - if (isset(exampleMethods::$stateNames[$stateNo - 1])) { |
|
| 30 | - return exampleMethods::$stateNames[$stateNo - 1]; |
|
| 29 | + if (isset(exampleMethods::$stateNames[$stateNo-1])) { |
|
| 30 | + return exampleMethods::$stateNames[$stateNo-1]; |
|
| 31 | 31 | } else { |
| 32 | 32 | // not, there so complain |
| 33 | - throw new Exception("I don't have a state for the index '" . $stateNo . "'", PhpXmlRpc\PhpXmlRpc::$xmlrpcerruser); |
|
| 33 | + throw new Exception("I don't have a state for the index '".$stateNo."'", PhpXmlRpc\PhpXmlRpc::$xmlrpcerruser); |
|
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | if ($req->getNumParams()) { |
| 70 | 70 | $p1 = $req->getParam(0); |
| 71 | 71 | if ($p1->kindOf() === 'scalar') { |
| 72 | - $errNum = (int)$p1->scalarVal(); |
|
| 72 | + $errNum = (int) $p1->scalarVal(); |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | throw new Exception("it's just a test", $errNum); |
@@ -141,13 +141,13 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | $findstate10_sig = array( |
| 143 | 143 | /// @todo add a demo and test with closure usage |
| 144 | - "function" => function ($req) { return exampleMethods::findState($req); }, |
|
| 144 | + "function" => function($req) { return exampleMethods::findState($req); }, |
|
| 145 | 145 | "signature" => array(array(Value::$xmlrpcString, Value::$xmlrpcInt)), |
| 146 | - "docstring" => 'When passed an integer between 1 and 51 returns the name of a US state, where the integer is the ' . |
|
| 146 | + "docstring" => 'When passed an integer between 1 and 51 returns the name of a US state, where the integer is the '. |
|
| 147 | 147 | 'index of that state name in an alphabetic order.', |
| 148 | 148 | ); |
| 149 | 149 | |
| 150 | -$findstate11_sig = $wrapper->wrapPhpFunction(function ($stateNo) { return plain_findstate($stateNo); }); |
|
| 150 | +$findstate11_sig = $wrapper->wrapPhpFunction(function($stateNo) { return plain_findstate($stateNo); }); |
|
| 151 | 151 | |
| 152 | 152 | /// @todo do we really need a new instance ? |
| 153 | 153 | $c = new handlersContainer(); |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | |
| 157 | 157 | $namespaceSignatures = $wrapper->wrapPhpClass($c, array('prefix' => 'namespacetest.', 'replace_class_name' => true, 'method_filter' => '/^findState$/', 'method_type' => 'static')); |
| 158 | 158 | |
| 159 | -$returnObj_sig = $wrapper->wrapPhpFunction(array($c, 'returnObject'), '', array('encode_php_objs' => true)); |
|
| 159 | +$returnObj_sig = $wrapper->wrapPhpFunction(array($c, 'returnObject'), '', array('encode_php_objs' => true)); |
|
| 160 | 160 | |
| 161 | 161 | return array_merge( |
| 162 | 162 | array( |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -require_once __DIR__ . "/_prepend.php"; |
|
| 2 | +require_once __DIR__."/_prepend.php"; |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Demoing the code-generation capabilities of the library: create a client class which exposes a bunch of methods |
@@ -21,12 +21,12 @@ discard block |
||
| 21 | 21 | ); |
| 22 | 22 | |
| 23 | 23 | // the generated code does not have an autoloader included - we need to add in one |
| 24 | -$autoloader = __DIR__ . "/_prepend.php"; |
|
| 24 | +$autoloader = __DIR__."/_prepend.php"; |
|
| 25 | 25 | |
| 26 | 26 | $targetFile = '/tmp/MyClient.php'; |
| 27 | 27 | $generated = file_put_contents($targetFile, |
| 28 | - "<?php\n\n" . |
|
| 29 | - "require_once '$autoloader';\n\n" . |
|
| 28 | + "<?php\n\n". |
|
| 29 | + "require_once '$autoloader';\n\n". |
|
| 30 | 30 | $code['code'] |
| 31 | 31 | ); |
| 32 | 32 | |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | $client = new MyClient(); |
| 47 | 47 | $sorted = $client->examples_sortByAge(array( |
| 48 | 48 | array('name' => 'Dave', 'age' => 24), |
| 49 | - array('name' => 'Edd', 'age' => 45), |
|
| 50 | - array('name' => 'Joe', 'age' => 37), |
|
| 49 | + array('name' => 'Edd', 'age' => 45), |
|
| 50 | + array('name' => 'Joe', 'age' => 37), |
|
| 51 | 51 | array('name' => 'Fred', 'age' => 27), |
| 52 | 52 | )); |
| 53 | 53 | |
@@ -8,5 +8,5 @@ |
||
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | // Use the custom class autoloader. These two lines are not needed when the phpxmlrpc library is installed using Composer |
| 11 | -include_once __DIR__ . '/../../src/Autoloader.php'; |
|
| 11 | +include_once __DIR__.'/../../src/Autoloader.php'; |
|
| 12 | 12 | PhpXmlRpc\Autoloader::register(); |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | * `$functions_parameters_type` and `$exception_handling` |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | -require_once __DIR__ . "/_prepend.php"; |
|
| 11 | +require_once __DIR__."/_prepend.php"; |
|
| 12 | 12 | |
| 13 | 13 | require_once __DIR__.'/methodProviders/CommentManager.php'; |
| 14 | 14 | |
@@ -19,12 +19,12 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | $addComment_sig = array(array(Value::$xmlrpcInt, Value::$xmlrpcString, Value::$xmlrpcString, Value::$xmlrpcString)); |
| 21 | 21 | |
| 22 | -$addComment_doc = 'Adds a comment to an item. The first parameter is the item ID, the second the name of the commenter, ' . |
|
| 22 | +$addComment_doc = 'Adds a comment to an item. The first parameter is the item ID, the second the name of the commenter, '. |
|
| 23 | 23 | 'and the third is the comment itself. Returns the number of comments against that ID.'; |
| 24 | 24 | |
| 25 | 25 | $getComments_sig = array(array(Value::$xmlrpcArray, Value::$xmlrpcString)); |
| 26 | 26 | |
| 27 | -$getComments_doc = 'Returns an array of comments for a given ID, which is the sole argument. Each array item is a struct ' . |
|
| 27 | +$getComments_doc = 'Returns an array of comments for a given ID, which is the sole argument. Each array item is a struct '. |
|
| 28 | 28 | 'containing name and comment text.'; |
| 29 | 29 | |
| 30 | 30 | $srv = new Server(); |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -require_once __DIR__ . "/_prepend.php"; |
|
| 2 | +require_once __DIR__."/_prepend.php"; |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * Demoing the charset conversion of the library: create a client class which uses data in the CP-1252 character set, |