Completed
Pull Request — master (#16)
by Andreas
02:20
created
config/dependencies.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,13 +4,13 @@
 block discarded – undo
4 4
 $container = $app->getContainer();
5 5
 
6 6
 // view renderer
7
-$container['renderer'] = function ($c) {
7
+$container['renderer'] = function($c) {
8 8
     $settings = $c->get('settings')['renderer'];
9 9
     return new Slim\Views\PhpRenderer($settings['template_path']);
10 10
 };
11 11
 
12 12
 // monolog
13
-$container['logger'] = function ($c) {
13
+$container['logger'] = function($c) {
14 14
     $settings = $c->get('settings')['logger'];
15 15
     $logger = new Monolog\Logger($settings['name']);
16 16
     $logger->pushProcessor(new Monolog\Processor\UidProcessor());
Please login to merge, or discard this patch.
src/Entity/CfpListMapper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
                 'tags'           => $cfp->getTags(),
53 53
                 'lastChange'     => $cfp->getLastUdated()->format('c'),
54 54
                 '_rel'            => [
55
-                    'cfp_uri'    => 'v1/cfp/' . $cfp->getHash(),
55
+                    'cfp_uri'    => 'v1/cfp/'.$cfp->getHash(),
56 56
                 ]
57 57
             ];
58 58
 
Please login to merge, or discard this patch.
src/Entity/CfpList.php 1 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
     public function add(Cfp $cfp)
35 35
     {
36
-        if (! $this->has($cfp)) {
36
+        if (!$this->has($cfp)) {
37 37
             $this->cfps[] = $cfp;
38 38
         }
39 39
     }
Please login to merge, or discard this patch.
src/PersistenceLayer/CfpPersistenceLayer.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             ), 400);
57 57
         }
58 58
         $statement = 'INSERT into `cfp`(`dateCfpStart`, `dateCfpEnd`, `dateEventStart`, `dateEventEnd`, `name`, `uri`, `hash`, `timezone`, `description`, `eventUri`, `iconUri`, `latitude`, `longitude`, `location`, `tags`, `lastUpdate`) ' .
59
-                     'VALUES (:dateCfpStart, :dateCfpEnd, :dateEventStart, :dateEventEnd, :name, :uri, :hash, :timezone, :description, :eventUri, :iconUri, :latitude, :longitude, :location, :tags, :lastUpdate);';
59
+                        'VALUES (:dateCfpStart, :dateCfpEnd, :dateEventStart, :dateEventEnd, :name, :uri, :hash, :timezone, :description, :eventUri, :iconUri, :latitude, :longitude, :location, :tags, :lastUpdate);';
60 60
         $statement = $this->pdo->prepare($statement);
61 61
 
62 62
         $values = [
@@ -136,9 +136,9 @@  discard block
 block discarded – undo
136 136
         }
137 137
 
138 138
         $statement = 'UPDATE `cfp` SET '
139
-                   . implode(',', $statementElements) . ','
140
-                   . '`lastUpdate` = :lastUpdate '
141
-                   . 'WHERE `hash` = :fetchHash';
139
+                    . implode(',', $statementElements) . ','
140
+                    . '`lastUpdate` = :lastUpdate '
141
+                    . 'WHERE `hash` = :fetchHash';
142 142
         $statement = $this->pdo->prepare($statement);
143 143
         $values['fetchHash']  = $fetchHash;
144 144
         $values['lastUpdate'] = (new \DateTime('now', new \DateTimezone('UTC')))->format('c');
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
                 $cfp->getEventUri()
55 55
             ), 400);
56 56
         }
57
-        $statement = 'INSERT into `cfp`(`dateCfpStart`, `dateCfpEnd`, `dateEventStart`, `dateEventEnd`, `name`, `uri`, `hash`, `timezone`, `description`, `eventUri`, `iconUri`, `latitude`, `longitude`, `location`, `tags`, `lastUpdate`) ' .
57
+        $statement = 'INSERT into `cfp`(`dateCfpStart`, `dateCfpEnd`, `dateEventStart`, `dateEventEnd`, `name`, `uri`, `hash`, `timezone`, `description`, `eventUri`, `iconUri`, `latitude`, `longitude`, `location`, `tags`, `lastUpdate`) '.
58 58
                      'VALUES (:dateCfpStart, :dateCfpEnd, :dateEventStart, :dateEventEnd, :name, :uri, :hash, :timezone, :description, :eventUri, :iconUri, :latitude, :longitude, :location, :tags, :lastUpdate);';
59 59
         $statement = $this->pdo->prepare($statement);
60 60
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 
88 88
     public function update(Cfp $cfp, $fetchHash)
89 89
     {
90
-        if (! $fetchHash) {
90
+        if (!$fetchHash) {
91 91
             throw new \UnexpectedValueException('No Hash given', 400);
92 92
         }
93 93
         $oldValues = $this->select($fetchHash);
@@ -117,15 +117,15 @@  discard block
 block discarded – undo
117 117
         ];
118 118
 
119 119
         foreach ($options as $option) {
120
-            $method = 'get' . $option;
120
+            $method = 'get'.$option;
121 121
             // Merge values from tags and source before comparing!
122 122
             if (in_array($option, ['tags', 'source'])) {
123
-                $setter = 'set' . $option;
123
+                $setter = 'set'.$option;
124 124
                 $cfp->$setter(array_merge($oldValues->$method(), $cfp->$method()));
125 125
 
126 126
             }
127 127
             if ($cfp->$method() != $oldValues->$method()) {
128
-                $statementElements[] = '`' . $option . '` = :' . $option;
128
+                $statementElements[] = '`'.$option.'` = :'.$option;
129 129
                 $values[$option]     = $cfp->$method();
130 130
                 if ($values[$option] instanceof \DateTimeInterface) {
131 131
                     $values[$option] = $values[$option]->format('c');
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
         }
143 143
 
144 144
         $statement = 'UPDATE `cfp` SET '
145
-                   . implode(',', $statementElements) . ','
145
+                   . implode(',', $statementElements).','
146 146
                    . '`lastUpdate` = :lastUpdate '
147 147
                    . 'WHERE `hash` = :fetchHash';
148 148
         $statement = $this->pdo->prepare($statement);
Please login to merge, or discard this patch.
src/Middleware/OAuth.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         }
69 69
 
70 70
         $bearer = explode(' ', $auth[0]);
71
-        if (! isset($bearer[1])) {
71
+        if (!isset($bearer[1])) {
72 72
             return $this->getNoAuthResponse($response);
73 73
         }
74 74
         $bearer = $bearer[1];
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 
88 88
     protected function getNoAuthResponse($response, $error = 'no token', $description = 'No Access-Token provided')
89 89
     {
90
-        $response = $response->withHeader('WWW-Authenticate', 'Bearer realm="callingallpapers", error="' . $error . '", error_desciption="' . $description . '"');
90
+        $response = $response->withHeader('WWW-Authenticate', 'Bearer realm="callingallpapers", error="'.$error.'", error_desciption="'.$description.'"');
91 91
         $response = $response->withStatus(401);
92 92
 
93 93
         return $response;
Please login to merge, or discard this patch.
config/routes.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     \Psr\Http\Message\ResponseInterface $response
42 42
 ) use ($app){
43 43
     $params = $request->getParsedBody();
44
-    if (! is_array($params)) {
44
+    if (!is_array($params)) {
45 45
         throw new UnexpectedValueException('Expected array');
46 46
     }
47 47
 
@@ -54,18 +54,18 @@  discard block
 block discarded – undo
54 54
     $cpl->insert($cfp);
55 55
 
56 56
     $uri = $request->getUri();
57
-    $uri = $uri->withPath('v1/cfp/' . $cfp->getId());
57
+    $uri = $uri->withPath('v1/cfp/'.$cfp->getId());
58 58
     return $response->withRedirect((string)$uri, 201);
59 59
 });
60 60
 
61 61
 
62
-$app->put('/v1/cfp/{hash}', function (
62
+$app->put('/v1/cfp/{hash}', function(
63 63
     \Psr\Http\Message\ServerRequestInterface $request,
64 64
     \Psr\Http\Message\ResponseInterface $response,
65 65
     array $args
66 66
 ) use ($app){
67 67
     $params = $request->getParsedBody();
68
-    if (! is_array($params)) {
68
+    if (!is_array($params)) {
69 69
         throw new UnexpectedValueException('Expected array');
70 70
     }
71 71
 
@@ -78,12 +78,12 @@  discard block
 block discarded – undo
78 78
     $cpl->update($cfp, $args['hash']);
79 79
 
80 80
     $uri = $request->getUri();
81
-    $uri = $uri->withPath('v1/cfp/' . $cfp->getId());
81
+    $uri = $uri->withPath('v1/cfp/'.$cfp->getId());
82 82
     return $response->withHeader('Location', (string)$uri)->withStatus(204);
83 83
 });
84 84
 
85 85
 
86
-$app->delete('/v1/cfp/{id}', function (
86
+$app->delete('/v1/cfp/{id}', function(
87 87
     \Psr\Http\Message\ServerRequestInterface $request,
88 88
     \Psr\Http\Message\ResponseInterface $response
89 89
 ) use ($app){
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
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
 
60 60
         if (strpos($accept[0], 'text/html') !== false) {
61 61
             $container         = $this->app->getContainer();
62
-            $container['view'] = function ($container) {
62
+            $container['view'] = function($container) {
63 63
                 $config = $container['settings'];
64 64
                 $tView  = new \Slim\Views\Twig($config['renderer']['template_path'],
65 65
                     [
Please login to merge, or discard this patch.
src/Renderer/RssRenderer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
             'uri'   => 'http://andreas.heigl.org',
57 57
         ]);
58 58
         $feed->setDateModified(time());
59
-        if (! isset($data['cfps'])) {
59
+        if (!isset($data['cfps'])) {
60 60
             $data['cfps'] = [];
61 61
         }
62 62
         foreach ($data['cfps'] as $cfp) {
Please login to merge, or discard this patch.
src/Renderer/IcalendarRenderer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     public function render(ResponseInterface $response, array $data = [], $status = 200)
46 46
     {
47 47
         $icalendar = new VCalendar();
48
-        if (! isset($data['cfps'])) {
48
+        if (!isset($data['cfps'])) {
49 49
             $data['cfps'] = [];
50 50
         }
51 51
         foreach ($data['cfps'] as $cfp) {
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
                 'DTSTAMP' => $lastChange,
67 67
                 'UID'     => $cfp['_rel']['cfp_uri'],
68 68
                 'DESCRIPTION' => $cfp['description'],
69
-                'GEO'     => round($cfp['latitude'], 6) . ';' . round($cfp['longitude'], 6),
69
+                'GEO'     => round($cfp['latitude'], 6).';'.round($cfp['longitude'], 6),
70 70
                 'LOCATION' => $cfp['location'],
71 71
 
72 72
             ]);
Please login to merge, or discard this patch.