@@ -28,7 +28,7 @@ |
||
28 | 28 | //changes in iAuthenticate |
29 | 29 | Defaults::$authenticationMethod = '__isAuthenticated'; |
30 | 30 | |
31 | -include __DIR__ . '/iAuthenticate.php'; |
|
31 | +include __DIR__.'/iAuthenticate.php'; |
|
32 | 32 | |
33 | 33 | //changes in auto routing |
34 | 34 | Defaults::$smartAutoRouting = false; |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | //changes in iAuthenticate |
8 | 8 | Defaults::$authenticationMethod = 'isAuthenticated'; |
9 | -include __DIR__ . '/iAuthenticate.php'; |
|
9 | +include __DIR__.'/iAuthenticate.php'; |
|
10 | 10 | |
11 | 11 | //changes in routing |
12 | 12 | Defaults::$autoRoutingEnabled = false; |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | use Luracast\Restler\Restler; |
3 | 3 | use Luracast\Restler\Util; |
4 | 4 | |
5 | -$template_vars = $data;//get_defined_vars(); |
|
5 | +$template_vars = $data; //get_defined_vars(); |
|
6 | 6 | |
7 | 7 | unset($template_vars['response']); |
8 | 8 | unset($template_vars['api']); |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | continue; |
44 | 44 | } |
45 | 45 | //$output .= print_r($entry, true) . "\n"; |
46 | - $output .= "\nFile: " . $entry['file'] . " (Line: " . $entry['line'] . ")\n"; |
|
46 | + $output .= "\nFile: ".$entry['file']." (Line: ".$entry['line'].")\n"; |
|
47 | 47 | if (isset($entry['class'])) |
48 | - $output .= $entry['class'] . "::"; |
|
48 | + $output .= $entry['class']."::"; |
|
49 | 49 | $output .= $entry['function'] |
50 | - . "( " . json_encode($entry['args']) . " )\n"; |
|
50 | + . "( ".json_encode($entry['args'])." )\n"; |
|
51 | 51 | } |
52 | 52 | return $output; |
53 | 53 | } |
@@ -64,18 +64,18 @@ discard block |
||
64 | 64 | } else { |
65 | 65 | if (isset($response['error']['message'])) { |
66 | 66 | $icon = '<icon class="denied"></icon>'; |
67 | - $title = end(explode(':',$response['error']['message'],2)); |
|
67 | + $title = end(explode(':', $response['error']['message'], 2)); |
|
68 | 68 | } else { |
69 | 69 | $icon = '<icon class="warning"></icon>'; |
70 | 70 | $title = 'No Matching Resource'; |
71 | 71 | } |
72 | 72 | } |
73 | -function render($data, $shadow=true) |
|
73 | +function render($data, $shadow = true) |
|
74 | 74 | { |
75 | 75 | $r = ''; |
76 | 76 | if (empty($data)) |
77 | 77 | return $r; |
78 | - $r .= $shadow ? "<ul class=\"shadow\">\n": "<ul>\n"; |
|
78 | + $r .= $shadow ? "<ul class=\"shadow\">\n" : "<ul>\n"; |
|
79 | 79 | if (is_array($data)) { |
80 | 80 | // field name |
81 | 81 | foreach ($data as $key => $value) { |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $r .= '<span>'; |
87 | 87 | if (is_array($value)) { |
88 | 88 | // recursive |
89 | - $r .= render($value,false); |
|
89 | + $r .= render($value, false); |
|
90 | 90 | } else { |
91 | 91 | // value, with hyperlinked hyperlinks |
92 | 92 | if (is_bool($value)) { |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | } |
95 | 95 | $value = htmlentities($value, ENT_COMPAT, 'UTF-8'); |
96 | 96 | if (strpos($value, 'http://') === 0) { |
97 | - $r .= '<a href="' . $value . '">' . $value . '</a>'; |
|
97 | + $r .= '<a href="'.$value.'">'.$value.'</a>'; |
|
98 | 98 | } else { |
99 | 99 | $r .= $value; |
100 | 100 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $r .= "</span></li>\n"; |
103 | 103 | } |
104 | 104 | } elseif (is_bool($data)) { |
105 | - $r .= '<li>' . ($data ? 'true' : 'false') . '</li>'; |
|
105 | + $r .= '<li>'.($data ? 'true' : 'false').'</li>'; |
|
106 | 106 | } else { |
107 | 107 | $r .= "<li><strong>$data</strong></li>"; |
108 | 108 | } |
@@ -110,11 +110,11 @@ discard block |
||
110 | 110 | return $r; |
111 | 111 | } |
112 | 112 | $reqHeadersArr = array(); |
113 | -$requestHeaders = $_SERVER['REQUEST_METHOD'] . ' ' . $_SERVER['REQUEST_URI'] . ' ' . $_SERVER['SERVER_PROTOCOL'] . PHP_EOL; |
|
113 | +$requestHeaders = $_SERVER['REQUEST_METHOD'].' '.$_SERVER['REQUEST_URI'].' '.$_SERVER['SERVER_PROTOCOL'].PHP_EOL; |
|
114 | 114 | foreach ($reqHeadersArr as $key => $value) { |
115 | 115 | if ($key == 'Host') |
116 | 116 | continue; |
117 | - $requestHeaders .= "$key: $value" . PHP_EOL; |
|
117 | + $requestHeaders .= "$key: $value".PHP_EOL; |
|
118 | 118 | } |
119 | 119 | // $requestHeaders = $this->encode(apache_request_headers(), FALSE, |
120 | 120 | // FALSE); |
@@ -134,20 +134,20 @@ discard block |
||
134 | 134 | <body> |
135 | 135 | <div id="breadcrumbs-one"> |
136 | 136 | <?php |
137 | - if(Util::$restler->exception){ |
|
138 | - $stages = Util::$restler->exception->getStages(); |
|
137 | + if (Util::$restler->exception) { |
|
138 | + $stages = Util::$restler->exception->getStages(); |
|
139 | 139 | $curStage = Util::$restler->exception->getStage(); |
140 | - foreach($stages['success'] as $stage){ |
|
140 | + foreach ($stages['success'] as $stage) { |
|
141 | 141 | echo "<a href=\"#\">$stage</a>"; |
142 | 142 | } |
143 | - foreach($stages['failure'] as $stage){ |
|
143 | + foreach ($stages['failure'] as $stage) { |
|
144 | 144 | echo '<a href="#" class="failure">' |
145 | 145 | . $stage |
146 | - . ($stage==$curStage ? ' <span class="state"/> ' : '') |
|
146 | + . ($stage == $curStage ? ' <span class="state"/> ' : '') |
|
147 | 147 | . '</a>'; |
148 | 148 | } |
149 | 149 | } else { |
150 | - foreach(Util::$restler->_events as $stage){ |
|
150 | + foreach (Util::$restler->_events as $stage) { |
|
151 | 151 | echo "<a href=\"#\">$stage</a>"; |
152 | 152 | } |
153 | 153 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | </header> |
159 | 159 | <article> |
160 | 160 | |
161 | - <h2>Response:<right><?php echo $icon;?></right></h2> |
|
161 | + <h2>Response:<right><?php echo $icon; ?></right></h2> |
|
162 | 162 | <pre class="header"><?php echo $responseHeaders ?></pre> |
163 | 163 | <?php echo render($response); ?> |
164 | 164 | <h2>Additional Template Data:</h2> |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | $filename == 'index.html' |
153 | 153 | ) { |
154 | 154 | $status = 302; |
155 | - $url = $this->restler->getBaseUrl() . '/' . $this->base() . '/'; |
|
156 | - header("{$_SERVER['SERVER_PROTOCOL']} $status " . RestException::$codes[$status]); |
|
155 | + $url = $this->restler->getBaseUrl().'/'.$this->base().'/'; |
|
156 | + header("{$_SERVER['SERVER_PROTOCOL']} $status ".RestException::$codes[$status]); |
|
157 | 157 | header("Location: $url"); |
158 | 158 | exit; |
159 | 159 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | ) { |
164 | 164 | $filename .= '.js'; |
165 | 165 | } |
166 | - PassThrough::file(__DIR__ . '/explorer/' . (empty($filename) ? 'index.html' : $filename), false, |
|
166 | + PassThrough::file(__DIR__.'/explorer/'.(empty($filename) ? 'index.html' : $filename), false, |
|
167 | 167 | 0); //60 * 60 * 24); |
168 | 168 | } |
169 | 169 | |
@@ -173,15 +173,15 @@ discard block |
||
173 | 173 | public function swagger() |
174 | 174 | { |
175 | 175 | $r = new stdClass(); |
176 | - $version = (string)$this->restler->getRequestedApiVersion(); |
|
176 | + $version = (string) $this->restler->getRequestedApiVersion(); |
|
177 | 177 | $r->swagger = static::SWAGGER; |
178 | 178 | |
179 | 179 | $info = parse_url($this->restler->getBaseUrl()); |
180 | 180 | $r->host = $info['host']; |
181 | 181 | if (isset($info['port'])) { |
182 | - $r->host .= ':' . $info['port']; |
|
182 | + $r->host .= ':'.$info['port']; |
|
183 | 183 | } |
184 | - $r->basePath = isset($info['path']) ? $info['path'] : ''; |
|
184 | + $r->basePath = isset($info['path']) ? $info['path'] : ''; |
|
185 | 185 | if (!empty(static::$schemes)) { |
186 | 186 | $r->schemes = static::$schemes; |
187 | 187 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | $r->consumes = $this->restler->getReadableMimeTypes(); |
191 | 191 | |
192 | 192 | $r->paths = $this->paths($version); |
193 | - $r->definitions = (object)$this->models; |
|
193 | + $r->definitions = (object) $this->models; |
|
194 | 194 | $r->securityDefinitions = $this->securityDefinitions(); |
195 | 195 | $r->info = compact('version') + array_filter(get_class_vars(static::$infoClass)); |
196 | 196 | |
@@ -302,8 +302,8 @@ discard block |
||
302 | 302 | $description = ''; //'<section class="body-param">'; |
303 | 303 | foreach ($firstChild['children'] as $child) { |
304 | 304 | $description .= isset($child['required']) && $child['required'] |
305 | - ? '**' . $child['name'] . '** (required) '.PHP_EOL |
|
306 | - : $child['name'] . ' '.PHP_EOL; |
|
305 | + ? '**'.$child['name'].'** (required) '.PHP_EOL |
|
306 | + : $child['name'].' '.PHP_EOL; |
|
307 | 307 | } |
308 | 308 | //$description .= '</section>'; |
309 | 309 | } |
@@ -312,8 +312,8 @@ discard block |
||
312 | 312 | $description = ''; //'<section class="body-param">'; |
313 | 313 | foreach ($children as $child) { |
314 | 314 | $description .= isset($child['required']) && $child['required'] |
315 | - ? '**' . $child['name'] . '** (required) '.PHP_EOL |
|
316 | - : $child['name'] . ' '.PHP_EOL; |
|
315 | + ? '**'.$child['name'].'** (required) '.PHP_EOL |
|
316 | + : $child['name'].' '.PHP_EOL; |
|
317 | 317 | } |
318 | 318 | //$description .= '</section>'; |
319 | 319 | |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | //$p->allowMultiple = false; |
367 | 367 | |
368 | 368 | if (isset($p->{'$ref'})) { |
369 | - $p->schema = (object)array('$ref' => ($p->{'$ref'})); |
|
369 | + $p->schema = (object) array('$ref' => ($p->{'$ref'})); |
|
370 | 370 | unset($p->{'$ref'}); |
371 | 371 | } |
372 | 372 | |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | { |
378 | 378 | $code = '200'; |
379 | 379 | $r = array( |
380 | - $code => (object)array( |
|
380 | + $code => (object) array( |
|
381 | 381 | 'description' => 'Success', |
382 | 382 | 'schema' => new stdClass() |
383 | 383 | ) |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | if ($info->children) { |
446 | 446 | $contentType = Util::getShortName($info->contentType); |
447 | 447 | $model = $this->model($contentType, $info->children); |
448 | - $object->items = (object)array( |
|
448 | + $object->items = (object) array( |
|
449 | 449 | '$ref' => "#/definitions/$contentType" |
450 | 450 | ); |
451 | 451 | } elseif ($info->contentType && $info->contentType == 'associative') { |
@@ -463,23 +463,23 @@ discard block |
||
463 | 463 | if (is_string($info->contentType) && $t = Util::nestedValue(static::$dataTypeAlias, |
464 | 464 | strtolower($info->contentType))) { |
465 | 465 | if (is_array($t)) { |
466 | - $object->items = (object)array( |
|
466 | + $object->items = (object) array( |
|
467 | 467 | 'type' => $t[0], |
468 | 468 | 'format' => $t[1], |
469 | 469 | ); |
470 | 470 | } else { |
471 | - $object->items = (object)array( |
|
471 | + $object->items = (object) array( |
|
472 | 472 | 'type' => $t, |
473 | 473 | ); |
474 | 474 | } |
475 | 475 | } else { |
476 | 476 | $contentType = Util::getShortName($info->contentType); |
477 | - $object->items = (object)array( |
|
477 | + $object->items = (object) array( |
|
478 | 478 | '$ref' => "#/definitions/$contentType" |
479 | 479 | ); |
480 | 480 | } |
481 | 481 | } else { |
482 | - $object->items = (object)array( |
|
482 | + $object->items = (object) array( |
|
483 | 483 | 'type' => 'string' |
484 | 484 | ); |
485 | 485 | } |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | private function operationId(array $route) |
514 | 514 | { |
515 | 515 | static $hash = array(); |
516 | - $id = $route['httpMethod'] . ' ' . $route['url']; |
|
516 | + $id = $route['httpMethod'].' '.$route['url']; |
|
517 | 517 | if (isset($hash[$id])) { |
518 | 518 | return $hash[$id]; |
519 | 519 | } |
@@ -521,14 +521,14 @@ discard block |
||
521 | 521 | $method = $route['methodName']; |
522 | 522 | |
523 | 523 | if (isset(static::$prefixes[$method])) { |
524 | - $method = static::$prefixes[$method] . $class; |
|
524 | + $method = static::$prefixes[$method].$class; |
|
525 | 525 | } else { |
526 | 526 | $method = str_replace( |
527 | 527 | array_keys(static::$prefixes), |
528 | 528 | array_values(static::$prefixes), |
529 | 529 | $method |
530 | 530 | ); |
531 | - $method = lcfirst($class) . ucfirst($method); |
|
531 | + $method = lcfirst($class).ucfirst($method); |
|
532 | 532 | } |
533 | 533 | $hash[$id] = $method; |
534 | 534 | |
@@ -537,13 +537,13 @@ discard block |
||
537 | 537 | |
538 | 538 | private function modelName(array $route) |
539 | 539 | { |
540 | - return $this->operationId($route) . 'Model'; |
|
540 | + return $this->operationId($route).'Model'; |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | private function securityDefinitions() |
544 | 544 | { |
545 | 545 | $r = new stdClass(); |
546 | - $r->api_key = (object)array( |
|
546 | + $r->api_key = (object) array( |
|
547 | 547 | 'type' => 'apiKey', |
548 | 548 | 'name' => 'api_key', |
549 | 549 | 'in' => 'query', |
@@ -38,9 +38,8 @@ discard block |
||
38 | 38 | function_exists('apc_store') || $this->apcNotAvailable(); |
39 | 39 | |
40 | 40 | try { |
41 | - return apc_store(self::$namespace . "-" . $name, $data); |
|
42 | - } catch |
|
43 | - (\Exception $exception) { |
|
41 | + return apc_store(self::$namespace."-".$name, $data); |
|
42 | + } catch (\Exception $exception) { |
|
44 | 43 | return false; |
45 | 44 | } |
46 | 45 | } |
@@ -65,7 +64,7 @@ discard block |
||
65 | 64 | function_exists('apc_fetch') || $this->apcNotAvailable(); |
66 | 65 | |
67 | 66 | try { |
68 | - return apc_fetch(self::$namespace . "-" . $name); |
|
67 | + return apc_fetch(self::$namespace."-".$name); |
|
69 | 68 | } catch (\Exception $exception) { |
70 | 69 | if (!$ignoreErrors) { |
71 | 70 | throw $exception; |
@@ -89,7 +88,7 @@ discard block |
||
89 | 88 | function_exists('apc_delete') || $this->apcNotAvailable(); |
90 | 89 | |
91 | 90 | try { |
92 | - apc_delete(self::$namespace . "-" . $name); |
|
91 | + apc_delete(self::$namespace."-".$name); |
|
93 | 92 | } catch (\Exception $exception) { |
94 | 93 | if (!$ignoreErrors) { |
95 | 94 | throw $exception; |
@@ -108,7 +107,7 @@ discard block |
||
108 | 107 | public function isCached($name) |
109 | 108 | { |
110 | 109 | function_exists('apc_exists') || $this->apcNotAvailable(); |
111 | - return apc_exists(self::$namespace . "-" . $name); |
|
110 | + return apc_exists(self::$namespace."-".$name); |
|
112 | 111 | } |
113 | 112 | |
114 | 113 | } |
115 | 114 | \ No newline at end of file |
@@ -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)) { |