@@ -59,11 +59,11 @@ |
||
59 | 59 | foreach ($data as $row) { |
60 | 60 | $lines[] = static::putRow(array_values($row)); |
61 | 61 | } |
62 | - return implode(PHP_EOL, $lines) . PHP_EOL; |
|
62 | + return implode(PHP_EOL, $lines).PHP_EOL; |
|
63 | 63 | } |
64 | 64 | throw new RestException( |
65 | 65 | 500, |
66 | - 'Unsupported data for ' . strtoupper(static::EXTENSION) . ' format' |
|
66 | + 'Unsupported data for '.strtoupper(static::EXTENSION).' format' |
|
67 | 67 | ); |
68 | 68 | } |
69 | 69 |
@@ -68,20 +68,20 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public static function exportCurrentSettings() |
70 | 70 | { |
71 | - $s = 'XmlFormat::$rootName = "' . (self::$rootName) . "\";\n"; |
|
72 | - $s .= 'XmlFormat::$attributeNames = ' . |
|
73 | - (var_export(self::$attributeNames, true)) . ";\n"; |
|
74 | - $s .= 'XmlFormat::$defaultTagName = "' . |
|
75 | - self::$defaultTagName . "\";\n"; |
|
76 | - $s .= 'XmlFormat::$parseAttributes = ' . |
|
77 | - (self::$parseAttributes ? 'true' : 'false') . ";\n"; |
|
78 | - $s .= 'XmlFormat::$parseNamespaces = ' . |
|
79 | - (self::$parseNamespaces ? 'true' : 'false') . ";\n"; |
|
71 | + $s = 'XmlFormat::$rootName = "'.(self::$rootName)."\";\n"; |
|
72 | + $s .= 'XmlFormat::$attributeNames = '. |
|
73 | + (var_export(self::$attributeNames, true)).";\n"; |
|
74 | + $s .= 'XmlFormat::$defaultTagName = "'. |
|
75 | + self::$defaultTagName."\";\n"; |
|
76 | + $s .= 'XmlFormat::$parseAttributes = '. |
|
77 | + (self::$parseAttributes ? 'true' : 'false').";\n"; |
|
78 | + $s .= 'XmlFormat::$parseNamespaces = '. |
|
79 | + (self::$parseNamespaces ? 'true' : 'false').";\n"; |
|
80 | 80 | if (self::$parseNamespaces) { |
81 | - $s .= 'XmlFormat::$namespaces = ' . |
|
82 | - (var_export(self::$namespaces, true)) . ";\n"; |
|
83 | - $s .= 'XmlFormat::$namespacedProperties = ' . |
|
84 | - (var_export(self::$namespacedProperties, true)) . ";\n"; |
|
81 | + $s .= 'XmlFormat::$namespaces = '. |
|
82 | + (var_export(self::$namespaces, true)).";\n"; |
|
83 | + $s .= 'XmlFormat::$namespacedProperties = '. |
|
84 | + (var_export(self::$namespacedProperties, true)).";\n"; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | return $s; |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | ) { |
114 | 114 | continue; |
115 | 115 | } |
116 | - $prefix = 'xmlns' . (empty($prefix) ? '' : ':' . $prefix); |
|
116 | + $prefix = 'xmlns'.(empty($prefix) ? '' : ':'.$prefix); |
|
117 | 117 | $xml->writeAttribute($prefix, $ns); |
118 | 118 | } |
119 | 119 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $value = $value ? 'true' : 'false'; |
168 | 168 | } |
169 | 169 | if (isset($attributes[$key])) { |
170 | - $xml->writeAttribute($useNS ? static::$namespacedProperties[$key] . ':' . $key : $key, $value); |
|
170 | + $xml->writeAttribute($useNS ? static::$namespacedProperties[$key].':'.$key : $key, $value); |
|
171 | 171 | } else { |
172 | 172 | $useNS |
173 | 173 | ? |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | } |
183 | 183 | } |
184 | 184 | } else { |
185 | - $text [] = (string)$data; |
|
185 | + $text [] = (string) $data; |
|
186 | 186 | } |
187 | 187 | if (!empty($text)) { |
188 | 188 | if (count($text) == 1) { |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | if (false === $xml) { |
211 | 211 | $error = libxml_get_last_error(); |
212 | 212 | throw new RestException(400, 'Malformed XML. ' |
213 | - . trim($error->message, "\r\n") . ' at line ' . $error->line); |
|
213 | + . trim($error->message, "\r\n").' at line '.$error->line); |
|
214 | 214 | } |
215 | 215 | libxml_clear_errors(); |
216 | 216 | if (static::$importSettingsFromXml) { |
@@ -236,14 +236,14 @@ discard block |
||
236 | 236 | return $data; |
237 | 237 | } catch (\RuntimeException $e) { |
238 | 238 | throw new RestException(400, |
239 | - "Error decoding request. " . $e->getMessage()); |
|
239 | + "Error decoding request. ".$e->getMessage()); |
|
240 | 240 | } |
241 | 241 | } |
242 | 242 | |
243 | 243 | public function read(SimpleXMLElement $xml, $namespaces = null) |
244 | 244 | { |
245 | 245 | $r = array(); |
246 | - $text = (string)$xml; |
|
246 | + $text = (string) $xml; |
|
247 | 247 | |
248 | 248 | if (static::$parseAttributes) { |
249 | 249 | $attributes = $xml->attributes(); |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | ) { |
254 | 254 | static::$attributeNames[] = $key; |
255 | 255 | } |
256 | - $r[$key] = static::setType((string)$value); |
|
256 | + $r[$key] = static::setType((string) $value); |
|
257 | 257 | } |
258 | 258 | } |
259 | 259 | $children = $xml->children(); |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | static::$namespacedProperties[$key] = $prefix; |
293 | 293 | static::$attributeNames[] = $key; |
294 | 294 | } |
295 | - $r[$key] = static::setType((string)$value); |
|
295 | + $r[$key] = static::setType((string) $value); |
|
296 | 296 | } |
297 | 297 | } |
298 | 298 | $children = $xml->children($ns); |
@@ -89,7 +89,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -25,7 +25,7 @@ discard block |
||
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 |
||
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 | /** |
@@ -42,8 +42,8 @@ |
||
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 | } |
@@ -37,8 +37,8 @@ |
||
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() |
@@ -108,7 +108,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -58,8 +58,8 @@ discard block |
||
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 |
||
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(); |
@@ -31,20 +31,20 @@ |
||
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"); |