@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $restler = Scope::get('Restler'); |
| 60 | 60 | if (static::$addExtension) |
| 61 | 61 | static::$extension = isset($restler->responseFormat) |
| 62 | - ? '.' . $restler->responseFormat->getExtension() |
|
| 62 | + ? '.'.$restler->responseFormat->getExtension() |
|
| 63 | 63 | : '.html'; |
| 64 | 64 | static::$url = $restler->getBaseUrl(); |
| 65 | 65 | if (empty(static::$url)) |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | : $activeTrail; |
| 73 | 73 | if (static::$addExtension) |
| 74 | 74 | static::$extension = isset($restler->responseFormat) |
| 75 | - ? '.' . $restler->responseFormat->getExtension() |
|
| 75 | + ? '.'.$restler->responseFormat->getExtension() |
|
| 76 | 76 | : '.html'; |
| 77 | 77 | static::addUrls(static::$prepends); |
| 78 | 78 | $map = Routes::findAll( |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | $label = Text::title(static::$root); |
| 184 | 184 | $url = static::$url; |
| 185 | 185 | } else { |
| 186 | - $url = static::$url . '/' . ltrim($url, '/'); |
|
| 186 | + $url = static::$url.'/'.ltrim($url, '/'); |
|
| 187 | 187 | } |
| 188 | 188 | } |
| 189 | 189 | if (is_null($label)) { |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | $info = false; |
| 136 | 136 | } |
| 137 | 137 | if (!$info) { |
| 138 | - throw new RestException(500, 'invalid action path for form `' . $method . ' ' . $action . '`'); |
|
| 138 | + throw new RestException(500, 'invalid action path for form `'.$method.' '.$action.'`'); |
|
| 139 | 139 | } |
| 140 | 140 | static::$info = $info; |
| 141 | 141 | $m = $info->metadata; |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | if (empty(Defaults::$httpMethodOverrideProperty)) { |
| 145 | 145 | throw new RestException( |
| 146 | 146 | 500, |
| 147 | - 'Forms require `Defaults::\$httpMethodOverrideProperty`' . |
|
| 147 | + 'Forms require `Defaults::\$httpMethodOverrideProperty`'. |
|
| 148 | 148 | "for supporting HTTP $method" |
| 149 | 149 | ); |
| 150 | 150 | } |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | } |
| 196 | 196 | $r[] = $s; |
| 197 | 197 | $t = array( |
| 198 | - 'action' => $restler->getBaseUrl() . '/' . rtrim($action, '/'), |
|
| 198 | + 'action' => $restler->getBaseUrl().'/'.rtrim($action, '/'), |
|
| 199 | 199 | 'method' => $method, |
| 200 | 200 | ); |
| 201 | 201 | if (static::$fileUpload) { |
@@ -221,8 +221,8 @@ discard block |
||
| 221 | 221 | if (isset($metadata[CommentParser::$embeddedDataName][$name])) { |
| 222 | 222 | return $metadata[CommentParser::$embeddedDataName][$name]; |
| 223 | 223 | } |
| 224 | - $style = static::$style . '::' . $name; |
|
| 225 | - $typedStyle = $style . '_' . $type; |
|
| 224 | + $style = static::$style.'::'.$name; |
|
| 225 | + $typedStyle = $style.'_'.$type; |
|
| 226 | 226 | if (defined($typedStyle)) { |
| 227 | 227 | return constant($typedStyle); |
| 228 | 228 | } |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | if ($vc->from == 'path') { |
| 267 | 267 | continue; |
| 268 | 268 | } |
| 269 | - $vc->name = $v->name . '[' . $vc->name . ']'; |
|
| 269 | + $vc->name = $v->name.'['.$vc->name.']'; |
|
| 270 | 270 | $t [] = static::field($vc, $dataOnly); |
| 271 | 271 | } |
| 272 | 272 | $r[] = $t; |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | } |
| 436 | 436 | $target = "$method $action"; |
| 437 | 437 | if (empty(static::$key[$target])) { |
| 438 | - static::$key[$target] = md5($target . User::getIpAddress() . uniqid(mt_rand())); |
|
| 438 | + static::$key[$target] = md5($target.User::getIpAddress().uniqid(mt_rand())); |
|
| 439 | 439 | } |
| 440 | 440 | $_SESSION[static::FORM_KEY] = static::$key; |
| 441 | 441 | return static::$key[$target]; |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | if (!empty($_POST) && $check) { |
| 474 | 474 | if ( |
| 475 | 475 | isset($_POST[static::FORM_KEY]) && |
| 476 | - ($target = Util::getRequestMethod() . ' ' . $restler->url) && |
|
| 476 | + ($target = Util::getRequestMethod().' '.$restler->url) && |
|
| 477 | 477 | isset($_SESSION[static::FORM_KEY][$target]) && |
| 478 | 478 | $_POST[static::FORM_KEY] == $_SESSION[static::FORM_KEY][$target] |
| 479 | 479 | ) { |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | return array(); |
| 30 | 30 | |
| 31 | 31 | $implicitTag = |
| 32 | - function () use (& $tag) { |
|
| 32 | + function() use (& $tag) { |
|
| 33 | 33 | if (empty($tag->tag)) { |
| 34 | 34 | switch ($tag->parent->tag) { |
| 35 | 35 | case 'ul': |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | }; |
| 60 | 60 | |
| 61 | 61 | $parseText = |
| 62 | - function ( |
|
| 62 | + function( |
|
| 63 | 63 | $text, $round, $total, $data, $delimiter = null |
| 64 | 64 | ) |
| 65 | 65 | use ( |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | if (is_numeric($data)) { |
| 109 | - $text .= sprintf("%0{$digits}d", (int)$data); |
|
| 109 | + $text .= sprintf("%0{$digits}d", (int) $data); |
|
| 110 | 110 | } elseif (is_string($data)) { |
| 111 | 111 | $text .= $data; |
| 112 | 112 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | }; |
| 133 | 133 | |
| 134 | 134 | $parseAttributes = |
| 135 | - function (Callable $self, $round, $total, $data) |
|
| 135 | + function(Callable $self, $round, $total, $data) |
|
| 136 | 136 | use (& $tokens, & $tag, $parseText) { |
| 137 | 137 | $a = $parseText( |
| 138 | 138 | '', $round, $total, $data |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | $parent = $root = new T; |
| 174 | 174 | |
| 175 | 175 | $parse = |
| 176 | - function ( |
|
| 176 | + function( |
|
| 177 | 177 | Callable $self, $round = 1, $total = 1 |
| 178 | 178 | ) |
| 179 | 179 | use ( |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | if (is_string($times)) { |
| 296 | 296 | if (!isset($delimiter[$times])) { |
| 297 | 297 | $data = Util::nestedValue($data, $times) |
| 298 | - ? : $data; |
|
| 298 | + ?: $data; |
|
| 299 | 299 | } else { |
| 300 | 300 | array_unshift($tokens, $times); |
| 301 | 301 | $removeCount = 1; |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | $data = is_array($sourceData) |
| 331 | 331 | && isset($sourceData[$i - 1]) |
| 332 | 332 | ? $sourceData[$i - 1] |
| 333 | - : @(string)$sourceData; |
|
| 333 | + : @(string) $sourceData; |
|
| 334 | 334 | $tokens = array_values($remainingTokens); |
| 335 | 335 | $self($self, $i, $times); |
| 336 | 336 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | public function __setAuthenticationStatus($isAuthenticated = false) |
| 86 | 86 | { |
| 87 | - header('X-Auth-Status: ' . ($isAuthenticated ? 'true' : 'false')); |
|
| 87 | + header('X-Auth-Status: '.($isAuthenticated ? 'true' : 'false')); |
|
| 88 | 88 | $this->check($isAuthenticated); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | if (!isset(static::$units[$unit])) |
| 94 | 94 | throw new \InvalidArgumentException( |
| 95 | 95 | 'Rate Limit time unit should be ' |
| 96 | - . implode('|', array_keys(static::$units)) . '.' |
|
| 96 | + . implode('|', array_keys(static::$units)).'.' |
|
| 97 | 97 | ); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -117,16 +117,16 @@ discard block |
||
| 117 | 117 | if (!method_exists($user, 'getUniqueIdentifier')) { |
| 118 | 118 | throw new \UnexpectedValueException('`Defaults::$userIdentifierClass` must implement `iIdentifyUser` interface'); |
| 119 | 119 | } |
| 120 | - $id = "RateLimit_" . $maxPerUnit . '_per_' . static::$unit |
|
| 121 | - . '_for_' . static::$group |
|
| 122 | - . '_' . $user::getUniqueIdentifier(); |
|
| 120 | + $id = "RateLimit_".$maxPerUnit.'_per_'.static::$unit |
|
| 121 | + . '_for_'.static::$group |
|
| 122 | + . '_'.$user::getUniqueIdentifier(); |
|
| 123 | 123 | $lastRequest = $this->restler->cache->get($id, true) |
| 124 | - ? : array('time' => 0, 'used' => 0); |
|
| 124 | + ?: array('time' => 0, 'used' => 0); |
|
| 125 | 125 | $time = $lastRequest['time']; |
| 126 | 126 | $diff = time() - $time; # in seconds |
| 127 | 127 | $used = $lastRequest['used']; |
| 128 | 128 | |
| 129 | - header("X-RateLimit-Limit: $maxPerUnit per " . static::$unit); |
|
| 129 | + header("X-RateLimit-Limit: $maxPerUnit per ".static::$unit); |
|
| 130 | 130 | if ($diff >= $timeUnit) { |
| 131 | 131 | $used = 1; |
| 132 | 132 | $time = time(); |
@@ -135,10 +135,10 @@ discard block |
||
| 135 | 135 | $wait = $timeUnit - $diff; |
| 136 | 136 | sleep(1); |
| 137 | 137 | throw new RestException(429, |
| 138 | - 'Rate limit of ' . $maxPerUnit . ' request' . |
|
| 139 | - ($maxPerUnit > 1 ? 's' : '') . ' per ' |
|
| 140 | - . static::$unit . ' exceeded. Please wait for ' |
|
| 141 | - . static::duration($wait) . '.' |
|
| 138 | + 'Rate limit of '.$maxPerUnit.' request'. |
|
| 139 | + ($maxPerUnit > 1 ? 's' : '').' per ' |
|
| 140 | + . static::$unit.' exceeded. Please wait for ' |
|
| 141 | + . static::duration($wait).'.' |
|
| 142 | 142 | ); |
| 143 | 143 | } else { |
| 144 | 144 | $used++; |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | private function duration($secs) |
| 155 | 155 | { |
| 156 | 156 | $units = array( |
| 157 | - 'week' => (int)($secs / 86400 / 7), |
|
| 157 | + 'week' => (int) ($secs / 86400 / 7), |
|
| 158 | 158 | 'day' => $secs / 86400 % 7, |
| 159 | 159 | 'hour' => $secs / 3600 % 24, |
| 160 | 160 | 'minute' => $secs / 60 % 60, |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | } |
| 172 | 172 | $i = count($ret) - 1; |
| 173 | 173 | if ($i) { |
| 174 | - $ret[$i] = 'and ' . $ret[$i]; |
|
| 174 | + $ret[$i] = 'and '.$ret[$i]; |
|
| 175 | 175 | } |
| 176 | 176 | return implode(' ', $ret); //." $unit."; |
| 177 | 177 | } |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | /** |
| 27 | 27 | * @var string charset encoding defaults to UTF8 |
| 28 | 28 | */ |
| 29 | - protected $charset='utf-8'; |
|
| 29 | + protected $charset = 'utf-8'; |
|
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * Injected at runtime |
@@ -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 | /** |