@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | } |
40 | 40 | return false; |
41 | 41 | } |
42 | - return !(boolean)strpos('|bool|boolean|int|float|string|', $type); |
|
42 | + return !(boolean) strpos('|bool|boolean|int|float|string|', $type); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | if (strlen($resourcePath) > 0) { |
103 | 103 | $resourcePath .= '/'; |
104 | 104 | } |
105 | - return $prefix . $resourcePath; |
|
105 | + return $prefix.$resourcePath; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | $key = strtolower(trim($part[0])); |
234 | 234 | $parameters[$key] = trim($part[1], ' "'); |
235 | 235 | } |
236 | - $quality = isset($parameters['q']) ? (float)$parameters['q'] : (1000 - $pos) / 1000; |
|
236 | + $quality = isset($parameters['q']) ? (float) $parameters['q'] : (1000 - $pos) / 1000; |
|
237 | 237 | $acceptList[$type] = $quality; |
238 | 238 | } |
239 | 239 | arsort($acceptList); |
@@ -177,14 +177,14 @@ |
||
177 | 177 | break; |
178 | 178 | case 1 : |
179 | 179 | if ($addNewline) { |
180 | - $line = ' ' . $line; |
|
180 | + $line = ' '.$line; |
|
181 | 181 | } |
182 | 182 | $longDescription[] = $line; |
183 | 183 | break; |
184 | 184 | case 2 : |
185 | 185 | $newParam |
186 | 186 | ? $params[] = $line |
187 | - : $params[count($params) - 1] .= ' ' . $line; |
|
187 | + : $params[count($params) - 1] .= ' '.$line; |
|
188 | 188 | } |
189 | 189 | $addNewline = false; |
190 | 190 | } |
@@ -103,14 +103,14 @@ discard block |
||
103 | 103 | if ($child instanceof $this) { |
104 | 104 | $child->prefix = $prefix; |
105 | 105 | $child->indent = $this->indent; |
106 | - $children .= PHP_EOL . $child; |
|
106 | + $children .= PHP_EOL.$child; |
|
107 | 107 | $lineBreak = true; |
108 | 108 | } else { |
109 | 109 | $children .= $child; |
110 | 110 | } |
111 | 111 | } |
112 | 112 | if ($lineBreak) |
113 | - $children .= PHP_EOL . $this->prefix; |
|
113 | + $children .= PHP_EOL.$this->prefix; |
|
114 | 114 | } else { |
115 | 115 | $children = implode('', $this->children); |
116 | 116 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | } |
208 | 208 | $this->attributes[$attribute] = is_bool($value) |
209 | 209 | ? ($value ? 'true' : 'false') |
210 | - : @(string)$value; |
|
210 | + : @(string) $value; |
|
211 | 211 | return $this; |
212 | 212 | } |
213 | 213 |
@@ -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 |