Passed
Push — develop ( b7cd40...aef793 )
by Jens
02:59
created
cloudcontrol/library/storage/Repository.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
             if (in_array($name, $this->fileBasedSubsets)) {
103 103
                 return $this->loadSubset($name);
104 104
             } else {
105
-                throw new \Exception('Trying to get undefined property from Repository: ' . $name);
105
+                throw new \Exception('Trying to get undefined property from Repository: '.$name);
106 106
             }
107 107
         }
108 108
     }
@@ -111,10 +111,10 @@  discard block
 block discarded – undo
111 111
     {
112 112
         if (in_array($name, $this->fileBasedSubsets)) {
113 113
             $this->$name = $value;
114
-            $changes = $name . 'Changes';
114
+            $changes = $name.'Changes';
115 115
             $this->$changes = true;
116 116
         } else {
117
-            throw new \Exception('Trying to persist unknown subset in repository: ' . $name . ' <br /><pre>' . print_r($value, true) . '</pre>');
117
+            throw new \Exception('Trying to persist unknown subset in repository: '.$name.' <br /><pre>'.print_r($value, true).'</pre>');
118 118
         }
119 119
     }
120 120
 
@@ -133,15 +133,15 @@  discard block
 block discarded – undo
133 133
     protected function saveSubset($subset)
134 134
     {
135 135
         $json = json_encode($this->$subset);
136
-        $subsetStoragePath = $this->storagePath . DIRECTORY_SEPARATOR . $subset . '.json';
136
+        $subsetStoragePath = $this->storagePath.DIRECTORY_SEPARATOR.$subset.'.json';
137 137
         file_put_contents($subsetStoragePath, $json);
138
-        $changes = $subset . 'Changes';
138
+        $changes = $subset.'Changes';
139 139
         $this->$changes = false;
140 140
     }
141 141
 
142 142
     protected function loadSubset($subset)
143 143
     {
144
-        $subsetStoragePath = $this->storagePath . DIRECTORY_SEPARATOR . $subset . '.json';
144
+        $subsetStoragePath = $this->storagePath.DIRECTORY_SEPARATOR.$subset.'.json';
145 145
         $json = file_get_contents($subsetStoragePath);
146 146
         $json = json_decode($json);
147 147
         $this->$subset = $json;
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
     protected function getContentDbHandle()
190 190
     {
191 191
         if ($this->contentDbHandle === null) {
192
-            $this->contentDbHandle = new \PDO('sqlite:' . $this->storagePath . DIRECTORY_SEPARATOR . 'content.db');
192
+            $this->contentDbHandle = new \PDO('sqlite:'.$this->storagePath.DIRECTORY_SEPARATOR.'content.db');
193 193
         }
194 194
         return $this->contentDbHandle;
195 195
     }
@@ -202,14 +202,14 @@  discard block
 block discarded – undo
202 202
     public function getDocumentsByPath($folderPath)
203 203
     {
204 204
         $db = $this->getContentDbHandle();
205
-        $folderPathWithWildcard = $folderPath . '%';
205
+        $folderPathWithWildcard = $folderPath.'%';
206 206
 
207 207
         $stmt = $this->getDbStatement('
208 208
             SELECT *
209 209
               FROM documents
210
-             WHERE `path` LIKE ' . $db->quote($folderPathWithWildcard) . '
211
-               AND substr(`path`, ' . (strlen($folderPath) + 1) . ') NOT LIKE "%/%"
212
-               AND path != ' . $db->quote($folderPath) . '
210
+             WHERE `path` LIKE ' . $db->quote($folderPathWithWildcard).'
211
+               AND substr(`path`, ' . (strlen($folderPath) + 1).') NOT LIKE "%/%"
212
+               AND path != ' . $db->quote($folderPath).'
213 213
           ORDER BY `type` DESC, `path` ASC
214 214
         ');
215 215
 
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
         $document = $this->fetchDocument('
254 254
             SELECT *
255 255
               FROM documents
256
-             WHERE path = ' . $db->quote($path) . '
256
+             WHERE path = ' . $db->quote($path).'
257 257
         ');
258 258
         if ($document instanceof Document && $document->type === 'folder') {
259 259
             $document->dbHandle = $db;
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
         if ($stmt === false) {
286 286
             $errorInfo = $db->errorInfo();
287 287
             $errorMsg = $errorInfo[2];
288
-            throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>');
288
+            throw new \Exception('SQLite Exception: '.$errorMsg.' in SQL: <br /><pre>'.$sql.'</pre>');
289 289
         }
290 290
         return $stmt;
291 291
     }
@@ -309,19 +309,19 @@  discard block
 block discarded – undo
309 309
         $stmt = $this->getDbStatement('
310 310
             INSERT OR REPLACE INTO documents (`path`,`title`,`slug`,`type`,`documentType`,`documentTypeSlug`,`state`,`lastModificationDate`,`creationDate`,`lastModifiedBy`,`fields`,`bricks`,`dynamicBricks`)
311 311
             VALUES(
312
-              ' . $db->quote($documentObject->path) . ',
313
-              ' . $db->quote($documentObject->title) . ',
314
-              ' . $db->quote($documentObject->slug) . ',
315
-              ' . $db->quote($documentObject->type) . ',
316
-              ' . $db->quote($documentObject->documentType) . ',
317
-              ' . $db->quote($documentObject->documentTypeSlug) . ',
318
-              ' . $db->quote($documentObject->state) . ',
319
-              ' . $db->quote($documentObject->lastModificationDate) . ',
320
-              ' . $db->quote($documentObject->creationDate) . ',
321
-              ' . $db->quote($documentObject->lastModifiedBy) . ',
322
-              ' . $db->quote(json_encode($documentObject->fields)) . ',
323
-              ' . $db->quote(json_encode($documentObject->bricks)) . ',
324
-              ' . $db->quote(json_encode($documentObject->dynamicBricks)) . '
312
+              ' . $db->quote($documentObject->path).',
313
+              ' . $db->quote($documentObject->title).',
314
+              ' . $db->quote($documentObject->slug).',
315
+              ' . $db->quote($documentObject->type).',
316
+              ' . $db->quote($documentObject->documentType).',
317
+              ' . $db->quote($documentObject->documentTypeSlug).',
318
+              ' . $db->quote($documentObject->state).',
319
+              ' . $db->quote($documentObject->lastModificationDate).',
320
+              ' . $db->quote($documentObject->creationDate).',
321
+              ' . $db->quote($documentObject->lastModifiedBy).',
322
+              ' . $db->quote(json_encode($documentObject->fields)).',
323
+              ' . $db->quote(json_encode($documentObject->bricks)).',
324
+              ' . $db->quote(json_encode($documentObject->dynamicBricks)).'
325 325
             )
326 326
         ');
327 327
         $result = $stmt->execute();
@@ -336,16 +336,16 @@  discard block
 block discarded – undo
336 336
             if ($documentToDelete->type == 'document') {
337 337
                 $stmt = $this->getDbStatement('
338 338
                     DELETE FROM documents
339
-                          WHERE path = ' . $db->quote($path) . '
339
+                          WHERE path = ' . $db->quote($path).'
340 340
                 ');
341 341
                 $stmt->execute();
342 342
             } elseif ($documentToDelete->type == 'folder') {
343
-                $folderPathWithWildcard = $path . '%';
343
+                $folderPathWithWildcard = $path.'%';
344 344
                 $stmt = $this->getDbStatement('
345 345
                     DELETE FROM documents
346
-                          WHERE (path LIKE ' . $db->quote($folderPathWithWildcard) . '
347
-                            AND substr(`path`, ' . (strlen($path) + 1) . ', 1) = "/")
348
-                            OR path = ' . $db->quote($path) . '
346
+                          WHERE (path LIKE ' . $db->quote($folderPathWithWildcard).'
347
+                            AND substr(`path`, ' . (strlen($path) + 1).', 1) = "/")
348
+                            OR path = ' . $db->quote($path).'
349 349
                 ');
350 350
                 $stmt->execute();
351 351
             }
Please login to merge, or discard this patch.