Completed
Pull Request — master (#61)
by Andreas
01:23
created
config/routes.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     \Psr\Http\Message\ResponseInterface $response
44 44
 ) use ($app){
45 45
     $params = $request->getParsedBody();
46
-    if (! is_array($params)) {
46
+    if (!is_array($params)) {
47 47
         throw new UnexpectedValueException('Expected array');
48 48
     }
49 49
 
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     try {
52 52
         $cfp = $cfpFactory->createCfp($params, $app->getContainer()['client']);
53 53
     } catch (\Exception $e) {
54
-        error_log($e->getMessage() . "\n" . $e->getTraceAsString());
54
+        error_log($e->getMessage()."\n".$e->getTraceAsString());
55 55
     }
56 56
     $cpl = new \Callingallpapers\Api\PersistenceLayer\CfpPersistenceLayer(
57 57
         $app->getContainer()['pdo'],
@@ -60,18 +60,18 @@  discard block
 block discarded – undo
60 60
     $cpl->insert($cfp);
61 61
 
62 62
     $uri = $request->getUri();
63
-    $uri = $uri->withPath('v1/cfp/' . $cfp->getId());
63
+    $uri = $uri->withPath('v1/cfp/'.$cfp->getId());
64 64
     return $response->withRedirect((string)$uri, 201);
65 65
 });
66 66
 
67 67
 
68
-$app->put('/v1/cfp/{hash}', function (
68
+$app->put('/v1/cfp/{hash}', function(
69 69
     \Psr\Http\Message\ServerRequestInterface $request,
70 70
     \Psr\Http\Message\ResponseInterface $response,
71 71
     array $args
72 72
 ) use ($app){
73 73
     $params = $request->getParsedBody();
74
-    if (! is_array($params)) {
74
+    if (!is_array($params)) {
75 75
         throw new UnexpectedValueException('Expected array');
76 76
     }
77 77
 
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
     $cpl->update($cfp, $args['hash']);
86 86
 
87 87
     $uri = $request->getUri();
88
-    $uri = $uri->withPath('v1/cfp/' . $cfp->getId());
88
+    $uri = $uri->withPath('v1/cfp/'.$cfp->getId());
89 89
     return $response->withHeader('Location', (string)$uri)->withStatus(204);
90 90
 });
91 91
 
92 92
 
93
-$app->delete('/v1/cfp/{id}', function (
93
+$app->delete('/v1/cfp/{id}', function(
94 94
     \Psr\Http\Message\ServerRequestInterface $request,
95 95
     \Psr\Http\Message\ResponseInterface $response
96 96
 ) use ($app){
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     return $response->withHeader('Content-Length', '0')->withStatus(204);
105 105
 });
106 106
 
107
-$app->get('/v1/search', function (
107
+$app->get('/v1/search', function(
108 108
     \Psr\Http\Message\ServerRequestInterface $request,
109 109
     \Psr\Http\Message\ResponseInterface $response,
110 110
     array $args
@@ -119,5 +119,5 @@  discard block
 block discarded – undo
119 119
 
120 120
     $cfpMapper = new \Callingallpapers\Api\Entity\CfpListMapper();
121 121
 
122
-    return $this->view->render($response, $cfpMapper->map($list), 200, 'cfp/list.twig');;
122
+    return $this->view->render($response, $cfpMapper->map($list), 200, 'cfp/list.twig'); ;
123 123
 });
Please login to merge, or discard this patch.
src/Service/CfpFactory.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         $missingFields = [];
52 52
 
53 53
         foreach ($requiredFields as $field) {
54
-            if (! isset($params[$field])) {
54
+            if (!isset($params[$field])) {
55 55
                 $missingFields[] = $field;
56 56
             }
57 57
         }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
     public static function setName(Cfp $cfp, array $array)
86 86
     {
87
-        if (! isset($array['name'])) {
87
+        if (!isset($array['name'])) {
88 88
             throw new \InvalidArgumentException('Name has to be specified');
89 89
         }
90 90
         $cfp->setName(filter_var($array['name'], FILTER_SANITIZE_STRING));
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
     public static function setDateCfpStart(Cfp $cfp, array $array)
94 94
     {
95
-        if (! isset($array['dateCfpStart'])) {
95
+        if (!isset($array['dateCfpStart'])) {
96 96
             $array['dateCfpStart'] = '@0';
97 97
         }
98 98
         $cfp->setDateCfpStart(new DateTimeImmutable($array['dateCfpStart']));
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 
101 101
     public static function setDateCfpEnd(Cfp $cfp, array $array)
102 102
     {
103
-        if (! isset($array['dateCfpEnd'])) {
103
+        if (!isset($array['dateCfpEnd'])) {
104 104
             throw new \InvalidArgumentException('CFP-EndDate has to be specified');
105 105
         }
106 106
         $cfp->setDateCfpEnd(new DateTimeImmutable($array['dateCfpEnd']));
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 
109 109
     public static function setTimezone(Cfp $cfp, array $array)
110 110
     {
111
-        if (! isset($array['timezone'])) {
111
+        if (!isset($array['timezone'])) {
112 112
             throw new \InvalidArgumentException('Timezone has to be specified');
113 113
         }
114 114
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
     public static function setUri(Cfp $cfp, array $array)
123 123
     {
124
-        if (! isset($array['uri'])) {
124
+        if (!isset($array['uri'])) {
125 125
             throw new \InvalidArgumentException('URI has to be specified');
126 126
         }
127 127
 
@@ -130,22 +130,22 @@  discard block
 block discarded – undo
130 130
 
131 131
     public static function setEventUri(Cfp $cfp, array $array, Client $client)
132 132
     {
133
-        if (! isset($array['eventUri'])) {
133
+        if (!isset($array['eventUri'])) {
134 134
             throw new \InvalidArgumentException('Event-URI has to be specified');
135 135
         }
136 136
 
137 137
         try {
138 138
             $uri = '';
139 139
             $client->get($array['eventUri'], [
140
-                'on_stats' => function (TransferStats $stats) use (&$uri) {
140
+                'on_stats' => function(TransferStats $stats) use (&$uri) {
141 141
                     $uri = $stats->getEffectiveUri();
142 142
                 }
143 143
             ]);
144 144
         } catch (\Exception $e) {
145
-            throw new \InvalidArgumentException('Event-URI could not be verified: ' . $e->getMessage());
145
+            throw new \InvalidArgumentException('Event-URI could not be verified: '.$e->getMessage());
146 146
         }
147 147
 
148
-        $uri = (string) $uri;
148
+        $uri = (string)$uri;
149 149
         $pos = strpos($uri, '?');
150 150
         if ($pos !== false) {
151 151
             $uri = substr($uri, 0, $pos);
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 
175 175
     public static function setIconUri(Cfp $cfp, array $array)
176 176
     {
177
-        if (! isset($array['iconUri'])) {
177
+        if (!isset($array['iconUri'])) {
178 178
             return;
179 179
         }
180 180
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 
184 184
     public static function setDescription(Cfp $cfp, array $array)
185 185
     {
186
-        if (! isset($array['description'])) {
186
+        if (!isset($array['description'])) {
187 187
             return;
188 188
         }
189 189
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 
193 193
     public static function setLocation(Cfp $cfp, array $array)
194 194
     {
195
-        if (! isset($array['location'])) {
195
+        if (!isset($array['location'])) {
196 196
             return;
197 197
         }
198 198
 
@@ -201,15 +201,15 @@  discard block
 block discarded – undo
201 201
 
202 202
     public static function setGeolocation(Cfp $cfp, array $array)
203 203
     {
204
-        if (! isset($array['latitude'])) {
204
+        if (!isset($array['latitude'])) {
205 205
             return;
206 206
         }
207 207
 
208
-        if (! isset($array['longitude'])) {
208
+        if (!isset($array['longitude'])) {
209 209
             return;
210 210
         }
211 211
 
212
-        $latitude  = filter_var(
212
+        $latitude = filter_var(
213 213
             $array['latitude'],
214 214
             FILTER_SANITIZE_NUMBER_FLOAT,
215 215
             FILTER_FLAG_ALLOW_FRACTION
@@ -242,18 +242,18 @@  discard block
 block discarded – undo
242 242
 
243 243
     public static function setTags(Cfp $cfp, array $array)
244 244
     {
245
-        if (! isset($array['tags'])) {
245
+        if (!isset($array['tags'])) {
246 246
             return;
247 247
         }
248 248
 
249
-        $cfp->setTags(array_map(function ($item) {
249
+        $cfp->setTags(array_map(function($item) {
250 250
             return filter_var($item, FILTER_SANITIZE_STRING);
251 251
         }, $array['tags']));
252 252
     }
253 253
 
254 254
     public static function setSource(Cfp $cfp, array $array)
255 255
     {
256
-        if (! isset($array['source'])) {
256
+        if (!isset($array['source'])) {
257 257
             return;
258 258
         }
259 259
 
Please login to merge, or discard this patch.
src/Middleware/Renderer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
66 66
             $container['view'] = new RssRenderer();
67 67
         } elseif (strpos($accept[0], 'text/html') !== false) {
68 68
             $container         = $this->app->getContainer();
69
-            $container['view'] = function ($container) {
69
+            $container['view'] = function($container) {
70 70
                 $config = $container['settings'];
71 71
                 $tView  = new \Slim\Views\Twig(
72 72
                     $config['renderer']['template_path'],
Please login to merge, or discard this patch.
src/Entity/Cfp.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 
247 247
     public function setTimezone($timezone)
248 248
     {
249
-        if (! $timezone instanceof \DateTimeZone) {
249
+        if (!$timezone instanceof \DateTimeZone) {
250 250
             $timezone = new \DateTimeZone($timezone);
251 251
         }
252 252
 
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 
296 296
     public function addSource($source)
297 297
     {
298
-        if (! in_array($source, $this->source)) {
298
+        if (!in_array($source, $this->source)) {
299 299
             $this->source[] = $source;
300 300
         }
301 301
     }
Please login to merge, or discard this patch.