@@ -105,13 +105,13 @@ discard block |
||
105 | 105 | if (in_array($name, $this->fileBasedSubsets)) { |
106 | 106 | return $this->$name; |
107 | 107 | } else { |
108 | - throw new \Exception('Trying to get undefined property from Repository: ' . $name); |
|
108 | + throw new \Exception('Trying to get undefined property from Repository: '.$name); |
|
109 | 109 | } |
110 | 110 | } else { |
111 | 111 | if (in_array($name, $this->fileBasedSubsets)) { |
112 | 112 | return $this->loadSubset($name); |
113 | 113 | } else { |
114 | - throw new \Exception('Trying to get undefined property from Repository: ' . $name); |
|
114 | + throw new \Exception('Trying to get undefined property from Repository: '.$name); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | } |
@@ -126,10 +126,10 @@ discard block |
||
126 | 126 | { |
127 | 127 | if (in_array($name, $this->fileBasedSubsets)) { |
128 | 128 | $this->$name = $value; |
129 | - $changes = $name . 'Changes'; |
|
129 | + $changes = $name.'Changes'; |
|
130 | 130 | $this->$changes = true; |
131 | 131 | } else { |
132 | - throw new \Exception('Trying to persist unknown subset in repository: ' . $name . ' <br /><pre>' . print_r($value, true) . '</pre>'); |
|
132 | + throw new \Exception('Trying to persist unknown subset in repository: '.$name.' <br /><pre>'.print_r($value, true).'</pre>'); |
|
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function save() |
140 | 140 | { |
141 | - array_map(function ($value) { |
|
141 | + array_map(function($value) { |
|
142 | 142 | $this->saveSubset($value); |
143 | 143 | }, $this->fileBasedSubsets); |
144 | 144 | } |
@@ -149,10 +149,10 @@ discard block |
||
149 | 149 | */ |
150 | 150 | protected function saveSubset($subset) |
151 | 151 | { |
152 | - $changes = $subset . 'Changes'; |
|
152 | + $changes = $subset.'Changes'; |
|
153 | 153 | if ($this->$changes === true) { |
154 | 154 | $json = json_encode($this->$subset, JSON_PRETTY_PRINT); |
155 | - $subsetStoragePath = $this->storagePath . DIRECTORY_SEPARATOR . $subset . '.json'; |
|
155 | + $subsetStoragePath = $this->storagePath.DIRECTORY_SEPARATOR.$subset.'.json'; |
|
156 | 156 | file_put_contents($subsetStoragePath, $json); |
157 | 157 | |
158 | 158 | $this->$changes = false; |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | */ |
167 | 167 | protected function loadSubset($subset) |
168 | 168 | { |
169 | - $subsetStoragePath = $this->storagePath . DIRECTORY_SEPARATOR . $subset . '.json'; |
|
169 | + $subsetStoragePath = $this->storagePath.DIRECTORY_SEPARATOR.$subset.'.json'; |
|
170 | 170 | $json = file_get_contents($subsetStoragePath); |
171 | 171 | $json = json_decode($json); |
172 | 172 | $this->$subset = $json; |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | public function getContentDbHandle() |
215 | 215 | { |
216 | 216 | if ($this->contentDbHandle === null) { |
217 | - $this->contentDbHandle = new \PDO('sqlite:' . $this->storagePath . DIRECTORY_SEPARATOR . 'content.db'); |
|
217 | + $this->contentDbHandle = new \PDO('sqlite:'.$this->storagePath.DIRECTORY_SEPARATOR.'content.db'); |
|
218 | 218 | } |
219 | 219 | return $this->contentDbHandle; |
220 | 220 | } |
@@ -237,14 +237,14 @@ discard block |
||
237 | 237 | public function getDocumentsByPath($folderPath) |
238 | 238 | { |
239 | 239 | $db = $this->getContentDbHandle(); |
240 | - $folderPathWithWildcard = $folderPath . '%'; |
|
240 | + $folderPathWithWildcard = $folderPath.'%'; |
|
241 | 241 | |
242 | 242 | $stmt = $this->getDbStatement(' |
243 | 243 | SELECT * |
244 | 244 | FROM documents |
245 | - WHERE `path` LIKE ' . $db->quote($folderPathWithWildcard) . ' |
|
246 | - AND substr(`path`, ' . (strlen($folderPath) + 1) . ') NOT LIKE "%/%" |
|
247 | - AND path != ' . $db->quote($folderPath) . ' |
|
245 | + WHERE `path` LIKE ' . $db->quote($folderPathWithWildcard).' |
|
246 | + AND substr(`path`, ' . (strlen($folderPath) + 1).') NOT LIKE "%/%" |
|
247 | + AND path != ' . $db->quote($folderPath).' |
|
248 | 248 | ORDER BY `type` DESC, `path` ASC |
249 | 249 | '); |
250 | 250 | |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | $document = $this->fetchDocument(' |
289 | 289 | SELECT * |
290 | 290 | FROM documents |
291 | - WHERE path = ' . $db->quote($path) . ' |
|
291 | + WHERE path = ' . $db->quote($path).' |
|
292 | 292 | '); |
293 | 293 | if ($document instanceof Document && $document->type === 'folder') { |
294 | 294 | $document->dbHandle = $db; |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | FROM documents |
309 | 309 | '); |
310 | 310 | $result = $stmt->fetch(\PDO::FETCH_ASSOC); |
311 | - if (!is_array($result )) { |
|
311 | + if (!is_array($result)) { |
|
312 | 312 | return 0; |
313 | 313 | } |
314 | 314 | return intval(current($result)); |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | if ($stmt === false) { |
352 | 352 | $errorInfo = $db->errorInfo(); |
353 | 353 | $errorMsg = $errorInfo[2]; |
354 | - throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>'); |
|
354 | + throw new \Exception('SQLite Exception: '.$errorMsg.' in SQL: <br /><pre>'.$sql.'</pre>'); |
|
355 | 355 | } |
356 | 356 | return $stmt; |
357 | 357 | } |
@@ -381,19 +381,19 @@ discard block |
||
381 | 381 | $stmt = $this->getDbStatement(' |
382 | 382 | INSERT OR REPLACE INTO documents (`path`,`title`,`slug`,`type`,`documentType`,`documentTypeSlug`,`state`,`lastModificationDate`,`creationDate`,`lastModifiedBy`,`fields`,`bricks`,`dynamicBricks`) |
383 | 383 | VALUES( |
384 | - ' . $db->quote($documentObject->path) . ', |
|
385 | - ' . $db->quote($documentObject->title) . ', |
|
386 | - ' . $db->quote($documentObject->slug) . ', |
|
387 | - ' . $db->quote($documentObject->type) . ', |
|
388 | - ' . $db->quote($documentObject->documentType) . ', |
|
389 | - ' . $db->quote($documentObject->documentTypeSlug) . ', |
|
390 | - ' . $db->quote($documentObject->state) . ', |
|
391 | - ' . $db->quote($documentObject->lastModificationDate) . ', |
|
392 | - ' . $db->quote($documentObject->creationDate) . ', |
|
393 | - ' . $db->quote($documentObject->lastModifiedBy) . ', |
|
394 | - ' . $db->quote(json_encode($documentObject->fields)) . ', |
|
395 | - ' . $db->quote(json_encode($documentObject->bricks)) . ', |
|
396 | - ' . $db->quote(json_encode($documentObject->dynamicBricks)) . ' |
|
384 | + ' . $db->quote($documentObject->path).', |
|
385 | + ' . $db->quote($documentObject->title).', |
|
386 | + ' . $db->quote($documentObject->slug).', |
|
387 | + ' . $db->quote($documentObject->type).', |
|
388 | + ' . $db->quote($documentObject->documentType).', |
|
389 | + ' . $db->quote($documentObject->documentTypeSlug).', |
|
390 | + ' . $db->quote($documentObject->state).', |
|
391 | + ' . $db->quote($documentObject->lastModificationDate).', |
|
392 | + ' . $db->quote($documentObject->creationDate).', |
|
393 | + ' . $db->quote($documentObject->lastModifiedBy).', |
|
394 | + ' . $db->quote(json_encode($documentObject->fields)).', |
|
395 | + ' . $db->quote(json_encode($documentObject->bricks)).', |
|
396 | + ' . $db->quote(json_encode($documentObject->dynamicBricks)).' |
|
397 | 397 | ) |
398 | 398 | '); |
399 | 399 | $result = $stmt->execute(); |
@@ -414,16 +414,16 @@ discard block |
||
414 | 414 | if ($documentToDelete->type == 'document') { |
415 | 415 | $stmt = $this->getDbStatement(' |
416 | 416 | DELETE FROM documents |
417 | - WHERE path = ' . $db->quote($path) . ' |
|
417 | + WHERE path = ' . $db->quote($path).' |
|
418 | 418 | '); |
419 | 419 | $stmt->execute(); |
420 | 420 | } elseif ($documentToDelete->type == 'folder') { |
421 | - $folderPathWithWildcard = $path . '%'; |
|
421 | + $folderPathWithWildcard = $path.'%'; |
|
422 | 422 | $stmt = $this->getDbStatement(' |
423 | 423 | DELETE FROM documents |
424 | - WHERE (path LIKE ' . $db->quote($folderPathWithWildcard) . ' |
|
425 | - AND substr(`path`, ' . (strlen($path) + 1) . ', 1) = "/") |
|
426 | - OR path = ' . $db->quote($path) . ' |
|
424 | + WHERE (path LIKE ' . $db->quote($folderPathWithWildcard).' |
|
425 | + AND substr(`path`, ' . (strlen($path) + 1).', 1) = "/") |
|
426 | + OR path = ' . $db->quote($path).' |
|
427 | 427 | '); |
428 | 428 | $stmt->execute(); |
429 | 429 | } |