Passed
Push — master ( 327b5e...7cdbcc )
by Gaetano
05:53
created
demo/server/methodProviders/functions.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
         $snv = $sno->scalarval();
54 54
 
55 55
         // look it up in our array (zero-based)
56
-        if (isset(self::$stateNames[$snv - 1])) {
57
-            $stateName = self::$stateNames[$snv - 1];
56
+        if (isset(self::$stateNames[$snv-1])) {
57
+            $stateName = self::$stateNames[$snv-1];
58 58
         } else {
59 59
             // not there, so complain
60
-            $err = "I don't have a state for the index '" . $snv . "'";
60
+            $err = "I don't have a state for the index '".$snv."'";
61 61
         }
62 62
 
63 63
         if ($err != '') {
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
         $s = $req->getParam(0);
132 132
         $t = $req->getParam(1);
133 133
 
134
-        return new Response(new Value($s->scalarval() + $t->scalarval(), Value::$xmlrpcInt));
134
+        return new Response(new Value($s->scalarval()+$t->scalarval(), Value::$xmlrpcInt));
135 135
     }
136 136
 
137 137
     public static $addtwodouble_sig = array(array('double', 'double', 'double'));
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         $s = $req->getParam(0);
142 142
         $t = $req->getParam(1);
143 143
 
144
-        return new Response(new Value($s->scalarval() + $t->scalarval(), Value::$xmlrpcDouble));
144
+        return new Response(new Value($s->scalarval()+$t->scalarval(), Value::$xmlrpcDouble));
145 145
     }
146 146
 
147 147
     public static $stringecho_sig = array(array('string', 'string'));
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
     public static function echoBack($req)
158 158
     {
159 159
         // just sends back a string with what I got sent to me, that's all (escaping for xml is automatic)
160
-        $s = "I got the following message:\n" . $req->serialize();
160
+        $s = "I got the following message:\n".$req->serialize();
161 161
 
162 162
         return new Response(new Value($s));
163 163
     }
@@ -230,17 +230,17 @@  discard block
 block discarded – undo
230 230
 
231 231
         /// @todo in real life, we should check for presence of return characters to avoid header injection!
232 232
 
233
-        $msgHdr = "From: " . $mFrom->scalarval() . "\n";
234
-        $msgHdr .= "To: " . $mTo->scalarval() . "\n";
233
+        $msgHdr = "From: ".$mFrom->scalarval()."\n";
234
+        $msgHdr .= "To: ".$mTo->scalarval()."\n";
235 235
 
236 236
         if ($mCc->scalarval() != "") {
237
-            $msgHdr .= "Cc: " . $mCc->scalarval() . "\n";
237
+            $msgHdr .= "Cc: ".$mCc->scalarval()."\n";
238 238
         }
239 239
         if ($mBcc->scalarval() != "") {
240
-            $msgHdr .= "Bcc: " . $mBcc->scalarval() . "\n";
240
+            $msgHdr .= "Bcc: ".$mBcc->scalarval()."\n";
241 241
         }
242 242
         if ($mMime->scalarval() != "") {
243
-            $msgHdr .= "Content-type: " . $mMime->scalarval() . "\n";
243
+            $msgHdr .= "Content-type: ".$mMime->scalarval()."\n";
244 244
         }
245 245
         $msgHdr .= "X-Mailer: XML-RPC for PHP mailer 1.0";
246 246
 
Please login to merge, or discard this patch.
demo/client/codegen.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
demo/server/codegen.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-require_once __DIR__ . "/_prepend.php";
2
+require_once __DIR__."/_prepend.php";
3 3
 
4 4
 require_once __DIR__.'/methodProviders/CommentManager.php';
5 5
 
@@ -22,19 +22,19 @@  discard block
 block discarded – undo
22 22
 // generate a file with a class definition
23 23
 
24 24
 // the generated code does not have an autoloader included - we need to add in one
25
-$autoloader = __DIR__ . "/_prepend.php";
25
+$autoloader = __DIR__."/_prepend.php";
26 26
 
27 27
 file_put_contents($targetClassFile,
28
-    "<?php\n\n" .
29
-    "require_once '$autoloader';\n\n" .
28
+    "<?php\n\n".
29
+    "require_once '$autoloader';\n\n".
30 30
     "class MyServerClass {\n\n"
31 31
 ) || die('uh oh');
32 32
 
33 33
 // we mangle a bit the code we get from wrapPhpClass to generate a php class instead of a bunch of functions
34 34
 
35
-foreach($code as $methodName => $methodDef) {
36
-    file_put_contents($targetClassFile, 'public static ' . $methodDef['source'] . "\n\n", FILE_APPEND) || die('uh oh');
37
-    $code[$methodName]['function'] = 'MyServerClass::' . $methodDef['function'];
35
+foreach ($code as $methodName => $methodDef) {
36
+    file_put_contents($targetClassFile, 'public static '.$methodDef['source']."\n\n", FILE_APPEND) || die('uh oh');
37
+    $code[$methodName]['function'] = 'MyServerClass::'.$methodDef['function'];
38 38
     unset($code[$methodName]['source']);
39 39
 }
40 40
 file_put_contents($targetClassFile, "}\n", FILE_APPEND) || die('uh oh');
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
 // generate the separate file with the xml-rpc server and dispatch map
43 43
 
44 44
 file_put_contents($targetServerFile,
45
-    "<?php\n\n" .
45
+    "<?php\n\n".
46 46
 
47
-    "require_once '$autoloader';\n\n" .
47
+    "require_once '$autoloader';\n\n".
48 48
 
49
-    "require_once '$targetClassFile';\n\n" .
49
+    "require_once '$targetClassFile';\n\n".
50 50
 
51 51
     // NB: since we are running the generated code within the same script, the existing CommentManager instance will be
52 52
     // available for usage by the methods of MyServerClass, as we keep a reference to them within the variable Wrapper::$objHolder
@@ -56,11 +56,11 @@  discard block
 block discarded – undo
56 56
     //     Wrapper::$objHolder['xmlrpc_CommentManager_addComment'] = $cm;
57 57
     //     Wrapper::$objHolder['xmlrpc_CommentManager_getComments'] = $cm;
58 58
 
59
-    '$dm = ' . var_export($code, true) . ";\n" .
60
-    '$s = new \PhpXmlRpc\Server($dm, false);' . "\n" .
61
-    '$s->setDebug(2);' . "\n" .
62
-    '$s->exception_handling = 1;' . "\n" .
63
-    '$s->service();' . "\n"
59
+    '$dm = '.var_export($code, true).";\n".
60
+    '$s = new \PhpXmlRpc\Server($dm, false);'."\n".
61
+    '$s->setDebug(2);'."\n".
62
+    '$s->exception_handling = 1;'."\n".
63
+    '$s->service();'."\n"
64 64
 ) || die('uh oh');
65 65
 
66 66
 // test that everything worked by running it in realtime
Please login to merge, or discard this patch.
demo/server/discuss.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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(array(
Please login to merge, or discard this patch.
tests/7DemofilesTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__ . '/WebTestCase.php';
3
+include_once __DIR__.'/WebTestCase.php';
4 4
 
5 5
 /**
6 6
  * Tests for php files in the 'demo' directory
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
12 12
         $this->args = argParser::getArgs();
13 13
 
14 14
         // assumes HTTPURI to be in the form /tests/index.php?etc...
15
-        $this->baseUrl = $this->args['HTTPSERVER'] . preg_replace('|\?.+|', '', $this->args['HTTPURI']);
16
-        $this->coverageScriptUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']);
15
+        $this->baseUrl = $this->args['HTTPSERVER'].preg_replace('|\?.+|', '', $this->args['HTTPURI']);
16
+        $this->coverageScriptUrl = 'http://'.$this->args['HTTPSERVER'].preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']);
17 17
     }
18 18
 
19 19
     public function testVardemo()
Please login to merge, or discard this patch.
demo/server/server.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     die();
22 22
 }
23 23
 
24
-require_once __DIR__ . "/_prepend.php";
24
+require_once __DIR__."/_prepend.php";
25 25
 
26 26
 use PhpXmlRpc\PhpXmlRpc;
27 27
 use PhpXmlRpc\Server;
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         } elseif ($_GET['FORCE_AUTH'] == 'Digest') {
81 81
             if (empty($_SERVER['PHP_AUTH_DIGEST'])) {
82 82
                 header('HTTP/1.1 401 Unauthorized');
83
-                header('WWW-Authenticate: Digest realm="Phpxmlrpc Digest Realm",qop="auth",nonce="' . uniqid() . '",opaque="' . md5('Phpxmlrpc Digest Realm') . '"');
83
+                header('WWW-Authenticate: Digest realm="Phpxmlrpc Digest Realm",qop="auth",nonce="'.uniqid().'",opaque="'.md5('Phpxmlrpc Digest Realm').'"');
84 84
                 die('Text visible if user hits Cancel button');
85 85
             }
86 86
         }
Please login to merge, or discard this patch.
demo/server/_prepend.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,5 +8,5 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
demo/client/_prepend.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
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();
13 13
 
14 14
 // Let unit tests run against localhost, 'plain' demos against a known public server
Please login to merge, or discard this patch.
debugger/controller.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 // Make sure we set the correct charset type for output, so that we can display all characters
18 18
 header('Content-Type: text/html; charset=utf-8');
19 19
 
20
-include __DIR__ . '/common.php';
20
+include __DIR__.'/common.php';
21 21
 if ($action == '') {
22 22
     $action = 'list';
23 23
 }
@@ -33,27 +33,27 @@  discard block
 block discarded – undo
33 33
     /// @const JSXMLRPC_PATH Path to the visual xmlrpc editing dialog's containing folder. Can be absolute, or
34 34
     ///         relative to this debugger's folder.
35 35
     if (defined('JSXMLRPC_PATH')) {
36
-        $editorpaths = array(JSXMLRPC_PATH[0] === '/' ? JSXMLRPC_PATH : (__DIR__ . '/' . JSXMLRPC_PATH));
36
+        $editorpaths = array(JSXMLRPC_PATH[0] === '/' ? JSXMLRPC_PATH : (__DIR__.'/'.JSXMLRPC_PATH));
37 37
     } else {
38 38
         $editorpaths = array(
39
-            __DIR__ . '/vendor/phpxmlrpc/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via composer in debugger
40
-            __DIR__ . '/node_modules/@jsxmlrpc/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via npm in debugger
41
-            __DIR__ . '/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via taskfile in debugger
42
-            __DIR__ . '/../vendor/phpxmlrpc/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via composer
43
-            __DIR__ . '/../node_modules/@jsxmlrpc/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via npm
44
-            __DIR__ . '/../../jsxmlrpc/debugger/', // this package is a composer dependency, jsxmlrpc too
45
-            __DIR__ . '/../../../../web/node_modules/@jsxmlrpc/jsxmlrpc/debugger/', // this package is a composer dependency, jsxmlrpc installed via npm
39
+            __DIR__.'/vendor/phpxmlrpc/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via composer in debugger
40
+            __DIR__.'/node_modules/@jsxmlrpc/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via npm in debugger
41
+            __DIR__.'/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via taskfile in debugger
42
+            __DIR__.'/../vendor/phpxmlrpc/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via composer
43
+            __DIR__.'/../node_modules/@jsxmlrpc/jsxmlrpc/debugger/', // this package is top-level, jsxmlrpc installed via npm
44
+            __DIR__.'/../../jsxmlrpc/debugger/', // this package is a composer dependency, jsxmlrpc too
45
+            __DIR__.'/../../../../web/node_modules/@jsxmlrpc/jsxmlrpc/debugger/', // this package is a composer dependency, jsxmlrpc installed via npm
46 46
         );
47 47
     }
48
-    foreach($editorpaths as $editorpath) {
49
-        if (is_file(realpath($editorpath . 'visualeditor.html'))) {
48
+    foreach ($editorpaths as $editorpath) {
49
+        if (is_file(realpath($editorpath.'visualeditor.html'))) {
50 50
             $haseditor = true;
51 51
             break;
52 52
         }
53 53
     }
54 54
     if ($haseditor) {
55
-        $controllerRootUrl = str_replace('/controller.php', '', parse_url($_SERVER['REQUEST_URI'],  PHP_URL_PATH));
56
-        $editorurlpath = $controllerRootUrl . '/' . preg_replace('|^' . preg_quote(__DIR__, '|') .'|', '', $editorpath);
55
+        $controllerRootUrl = str_replace('/controller.php', '', parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
56
+        $editorurlpath = $controllerRootUrl.'/'.preg_replace('|^'.preg_quote(__DIR__, '|').'|', '', $editorpath);
57 57
         /// @todo for cases above 4, 5 and up, look at $controllerRootUrl and check if the web root is not pointing directly
58 58
         ///       at this folder, as in that case the link to the visualeditor will not
59 59
         ///       work, as it will be in the form http(s)://domain/../../jsxmlrpc/debugger/visualeditor.html
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
         }
224 224
 
225 225
         function activateeditor() {
226
-            var url = '<?php echo $editorurlpath; ?>visualeditor.html?params=<?php echo str_replace(array("\\", "'"), array( "\\\\","\\'"), $alt_payload); ?>';
226
+            var url = '<?php echo $editorurlpath; ?>visualeditor.html?params=<?php echo str_replace(array("\\", "'"), array("\\\\", "\\'"), $alt_payload); ?>';
227 227
             if (document.frmaction.wstype.value == "1")
228 228
                 url += '&type=jsonrpc';
229 229
             var wnd = window.open(url, '_blank', 'width=750, height=400, location=0, resizable=1, menubar=0, scrollbars=1');
@@ -260,9 +260,9 @@  discard block
 block discarded – undo
260 260
         echo ' document.forms[2].submit();';
261 261
     } ?>">
262 262
 <h1>XML-RPC
263
-    <form name="frmxmlrpc" style="display: inline;" action="."><input name="yes" type="radio" onclick="switchtransport(0);" <?php if (!class_exists('\PhpXmlRpc\Client')) { echo 'disabled="disabled"';} ?>/></form>
263
+    <form name="frmxmlrpc" style="display: inline;" action="."><input name="yes" type="radio" onclick="switchtransport(0);" <?php if (!class_exists('\PhpXmlRpc\Client')) { echo 'disabled="disabled"'; } ?>/></form>
264 264
     /
265
-    <form name="frmjsonrpc" style="display: inline;" action="."><input name="yes" type="radio" onclick="switchtransport(1);" <?php if (!class_exists('\PhpXmlRpc\JsonRpc\Client')) { echo 'disabled="disabled"';} ?>/></form>
265
+    <form name="frmjsonrpc" style="display: inline;" action="."><input name="yes" type="radio" onclick="switchtransport(1);" <?php if (!class_exists('\PhpXmlRpc\JsonRpc\Client')) { echo 'disabled="disabled"'; } ?>/></form>
266 266
     JSON-RPC Debugger (based on the <a href="https://gggeek.github.io/phpxmlrpc/">PHPXMLRPC</a> library, ver. <?php echo htmlspecialchars(\PhpXmlRpc\PhpXmlRpc::$xmlrpcVersion)?>)
267 267
 </h1>
268 268
 <form name="frmaction" method="get" action="action.php" target="frmaction" onSubmit="switchFormMethod();">
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
                 </select>
326 326
             </td>
327 327
             <td class="labelcell">Timeout:</td>
328
-            <td><input type="text" name="timeout" size="3" value="<?php if ($timeout > 0) { echo $timeout; } ?>"/></td>
328
+            <td><input type="text" name="timeout" size="3" value="<?php if ($timeout>0) { echo $timeout; } ?>"/></td>
329 329
             <td></td>
330 330
             <td></td>
331 331
         </tr>
Please login to merge, or discard this patch.