@@ -5,12 +5,12 @@ |
||
| 5 | 5 | $webRequest = new \ByJG\Util\WebRequest('http://www.byjg.com.br/ws/cep'); |
| 6 | 6 | |
| 7 | 7 | echo $webRequest->get([ |
| 8 | - 'httpmethod' => 'obterVersao' |
|
| 8 | + 'httpmethod' => 'obterVersao' |
|
| 9 | 9 | ]) . "\n"; |
| 10 | 10 | |
| 11 | 11 | echo $webRequest->post([ |
| 12 | - 'httpmethod' => 'obterLogradouro', |
|
| 13 | - 'cep' => '30130000' |
|
| 12 | + 'httpmethod' => 'obterLogradouro', |
|
| 13 | + 'cep' => '30130000' |
|
| 14 | 14 | ]) . "\n"; |
| 15 | 15 | |
| 16 | 16 | echo $webRequest->soapCall('obterLogradouro', ['cep' => '30130000']) . "\n"; |
@@ -6,11 +6,11 @@ |
||
| 6 | 6 | |
| 7 | 7 | echo $webRequest->get([ |
| 8 | 8 | 'httpmethod' => 'obterVersao' |
| 9 | -]) . "\n"; |
|
| 9 | +])."\n"; |
|
| 10 | 10 | |
| 11 | 11 | echo $webRequest->post([ |
| 12 | 12 | 'httpmethod' => 'obterLogradouro', |
| 13 | 13 | 'cep' => '30130000' |
| 14 | -]) . "\n"; |
|
| 14 | +])."\n"; |
|
| 15 | 15 | |
| 16 | -echo $webRequest->soapCall('obterLogradouro', ['cep' => '30130000']) . "\n"; |
|
| 16 | +echo $webRequest->soapCall('obterLogradouro', ['cep' => '30130000'])."\n"; |
|
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | |
| 51 | 51 | $debug = $this->getDataTable(); |
| 52 | 52 | if (count($debug) > 0) { |
| 53 | - $response .= "\n\n" . json_encode(["debug" => $debug]); |
|
| 53 | + $response .= "\n\n".json_encode(["debug" => $debug]); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | $this->setProperHeader($this->getException()); |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | $newName = $this->getFileName($key); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - move_uploaded_file($this->getFileByKey($key, 'tmp_name'), $destinationPath . '/' . $newName); |
|
| 49 | + move_uploaded_file($this->getFileByKey($key, 'tmp_name'), $destinationPath.'/'.$newName); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | public function clearTemp($key) |
@@ -132,7 +132,7 @@ |
||
| 132 | 132 | foreach ($this->headers as $header => $values) { |
| 133 | 133 | $replace = true; |
| 134 | 134 | foreach ($values as $value) { |
| 135 | - $result[] = [ "$header: $value", $replace ]; |
|
| 135 | + $result[] = ["$header: $value", $replace]; |
|
| 136 | 136 | $replace = false; |
| 137 | 137 | } |
| 138 | 138 | } |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | public function add($object) |
| 21 | 21 | { |
| 22 | 22 | if (!is_object($object) && !is_array($object)) { |
| 23 | - $object = [ $object ]; |
|
| 23 | + $object = [$object]; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | if ($this->serializationRule !== ResponseBag::SINGLE_OBJECT) { |
@@ -186,13 +186,13 @@ |
||
| 186 | 186 | $servername = $this->getServerName(); |
| 187 | 187 | |
| 188 | 188 | if ($port && $this->server('SERVER_PORT' !== false)) { |
| 189 | - $servername .= ':' . $this->server('SERVER_PORT'); |
|
| 189 | + $servername .= ':'.$this->server('SERVER_PORT'); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | if ($protocol) { |
| 193 | 193 | $servername = ( |
| 194 | 194 | ($this->server('HTTPS') !== 'off' |
| 195 | - || $this->server('SERVER_PORT') == 443) ? "https://" : "http://") . $servername |
|
| 195 | + || $this->server('SERVER_PORT') == 443) ? "https://" : "http://").$servername |
|
| 196 | 196 | ; |
| 197 | 197 | } |
| 198 | 198 | |
@@ -68,7 +68,7 @@ |
||
| 68 | 68 | { |
| 69 | 69 | if (method_exists($this->handler, 'addDataTable')) { |
| 70 | 70 | $data = $this->handler->getDataTable(); |
| 71 | - $this->handler->addDataTable('Info #' . (count($data) + 1), array($name => $value)); |
|
| 71 | + $this->handler->addDataTable('Info #'.(count($data) + 1), array($name => $value)); |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
| 3 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
| 4 | 4 | |
| 5 | 5 | $restServer = new \ByJG\RestServer\ServerRequestHandler(); |
| 6 | 6 | |
| 7 | -$restServer->setRoutesSwagger(__DIR__ . '/../tests/swagger-example.json'); |
|
| 7 | +$restServer->setRoutesSwagger(__DIR__.'/../tests/swagger-example.json'); |
|
| 8 | 8 | |
| 9 | 9 | $restServer->handle(); |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | parse_str(parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY), $queryStr); |
| 106 | 106 | |
| 107 | 107 | // Generic Dispatcher for RestServer |
| 108 | - $dispatcher = \FastRoute\simpleDispatcher(function (RouteCollector $r) { |
|
| 108 | + $dispatcher = \FastRoute\simpleDispatcher(function(RouteCollector $r) { |
|
| 109 | 109 | |
| 110 | 110 | foreach ($this->getRoutes() as $route) { |
| 111 | 111 | $r->addRoute( |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | // Check if script exists or if is itself |
| 231 | 231 | // -------------------------------------------------------------------------- |
| 232 | 232 | |
| 233 | - $debugBacktrace = debug_backtrace(); |
|
| 233 | + $debugBacktrace = debug_backtrace(); |
|
| 234 | 234 | if (!empty($_SERVER['SCRIPT_FILENAME']) |
| 235 | 235 | && file_exists($_SERVER['SCRIPT_FILENAME']) |
| 236 | 236 | && basename($_SERVER['SCRIPT_FILENAME']) !== basename($debugBacktrace[0]['file']) |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | require_once($file); |
| 241 | 241 | } else { |
| 242 | 242 | if (!defined("RESTSERVER_TEST")) { |
| 243 | - header("Content-Type: " . $this->mimeContentType($file)); |
|
| 243 | + header("Content-Type: ".$this->mimeContentType($file)); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | echo file_get_contents($file); |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | $routes = []; |
| 373 | 373 | foreach ($pathList as $path) { |
| 374 | 374 | foreach ($schema['paths'][$path] as $method => $properties) { |
| 375 | - $handler = $this->getMethodHandler($method, $basePath . $path, $properties); |
|
| 375 | + $handler = $this->getMethodHandler($method, $basePath.$path, $properties); |
|
| 376 | 376 | if (!isset($properties['operationId'])) { |
| 377 | 377 | throw new OperationIdInvalidException('OperationId was not found'); |
| 378 | 378 | } |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | |
| 387 | 387 | $routes[] = new RoutePattern( |
| 388 | 388 | strtoupper($method), |
| 389 | - $basePath . $path, |
|
| 389 | + $basePath.$path, |
|
| 390 | 390 | $handler, |
| 391 | 391 | $parts[1], |
| 392 | 392 | $parts[0] |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | |
| 400 | 400 | protected function sortPaths($pathList) |
| 401 | 401 | { |
| 402 | - usort($pathList, function ($left, $right) { |
|
| 402 | + usort($pathList, function($left, $right) { |
|
| 403 | 403 | if (strpos($left, '{') === false && strpos($right, '{') !== false) { |
| 404 | 404 | return -16384; |
| 405 | 405 | } |