Completed
Branch develop (354a31)
by
unknown
22:20
created
htdocs/includes/restler/framework/Luracast/Restler/Format/MultiFormat.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     /**
26 26
      * @var string charset encoding defaults to UTF8
27 27
      */
28
-    protected $charset='utf-8';
28
+    protected $charset = 'utf-8';
29 29
 
30 30
     public static $mime;
31 31
     public static $extension;
@@ -45,12 +45,12 @@  discard block
 block discarded – undo
45 45
      */
46 46
     public function getMIMEMap()
47 47
     {
48
-        $extensions = explode(',',static::EXTENSION);
49
-        $mimes = explode(',',static::MIME);
48
+        $extensions = explode(',', static::EXTENSION);
49
+        $mimes = explode(',', static::MIME);
50 50
         $count = max(count($extensions), count($mimes));
51 51
         $extensions += array_fill(0, $count, end($extensions));
52 52
         $mimes += array_fill(0, $count, end($mimes));
53
-        return array_combine($mimes,$extensions);
53
+        return array_combine($mimes, $extensions);
54 54
     }
55 55
 
56 56
     /**
Please login to merge, or discard this patch.
includes/restler/framework/Luracast/Restler/Format/DependentFormat.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,8 +42,8 @@
 block discarded – undo
42 42
             $package = $map[$class];
43 43
             throw new RestException(
44 44
                 500,
45
-                get_called_class() . ' has external dependency. Please run `composer require ' .
46
-                $package . '` from the project root. Read https://getcomposer.org for more info'
45
+                get_called_class().' has external dependency. Please run `composer require '.
46
+                $package.'` from the project root. Read https://getcomposer.org for more info'
47 47
             );
48 48
         }
49 49
     }
Please login to merge, or discard this patch.
htdocs/includes/restler/framework/Luracast/Restler/Format/JsFormat.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,8 +37,8 @@
 block discarded – undo
37 37
             static::$callbackMethodName
38 38
                 = (string) $_GET[static::$callbackOverrideQueryString];
39 39
         }
40
-        return static::$callbackMethodName . '('
41
-            . parent::encode($r, $human_readable) . ');';
40
+        return static::$callbackMethodName.'('
41
+            . parent::encode($r, $human_readable).');';
42 42
     }
43 43
 
44 44
     public function isReadable()
Please login to merge, or discard this patch.
htdocs/includes/restler/framework/Luracast/Restler/Format/JsonFormat.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         if (self::$unEscapedUnicode) {
109 109
             $result = preg_replace_callback(
110 110
                 '/\\\u(\w\w\w\w)/',
111
-                function ($matches) {
111
+                function($matches) {
112 112
                     if (function_exists('mb_convert_encoding')) {
113 113
                         return mb_convert_encoding(pack('H*', $matches[1]), 'UTF-8', 'UTF-16BE');
114 114
                     } else {
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
                 case '{' :
182 182
                 case '[' :
183 183
                     if (!$inString) {
184
-                        $newJson .= $char . "\n" .
184
+                        $newJson .= $char."\n".
185 185
                             str_repeat($tab, $indentLevel + 1);
186 186
                         $indentLevel++;
187 187
                     } else {
@@ -192,15 +192,15 @@  discard block
 block discarded – undo
192 192
                 case ']' :
193 193
                     if (!$inString) {
194 194
                         $indentLevel--;
195
-                        $newJson .= "\n" .
196
-                            str_repeat($tab, $indentLevel) . $char;
195
+                        $newJson .= "\n".
196
+                            str_repeat($tab, $indentLevel).$char;
197 197
                     } else {
198 198
                         $newJson .= $char;
199 199
                     }
200 200
                     break;
201 201
                 case ',' :
202 202
                     if (!$inString) {
203
-                        $newJson .= ",\n" .
203
+                        $newJson .= ",\n".
204 204
                             str_repeat($tab, $indentLevel);
205 205
                     } else {
206 206
                         $newJson .= $char;
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
                     $message = 'malformed JSON';
263 263
                     break;
264 264
                 case JSON_ERROR_UTF8:
265
-                    $message = 'malformed UTF-8 characters, possibly ' .
265
+                    $message = 'malformed UTF-8 characters, possibly '.
266 266
                         'incorrectly encoded';
267 267
                     break;
268 268
                 default:
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
         }
273 273
 
274 274
         if (isset($message)) {
275
-            throw new \RuntimeException('Error encoding/decoding JSON: ' . $message);
275
+            throw new \RuntimeException('Error encoding/decoding JSON: '.$message);
276 276
         }
277 277
     }
278 278
 }
Please login to merge, or discard this patch.
htdocs/includes/restler/framework/Luracast/Restler/Format/PlistFormat.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
          *
59 59
          * @var CFPropertyList
60 60
          */
61
-        $plist = new CFPropertyList ();
62
-        $td = new CFTypeDetector ();
61
+        $plist = new CFPropertyList();
62
+        $td = new CFTypeDetector();
63 63
         $guessedStructure = $td->toCFType(
64 64
             Obj::toArray($data)
65 65
         );
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public function decode($data)
83 83
     {
84
-        $plist = new CFPropertyList ();
84
+        $plist = new CFPropertyList();
85 85
         $plist->parse($data);
86 86
 
87 87
         return $plist->toArray();
Please login to merge, or discard this patch.
htdocs/includes/restler/framework/Luracast/Restler/Redirect.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,20 +31,20 @@
 block discarded – undo
31 31
         $url = ltrim($url, '/');
32 32
         /** @var $r Restler */
33 33
         $r = Scope::get('Restler');
34
-        $base = $r->getBaseUrl() . '/';
34
+        $base = $r->getBaseUrl().'/';
35 35
         if (0 !== strpos($url, 'http')) {
36
-            $url = $base . $url;
36
+            $url = $base.$url;
37 37
         }
38
-        if (!empty($flashData) || $base . $r->url !== $url || Util::getRequestMethod() != 'GET') {
38
+        if (!empty($flashData) || $base.$r->url !== $url || Util::getRequestMethod() != 'GET') {
39 39
             if ($r->responseFormat instanceof JsonFormat) {
40 40
                 return array('redirect' => $url);
41 41
             }
42 42
             if (!empty($params)) {
43
-                $url .= '?' . http_build_query($params);
43
+                $url .= '?'.http_build_query($params);
44 44
             }
45 45
             Flash::set($flashData);
46 46
             header(
47
-                "{$_SERVER['SERVER_PROTOCOL']} $status " .
47
+                "{$_SERVER['SERVER_PROTOCOL']} $status ".
48 48
                 (isset(RestException::$codes[$status]) ? RestException::$codes[$status] : '')
49 49
             );
50 50
             header("Location: $url");
Please login to merge, or discard this patch.
htdocs/includes/restler/framework/Luracast/Restler/HumanReadableCache.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -38,30 +38,30 @@  discard block
 block discarded – undo
38 38
     public function set($name, $data)
39 39
     {
40 40
         if (is_array($data)) {
41
-            $s = '$o = array();' . PHP_EOL . PHP_EOL;
41
+            $s = '$o = array();'.PHP_EOL.PHP_EOL;
42 42
             $s .= '// ** THIS IS AN AUTO GENERATED FILE.'
43 43
                 . ' DO NOT EDIT MANUALLY ** ';
44 44
             foreach ($data as $key => $value) {
45
-                $s .= PHP_EOL . PHP_EOL .
45
+                $s .= PHP_EOL.PHP_EOL.
46 46
                     "//==================== $key ===================="
47
-                    . PHP_EOL . PHP_EOL;
47
+                    . PHP_EOL.PHP_EOL;
48 48
                 if (is_array($value)) {
49
-                    $s .= '$o[\'' . $key . '\'] = array();';
49
+                    $s .= '$o[\''.$key.'\'] = array();';
50 50
                     foreach ($value as $ke => $va) {
51
-                        $s .= PHP_EOL . PHP_EOL . "//==== $key $ke ===="
52
-                            . PHP_EOL . PHP_EOL;
53
-                        $s .= '$o[\'' . $key . '\'][\'' . $ke . '\'] = ' .
51
+                        $s .= PHP_EOL.PHP_EOL."//==== $key $ke ===="
52
+                            . PHP_EOL.PHP_EOL;
53
+                        $s .= '$o[\''.$key.'\'][\''.$ke.'\'] = '.
54 54
                             str_replace('  ', '    ',
55
-                                var_export($va, true)) . ';';
55
+                                var_export($va, true)).';';
56 56
                     }
57 57
                 } else {
58
-                    $s .= '$o[\'' . $key . '\'] = '
59
-                        . var_export($value, true) . ';';
58
+                    $s .= '$o[\''.$key.'\'] = '
59
+                        . var_export($value, true).';';
60 60
                 }
61 61
             }
62
-            $s .= PHP_EOL . 'return $o;';
62
+            $s .= PHP_EOL.'return $o;';
63 63
         } else {
64
-            $s = 'return ' . var_export($data, true) . ';';
64
+            $s = 'return '.var_export($data, true).';';
65 65
         }
66 66
         $file = $this->_file($name);
67 67
         $r = @file_put_contents($file, "<?php $s");
@@ -115,14 +115,14 @@  discard block
 block discarded – undo
115 115
 
116 116
     private function _file($name)
117 117
     {
118
-        return self::$cacheDir . '/' . $name . '.php';
118
+        return self::$cacheDir.'/'.$name.'.php';
119 119
     }
120 120
 
121 121
     private function throwException()
122 122
     {
123 123
         throw new \Exception(
124 124
             'The cache directory `'
125
-            . self::$cacheDir . '` should exist with write permission.'
125
+            . self::$cacheDir.'` should exist with write permission.'
126 126
         );
127 127
     }
128 128
 }
Please login to merge, or discard this patch.
htdocs/includes/restler/framework/Luracast/Restler/Routes.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         try {
80 80
             $classMetadata = CommentParser::parse($class->getDocComment());
81 81
         } catch (Exception $e) {
82
-            throw new RestException(500, "Error while parsing comments of `$className` class. " . $e->getMessage());
82
+            throw new RestException(500, "Error while parsing comments of `$className` class. ".$e->getMessage());
83 83
         }
84 84
         $classMetadata['scope'] = $scope = static::scope($class);
85 85
         $methods = $class->getMethods(ReflectionMethod::IS_PUBLIC +
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
             try {
96 96
                 $metadata = CommentParser::parse($doc) + $classMetadata;
97 97
             } catch (Exception $e) {
98
-                throw new RestException(500, "Error while parsing comments of `{$className}::{$method->getName()}` method. " . $e->getMessage());
98
+                throw new RestException(500, "Error while parsing comments of `{$className}::{$method->getName()}` method. ".$e->getMessage());
99 99
             }
100 100
             //@access should not be private
101 101
             if (isset($metadata['access'])
@@ -157,20 +157,20 @@  discard block
 block discarded – undo
157 157
                 }
158 158
                 $m ['default'] = $defaults [$position];
159 159
                 $m ['required'] = !$param->isOptional();
160
-                $contentType = Util::nestedValue($p,'type');
160
+                $contentType = Util::nestedValue($p, 'type');
161 161
                 if ($type == 'array' && $contentType && $qualified = Scope::resolve($contentType, $scope)) {
162 162
                     list($p['type'], $children, $modelName) = static::getTypeAndModel(
163 163
                         new ReflectionClass($qualified), $scope,
164
-                        $className . Text::title($methodUrl), $p
164
+                        $className.Text::title($methodUrl), $p
165 165
                     );
166 166
                 }
167 167
                 if ($type instanceof ReflectionClass) {
168 168
                     list($type, $children, $modelName) = static::getTypeAndModel($type, $scope,
169
-                        $className . Text::title($methodUrl), $p);
169
+                        $className.Text::title($methodUrl), $p);
170 170
                 } elseif ($type && is_string($type) && $qualified = Scope::resolve($type, $scope)) {
171 171
                     list($type, $children, $modelName)
172 172
                         = static::getTypeAndModel(new ReflectionClass($qualified), $scope,
173
-                        $className . Text::title($methodUrl), $p);
173
+                        $className.Text::title($methodUrl), $p);
174 174
                 }
175 175
                 if (isset($type)) {
176 176
                     $m['type'] = $type;
@@ -248,13 +248,13 @@  discard block
 block discarded – undo
248 248
             ) {
249 249
                 foreach ($matches as $match) {
250 250
                     $httpMethod = $match[1];
251
-                    $url = rtrim($resourcePath . $match[2], '/');
251
+                    $url = rtrim($resourcePath.$match[2], '/');
252 252
                     //deep copy the call, as it may change for each @url
253 253
                     $copy = unserialize(serialize($call));
254 254
                     foreach ($copy['metadata']['param'] as $i => $p) {
255 255
                         $inPath =
256
-                            strpos($url, '{' . $p['name'] . '}') ||
257
-                            strpos($url, ':' . $p['name']);
256
+                            strpos($url, '{'.$p['name'].'}') ||
257
+                            strpos($url, ':'.$p['name']);
258 258
                         if ($inPath) {
259 259
                             $copy['metadata']['param'][$i][$dataName]['from'] = 'path';
260 260
                         } elseif ($httpMethod == 'GET' || $httpMethod == 'DELETE') {
@@ -264,15 +264,15 @@  discard block
 block discarded – undo
264 264
                         }
265 265
                     }
266 266
                     $url = preg_replace_callback('/{[^}]+}|:[^\/]+/',
267
-                        function ($matches) use ($copy) {
267
+                        function($matches) use ($copy) {
268 268
                             $match = trim($matches[0], '{}:');
269 269
                             $index = $copy['arguments'][$match];
270
-                            return '{' .
270
+                            return '{'.
271 271
                             Routes::typeChar(isset(
272 272
                                 $copy['metadata']['param'][$index]['type'])
273 273
                                 ? $copy['metadata']['param'][$index]['type']
274 274
                                 : null)
275
-                            . $index . '}';
275
+                            . $index.'}';
276 276
                         }, $url);
277 277
                     static::addPath($url, $copy, $httpMethod, $version);
278 278
                 }
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
                     $methodUrl = '';
293 293
                 }
294 294
                 $url = empty($methodUrl) ? rtrim($resourcePath, '/')
295
-                    : $resourcePath . $methodUrl;
295
+                    : $resourcePath.$methodUrl;
296 296
                 for ($position = 0; $position < count($params); $position++) {
297 297
                     $from = $metadata['param'][$position][$dataName]['from'];
298 298
                     if ($from == 'body' && ($httpMethod == 'GET' ||
@@ -309,11 +309,11 @@  discard block
 block discarded – undo
309 309
                 foreach ($pathParams as $position) {
310 310
                     if (!empty($url))
311 311
                         $url .= '/';
312
-                    $url .= '{' .
312
+                    $url .= '{'.
313 313
                         static::typeChar(isset($call['metadata']['param'][$position]['type'])
314 314
                             ? $call['metadata']['param'][$position]['type']
315 315
                             : null)
316
-                        . $position . '}';
316
+                        . $position.'}';
317 317
                     if ($allowAmbiguity || $position == $lastPathParam) {
318 318
                         static::addPath($url, $call, $httpMethod, $version);
319 319
                     }
@@ -343,9 +343,9 @@  discard block
 block discarded – undo
343 343
     {
344 344
         $call['url'] = preg_replace_callback(
345 345
             "/\{\S(\d+)\}/",
346
-            function ($matches) use ($call) {
347
-                return '{' .
348
-                $call['metadata']['param'][$matches[1]]['name'] . '}';
346
+            function($matches) use ($call) {
347
+                return '{'.
348
+                $call['metadata']['param'][$matches[1]]['name'].'}';
349 349
             },
350 350
             $path
351 351
         );
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
             return static::populate($p[$path][$httpMethod], $data);
391 391
         } elseif (isset($p['*'])) {
392 392
             //================== wildcard routes ========================
393
-            uksort($p['*'], function ($a, $b) {
393
+            uksort($p['*'], function($a, $b) {
394 394
                 return strlen($b) - strlen($a);
395 395
             });
396 396
             foreach ($p['*'] as $key => $value) {
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
         if (substr($path, -1) == '/')
411 411
             $path .= PHP_EOL;
412 412
         //if double slash is found fill in newline char;
413
-        $path = str_replace('//', '/' . PHP_EOL . '/', $path);
413
+        $path = str_replace('//', '/'.PHP_EOL.'/', $path);
414 414
         ksort($p);
415 415
         foreach ($p as $key => $value) {
416 416
             if (!isset($value[$httpMethod])) {
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
                     } else {
435 435
                         $status = 400;
436 436
                         $message = 'invalid value specified for `'
437
-                            . $details['name'] . '`';
437
+                            . $details['name'].'`';
438 438
                         $found = false;
439 439
                         break;
440 440
                     }
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
             }
453 453
         }
454 454
         if ($status == 405) {
455
-            header('Allow: ' . implode(', ', $methods));
455
+            header('Allow: '.implode(', ', $methods));
456 456
         }
457 457
         throw new RestException($status, $message);
458 458
     }
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
             $all = $all['*'] + $all;
467 467
             unset($all['*']);
468 468
         }
469
-        if(is_array($all)){
469
+        if (is_array($all)) {
470 470
             foreach ($all as $fullPath => $routes) {
471 471
                 foreach ($routes as $httpMethod => $route) {
472 472
                     if (in_array($httpMethod, $excludedHttpMethods)) {
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
                             continue 2;
481 481
                         }
482 482
                     }
483
-                    $hash = "$httpMethod " . $route['url'];
483
+                    $hash = "$httpMethod ".$route['url'];
484 484
                     if (!isset($filter[$hash])) {
485 485
                         $route['httpMethod'] = $httpMethod;
486 486
                         $map[$route['metadata']['resourcePath']][]
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
             $stage = end(Scope::get('Restler')->getEvents());
571 571
             if (empty($stage))
572 572
                 $stage = 'setup';
573
-            $r = Scope::get($r->className)->$modifier($r, $stage) ? : $r;
573
+            $r = Scope::get($r->className)->$modifier($r, $stage) ?: $r;
574 574
         }
575 575
         return $r;
576 576
     }
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
         }
616 616
         $p = 'property';
617 617
         $r = empty($c[$p]) ? array() : $c[$p];
618
-        $p .= '-' . ($forResponse ? 'read' : 'write');
618
+        $p .= '-'.($forResponse ? 'read' : 'write');
619 619
         if (!empty($c[$p])) {
620 620
             $r = array_merge($r, $c[$p]);
621 621
         }
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
      *
636 636
      * @access protected
637 637
      */
638
-    protected static function getTypeAndModel(ReflectionClass $class, array $scope, $prefix='', array $rules=array())
638
+    protected static function getTypeAndModel(ReflectionClass $class, array $scope, $prefix = '', array $rules = array())
639 639
     {
640 640
         $className = $class->getName();
641 641
         $dataName = CommentParser::$embeddedDataName;
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
             if ($magic_properties = static::parseMagic($class, empty($prefix))) {
648 648
                 foreach ($magic_properties as $prop) {
649 649
                     if (!isset($prop['name'])) {
650
-                        throw new Exception('@property comment is not properly defined in ' . $className . ' class');
650
+                        throw new Exception('@property comment is not properly defined in '.$className.' class');
651 651
                     }
652 652
                     if (!isset($prop[$dataName]['label'])) {
653 653
                         $prop[$dataName]['label'] = Text::title($prop['name']);
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
             }
704 704
         } catch (Exception $e) {
705 705
             if (Text::endsWith($e->getFile(), 'CommentParser.php')) {
706
-                throw new RestException(500, "Error while parsing comments of `$className` class. " . $e->getMessage());
706
+                throw new RestException(500, "Error while parsing comments of `$className` class. ".$e->getMessage());
707 707
             }
708 708
             throw $e;
709 709
         }
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
     {
770 770
         $namespace = $class->getNamespaceName();
771 771
         $imports = array(
772
-            '*' => empty($namespace) ? '' : $namespace . '\\'
772
+            '*' => empty($namespace) ? '' : $namespace.'\\'
773 773
         );
774 774
         $file = file_get_contents($class->getFileName());
775 775
         $tokens = token_get_all($file);
Please login to merge, or discard this patch.
htdocs/includes/restler/framework/Luracast/Restler/EventDispatcher.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         static::$self = $this;
26 26
         if (!empty(static::$_waitList)) {
27 27
             foreach (static::$_waitList as $param) {
28
-                call_user_func_array(array($this,$param[0]), $param[1]);
28
+                call_user_func_array(array($this, $param[0]), $param[1]);
29 29
             }
30 30
         }
31 31
     }
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     public static function __callStatic($eventName, $params)
34 34
     {
35 35
         if (0 === strpos($eventName, 'on')) {
36
-            if(static::$self){
36
+            if (static::$self) {
37 37
                 return call_user_func_array(array(static::$self, $eventName), $params);
38 38
             }
39 39
             static::$_waitList[] = func_get_args();
Please login to merge, or discard this patch.