Completed
Pull Request — master (#5)
by Joao
07:19
created
example.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,12 +5,12 @@
 block discarded – undo
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";
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,11 +6,11 @@
 block discarded – undo
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";
Please login to merge, or discard this patch.
src/Whoops/PlainResponseHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
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());
Please login to merge, or discard this patch.
src/ErrorHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
     {
79 79
         if (method_exists($this->_handler, 'addDataTable')) {
80 80
             $data = $this->_handler->getDataTable();
81
-            $this->_handler->addDataTable('Info #' . (count($data) + 1), array($name => $value));
81
+            $this->_handler->addDataTable('Info #'.(count($data) + 1), array($name => $value));
82 82
         }
83 83
     }
84 84
 }
Please login to merge, or discard this patch.
src/HttpRequest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -180,11 +180,11 @@
 block discarded – undo
180 180
         }
181 181
 
182 182
         if ($port && $this->server('SERVER_PORT' !== false)) {
183
-            $servername .= ':' . $this->server('SERVER_PORT');
183
+            $servername .= ':'.$this->server('SERVER_PORT');
184 184
         }
185 185
 
186 186
         if ($protocol) {
187
-            $servername = (($this->server('HTTPS') !== 'off' || $this->server('SERVER_PORT') == 443) ? "https://" : "http://") . $servername;
187
+            $servername = (($this->server('HTTPS') !== 'off' || $this->server('SERVER_PORT') == 443) ? "https://" : "http://").$servername;
188 188
         }
189 189
 
190 190
         return $servername;
Please login to merge, or discard this patch.
src/UploadedFiles.php 2 patches
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -54,6 +54,11 @@
 block discarded – undo
54 54
         unlink($this->getFileByKey($key, 'tmp_name'));
55 55
     }
56 56
 
57
+    /**
58
+     * @param string $property
59
+     *
60
+     * @return string
61
+     */
57 62
     private function getFileByKey($key, $property)
58 63
     {
59 64
         if (!isset($_FILES[$key])) {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
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)
Please login to merge, or discard this patch.
web/app-dist.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-require_once __DIR__ . '/../vendor/autoload.php';
3
+require_once __DIR__.'/../vendor/autoload.php';
4 4
 
5 5
 \ByJG\RestServer\ServerRequestHandler::handle();
6 6
 
Please login to merge, or discard this patch.
src/ServerRequestHandler.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         parse_str(parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY), $queryStr);
123 123
 
124 124
         // Generic Dispatcher for RestServer
125
-        $dispatcher = \FastRoute\simpleDispatcher(function (RouteCollector $r) {
125
+        $dispatcher = \FastRoute\simpleDispatcher(function(RouteCollector $r) {
126 126
 
127 127
             foreach ($this->getRoutes() as $route) {
128 128
                 $r->addRoute(
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
                 if (isset($moduleAlias[$vars['module']])) {
161 161
                     $vars['_class'] = $moduleAlias[$vars['module']];
162 162
                 }
163
-                $vars['_class'] = '\\' . str_replace('.', '\\', $vars['_class']);
163
+                $vars['_class'] = '\\'.str_replace('.', '\\', $vars['_class']);
164 164
 
165 165
                 // Set all default values
166 166
                 foreach ($vars as $key => $value) {
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 
222 222
         // Execute the method
223 223
         $method = strtolower($instance->getRequest()->server("REQUEST_METHOD")); // get, post, put, delete
224
-        $customAction = $method . ($instance->getRequest()->get('action'));
224
+        $customAction = $method.($instance->getRequest()->get('action'));
225 225
         if (method_exists($instance, $customAction)) {
226 226
             $instance->$customAction();
227 227
         } else {
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
         // Check if script exists or if is itself
268 268
         // --------------------------------------------------------------------------
269 269
 
270
-        $debugBacktrace =  debug_backtrace();
270
+        $debugBacktrace = debug_backtrace();
271 271
         if (!empty($_SERVER['SCRIPT_FILENAME'])
272 272
             && file_exists($_SERVER['SCRIPT_FILENAME'])
273 273
             && str_replace('//', '/', $_SERVER['SCRIPT_FILENAME']) !== $debugBacktrace[0]['file']
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
             if (strpos($file, '.php') !== false) {
277 277
                 require_once($file);
278 278
             } else {
279
-                header("Content-Type: " . ServerRequestHandler::mimeContentType($file));
279
+                header("Content-Type: ".ServerRequestHandler::mimeContentType($file));
280 280
 
281 281
                 echo file_get_contents($file);
282 282
             }
Please login to merge, or discard this patch.
src/HttpResponse.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -132,7 +132,7 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
src/ResponseBag.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
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) {
Please login to merge, or discard this patch.