Completed
Branch develop (2dd6cc)
by
unknown
26:03
created
htdocs/includes/restler/framework/Luracast/Restler/Format/HtmlFormat.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         }
90 90
         if (!static::$viewPath) {
91 91
             $array = explode('vendor', __DIR__, 2);
92
-            static::$viewPath = $array[0] . 'views';
92
+            static::$viewPath = $array[0].'views';
93 93
         }
94 94
     }
95 95
 
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
         $files = new Filesystem();
109 109
         $compiler = new BladeCompiler($files, static::$cacheDirectory);
110 110
         $engine = new CompilerEngine($compiler);
111
-        $resolver->register('blade', function () use ($engine) {
111
+        $resolver->register('blade', function() use ($engine) {
112 112
             return $engine;
113 113
         });
114 114
         $phpEngine = new PhpEngine($files);
115
-        $resolver->register('php', function () use ($phpEngine) {
115
+        $resolver->register('php', function() use ($phpEngine) {
116 116
             return $phpEngine;
117 117
         });
118 118
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         $restler = Scope::get('Restler');
121 121
 
122 122
         //Lets expose shortcuts for our classes
123
-        spl_autoload_register(function ($className) use ($restler) {
123
+        spl_autoload_register(function($className) use ($restler) {
124 124
             if (isset($restler->apiMethodInfo->metadata['scope'][$className])) {
125 125
                 return class_alias($restler->apiMethodInfo->metadata['scope'][$className], $className);
126 126
             }
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
             )
181 181
         );
182 182
 
183
-        $twig->registerUndefinedFunctionCallback(function ($name) {
183
+        $twig->registerUndefinedFunctionCallback(function($name) {
184 184
             if (
185 185
                 isset(HtmlFormat::$data[$name]) &&
186 186
                 is_callable(HtmlFormat::$data[$name])
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
         });
195 195
 
196 196
         $template = $twig->load(static::getViewFile());
197
-        return $template->render((array)$data);
197
+        return $template->render((array) $data);
198 198
     }
199 199
 
200 200
     /**
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
      */
217 217
     public static function mustache($data, $debug = true)
218 218
     {
219
-        $data = (array)$data;
219
+        $data = (array) $data;
220 220
         if (!isset($data['nav'])) {
221 221
             $data['nav'] = array_values(Nav::get());
222 222
         }
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
                 array('extension' => static::getViewExtension())
227 227
             ),
228 228
             'helpers' => array(
229
-                'form' => function ($text, \Mustache_LambdaHelper $m) {
229
+                'form' => function($text, \Mustache_LambdaHelper $m) {
230 230
                     $params = explode(',', $m->render($text));
231 231
                     return call_user_func_array(
232 232
                         'Luracast\Restler\UI\Forms::get',
@@ -252,22 +252,22 @@  discard block
 block discarded – undo
252 252
     public static function php($data, $debug = true)
253 253
     {
254 254
         if (static::$view == 'debug') {
255
-            static::$viewPath = dirname(__DIR__) . '/views';
255
+            static::$viewPath = dirname(__DIR__).'/views';
256 256
         }
257 257
         $view = static::getViewFile(true);
258 258
 
259 259
         if (!is_readable($view)) {
260 260
             throw new RestException(
261 261
                 500,
262
-                "view file `$view` is not readable. " .
262
+                "view file `$view` is not readable. ".
263 263
                 'Check for file presence and file permissions'
264 264
             );
265 265
         }
266 266
 
267
-        $path = static::$viewPath . DIRECTORY_SEPARATOR;
268
-        $template = function ($view) use ($data, $path) {
269
-            $data = (array)$data;
270
-            $form = function () {
267
+        $path = static::$viewPath.DIRECTORY_SEPARATOR;
268
+        $template = function($view) use ($data, $path) {
269
+            $data = (array) $data;
270
+            $form = function() {
271 271
                 return call_user_func_array(
272 272
                     'Luracast\Restler\UI\Forms::get',
273 273
                     func_get_args()
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
             if (!isset($data['form'])) {
277 277
                 $data['form'] = $form;
278 278
             }
279
-            $nav = function () {
279
+            $nav = function() {
280 280
                 return call_user_func_array(
281 281
                     'Luracast\Restler\UI\Nav::get',
282 282
                     func_get_args()
@@ -287,14 +287,14 @@  discard block
 block discarded – undo
287 287
             }
288 288
 
289 289
 
290
-            $_ = function () use ($data, $path) {
290
+            $_ = function() use ($data, $path) {
291 291
                 extract($data);
292 292
                 $args = func_get_args();
293 293
                 $task = array_shift($args);
294 294
                 switch ($task) {
295 295
                     case 'require':
296 296
                     case 'include':
297
-                        $file = $path . $args[0];
297
+                        $file = $path.$args[0];
298 298
                         if (is_readable($file)) {
299 299
                             if (
300 300
                                 isset($args[1]) &&
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
                             ) {
303 303
                                 $str = '';
304 304
                                 foreach ($arrays as $arr) {
305
-                                    extract((array)$arr);
305
+                                    extract((array) $arr);
306 306
                                     $str .= include $file;
307 307
                                 }
308 308
                                 return $str;
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
         if (!is_readable(static::$viewPath)) {
355 355
             throw new \Exception(
356 356
                 'The views directory `'
357
-                . self::$viewPath . '` should exist with read permission.'
357
+                . self::$viewPath.'` should exist with read permission.'
358 358
             );
359 359
         }
360 360
         static::$data['basePath'] = dirname($_SERVER['SCRIPT_NAME']);
@@ -420,11 +420,11 @@  discard block
 block discarded – undo
420 420
                 self::$view = substr(self::$view, 0, $i);
421 421
             }
422 422
             if (!static::$cacheDirectory) {
423
-                static::$cacheDirectory = Defaults::$cacheDirectory . DIRECTORY_SEPARATOR . $template;
423
+                static::$cacheDirectory = Defaults::$cacheDirectory.DIRECTORY_SEPARATOR.$template;
424 424
                 if (!file_exists(static::$cacheDirectory)) {
425 425
                     if (!mkdir(static::$cacheDirectory, 0770, true)) {
426 426
                         throw new RestException(500,
427
-                            'Unable to create cache directory `' . static::$cacheDirectory . '`');
427
+                            'Unable to create cache directory `'.static::$cacheDirectory.'`');
428 428
                     }
429 429
                 }
430 430
             }
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
         } elseif (strpos($path, '/')) {
454 454
             $path .= '/index';
455 455
         }
456
-        $file = static::$viewPath . '/' . $path . '.' . static::getViewExtension();
456
+        $file = static::$viewPath.'/'.$path.'.'.static::getViewExtension();
457 457
 
458 458
         return static::$useSmartViews && is_readable($file)
459 459
             ? $path
@@ -469,10 +469,10 @@  discard block
 block discarded – undo
469 469
 
470 470
     public static function getViewFile($fullPath = false, $includeExtension = true)
471 471
     {
472
-        $v = $fullPath ? static::$viewPath . '/' : '';
472
+        $v = $fullPath ? static::$viewPath.'/' : '';
473 473
         $v .= static::$view;
474 474
         if ($includeExtension) {
475
-            $v .= '.' . static::getViewExtension();
475
+            $v .= '.'.static::getViewExtension();
476 476
         }
477 477
         return $v;
478 478
     }
Please login to merge, or discard this patch.
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.