Completed
Push — master ( ebc249...bd4736 )
by Tomas
11s
created
src/Component/ApiListingControl.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -46,6 +46,9 @@
 block discarded – undo
46 46
         $this->clickCallback->__invoke($method, $version, $package, $apiAction);
47 47
     }
48 48
 
49
+    /**
50
+     * @param \Tomaj\NetteApi\Handlers\ApiHandlerInterface[] $handlers
51
+     */
49 52
     private function sortHandlers($handlers)
50 53
     {
51 54
         $versionHandlers = [];
Please login to merge, or discard this patch.
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,11 +2,11 @@
 block discarded – undo
2 2
 
3 3
 namespace Tomaj\NetteApi\Component;
4 4
 
5
+use Closure;
6
+use Exception;
5 7
 use Nette\Application\UI\Control;
6 8
 use Nette\ComponentModel\IContainer;
7 9
 use Tomaj\NetteApi\ApiDecider;
8
-use Closure;
9
-use Exception;
10 10
 
11 11
 class ApiListingControl extends Control
12 12
 {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
     {
34 34
         $handlers = $this->apiDecider->getHandlers();
35 35
         $this->getTemplate()->add('handlers', $this->sortHandlers($handlers));
36
-        $this->getTemplate()->setFile(__DIR__ . '/api_listing.latte');
36
+        $this->getTemplate()->setFile(__DIR__.'/api_listing.latte');
37 37
         $this->getTemplate()->render();
38 38
     }
39 39
 
Please login to merge, or discard this patch.
src/Handlers/ApiListingHandler.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
      */
52 52
     private function getHandlersList($version)
53 53
     {
54
-        $versionHandlers = array_filter($this->apiDecider->getHandlers(), function ($handler) use ($version) {
54
+        $versionHandlers = array_filter($this->apiDecider->getHandlers(), function($handler) use ($version) {
55 55
             return $version == $handler['endpoint']->getVersion();
56 56
         });
57 57
 
58
-        return array_map(function ($handler) {
58
+        return array_map(function($handler) {
59 59
             return [
60 60
                 'method' => $handler['endpoint']->getMethod(),
61 61
                 'version' => $handler['endpoint']->getVersion(),
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      */
78 78
     private function createParamsList(ApiHandlerInterface $handler)
79 79
     {
80
-        return array_map(function (InputParam $param) {
80
+        return array_map(function(InputParam $param) {
81 81
             $parameter = [
82 82
                 'type' => $param->getType(),
83 83
                 'key' => $param->getKey(),
Please login to merge, or discard this patch.
src/Component/ApiConsoleControl.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 
36 36
     public function render()
37 37
     {
38
-        $this->getTemplate()->setFile(__DIR__ . '/console.latte');
38
+        $this->getTemplate()->setFile(__DIR__.'/console.latte');
39 39
         $this->getTemplate()->render();
40 40
     }
41 41
 
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
         }
55 55
         $port = '';
56 56
         if ($uri->scheme == 'http' && $uri->port != 80) {
57
-            $port = ':' . $uri->port;
57
+            $port = ':'.$uri->port;
58 58
         }
59
-        $url = $scheme . '://' . $uri->host . $port . '/api/' . $this->endpoint->getUrl();
59
+        $url = $scheme.'://'.$uri->host.$port.'/api/'.$this->endpoint->getUrl();
60 60
 
61 61
         $form->addText('api_url', 'Api Url');
62 62
         $defaults['api_url'] = $url;
@@ -79,13 +79,13 @@  discard block
 block discarded – undo
79 79
             for ($i = 0; $i < $count; $i++) {
80 80
                 $key = $param->getKey();
81 81
                 if ($param->isMulti()) {
82
-                    $key = $key . '___' . $i;
82
+                    $key = $key.'___'.$i;
83 83
                 }
84 84
                 
85 85
                 if ($param->getAvailableValues() && is_array($param->getAvailableValues())) {
86 86
                     $c = $form->addSelect($key, $this->getParamLabel($param), array_combine($param->getAvailableValues(), $param->getAvailableValues()));
87 87
                     if (!$param->isRequired()) {
88
-                        $c->setPrompt('Select ' . $this->getLabel($param));
88
+                        $c->setPrompt('Select '.$this->getLabel($param));
89 89
                     }
90 90
                 } elseif ($param->getAvailableValues() && is_string($param->getAvailableValues())) {
91 91
                     $c = $form->addText($key, $this->getParamLabel($param))->setDisabled(true);
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         if ($param->isRequired()) {
124 124
             $title .= ' *';
125 125
         }
126
-        $title .= ' (' . $param->getType() . ')';
126
+        $title .= ' ('.$param->getType().')';
127 127
         return $title;
128 128
     }
129 129
 
Please login to merge, or discard this patch.
src/Misc/ConsoleRequest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
             foreach ($getFields as $key => $value) {
45 45
                 $parts[] = "$key=$value";
46 46
             }
47
-            $url = $url . '?' . implode('&', $parts);
47
+            $url = $url.'?'.implode('&', $parts);
48 48
         }
49 49
 
50 50
         $startTime = microtime(true);
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
             foreach ($cookieFields as $key => $value) {
72 72
                 $parts[] = "$key=$value";
73 73
             }
74
-            curl_setopt($curl, CURLOPT_HTTPHEADER, ["Cookie: " . implode('&', $parts)]);
74
+            curl_setopt($curl, CURLOPT_HTTPHEADER, ["Cookie: ".implode('&', $parts)]);
75 75
         }
76 76
 
77 77
         curl_setopt($curl, CURLOPT_TIMEOUT, 30);
78 78
         $headers = [];
79 79
         if ($token !== null && $token !== false) {
80
-            $headers = ['Authorization: Bearer ' . $token];
80
+            $headers = ['Authorization: Bearer '.$token];
81 81
             curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
82 82
         }
83 83
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
                 $counter = 0;
215 215
                 foreach ($value as $innerValue) {
216 216
                     if ($innerValue != null) {
217
-                        $result[$key . "[".$counter++."]"] = $innerValue;
217
+                        $result[$key."[".$counter++."]"] = $innerValue;
218 218
                     }
219 219
                 }
220 220
             } else {
Please login to merge, or discard this patch.
src/Presenters/ApiPresenter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -219,9 +219,9 @@
 block discarded – undo
219 219
         if (!(isset($refererParsedUrl['scheme']) && isset($refererParsedUrl['host']))) {
220 220
             return false;
221 221
         }
222
-        $url = $refererParsedUrl['scheme'] . '://' . $refererParsedUrl['host'];
222
+        $url = $refererParsedUrl['scheme'].'://'.$refererParsedUrl['host'];
223 223
         if (isset($refererParsedUrl['port']) && $refererParsedUrl['port'] !== 80) {
224
-            $url .= ':' . $refererParsedUrl['port'];
224
+            $url .= ':'.$refererParsedUrl['port'];
225 225
         }
226 226
         return $url;
227 227
     }
Please login to merge, or discard this patch.