@@ -103,13 +103,13 @@ discard block |
||
| 103 | 103 | if (in_array($name, $this->fileBasedSubsets)) { |
| 104 | 104 | return $this->$name; |
| 105 | 105 | } else { |
| 106 | - throw new \Exception('Trying to get undefined property from Repository: ' . $name); |
|
| 106 | + throw new \Exception('Trying to get undefined property from Repository: '.$name); |
|
| 107 | 107 | } |
| 108 | 108 | } else { |
| 109 | 109 | if (in_array($name, $this->fileBasedSubsets)) { |
| 110 | 110 | return $this->loadSubset($name); |
| 111 | 111 | } else { |
| 112 | - throw new \Exception('Trying to get undefined property from Repository: ' . $name); |
|
| 112 | + throw new \Exception('Trying to get undefined property from Repository: '.$name); |
|
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | } |
@@ -124,10 +124,10 @@ discard block |
||
| 124 | 124 | { |
| 125 | 125 | if (in_array($name, $this->fileBasedSubsets)) { |
| 126 | 126 | $this->$name = $value; |
| 127 | - $changes = $name . 'Changes'; |
|
| 127 | + $changes = $name.'Changes'; |
|
| 128 | 128 | $this->$changes = true; |
| 129 | 129 | } else { |
| 130 | - throw new \Exception('Trying to persist unknown subset in repository: ' . $name . ' <br /><pre>' . print_r($value, true) . '</pre>'); |
|
| 130 | + throw new \Exception('Trying to persist unknown subset in repository: '.$name.' <br /><pre>'.print_r($value, true).'</pre>'); |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | |
@@ -153,9 +153,9 @@ discard block |
||
| 153 | 153 | protected function saveSubset($subset) |
| 154 | 154 | { |
| 155 | 155 | $json = json_encode($this->$subset); |
| 156 | - $subsetStoragePath = $this->storagePath . DIRECTORY_SEPARATOR . $subset . '.json'; |
|
| 156 | + $subsetStoragePath = $this->storagePath.DIRECTORY_SEPARATOR.$subset.'.json'; |
|
| 157 | 157 | file_put_contents($subsetStoragePath, $json); |
| 158 | - $changes = $subset . 'Changes'; |
|
| 158 | + $changes = $subset.'Changes'; |
|
| 159 | 159 | $this->$changes = false; |
| 160 | 160 | } |
| 161 | 161 | |
@@ -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 | protected 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; |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | if ($stmt === false) { |
| 334 | 334 | $errorInfo = $db->errorInfo(); |
| 335 | 335 | $errorMsg = $errorInfo[2]; |
| 336 | - throw new \Exception('SQLite Exception: ' . $errorMsg . ' in SQL: <br /><pre>' . $sql . '</pre>'); |
|
| 336 | + throw new \Exception('SQLite Exception: '.$errorMsg.' in SQL: <br /><pre>'.$sql.'</pre>'); |
|
| 337 | 337 | } |
| 338 | 338 | return $stmt; |
| 339 | 339 | } |
@@ -363,19 +363,19 @@ discard block |
||
| 363 | 363 | $stmt = $this->getDbStatement(' |
| 364 | 364 | INSERT OR REPLACE INTO documents (`path`,`title`,`slug`,`type`,`documentType`,`documentTypeSlug`,`state`,`lastModificationDate`,`creationDate`,`lastModifiedBy`,`fields`,`bricks`,`dynamicBricks`) |
| 365 | 365 | VALUES( |
| 366 | - ' . $db->quote($documentObject->path) . ', |
|
| 367 | - ' . $db->quote($documentObject->title) . ', |
|
| 368 | - ' . $db->quote($documentObject->slug) . ', |
|
| 369 | - ' . $db->quote($documentObject->type) . ', |
|
| 370 | - ' . $db->quote($documentObject->documentType) . ', |
|
| 371 | - ' . $db->quote($documentObject->documentTypeSlug) . ', |
|
| 372 | - ' . $db->quote($documentObject->state) . ', |
|
| 373 | - ' . $db->quote($documentObject->lastModificationDate) . ', |
|
| 374 | - ' . $db->quote($documentObject->creationDate) . ', |
|
| 375 | - ' . $db->quote($documentObject->lastModifiedBy) . ', |
|
| 376 | - ' . $db->quote(json_encode($documentObject->fields)) . ', |
|
| 377 | - ' . $db->quote(json_encode($documentObject->bricks)) . ', |
|
| 378 | - ' . $db->quote(json_encode($documentObject->dynamicBricks)) . ' |
|
| 366 | + ' . $db->quote($documentObject->path).', |
|
| 367 | + ' . $db->quote($documentObject->title).', |
|
| 368 | + ' . $db->quote($documentObject->slug).', |
|
| 369 | + ' . $db->quote($documentObject->type).', |
|
| 370 | + ' . $db->quote($documentObject->documentType).', |
|
| 371 | + ' . $db->quote($documentObject->documentTypeSlug).', |
|
| 372 | + ' . $db->quote($documentObject->state).', |
|
| 373 | + ' . $db->quote($documentObject->lastModificationDate).', |
|
| 374 | + ' . $db->quote($documentObject->creationDate).', |
|
| 375 | + ' . $db->quote($documentObject->lastModifiedBy).', |
|
| 376 | + ' . $db->quote(json_encode($documentObject->fields)).', |
|
| 377 | + ' . $db->quote(json_encode($documentObject->bricks)).', |
|
| 378 | + ' . $db->quote(json_encode($documentObject->dynamicBricks)).' |
|
| 379 | 379 | ) |
| 380 | 380 | '); |
| 381 | 381 | $result = $stmt->execute(); |
@@ -396,16 +396,16 @@ discard block |
||
| 396 | 396 | if ($documentToDelete->type == 'document') { |
| 397 | 397 | $stmt = $this->getDbStatement(' |
| 398 | 398 | DELETE FROM documents |
| 399 | - WHERE path = ' . $db->quote($path) . ' |
|
| 399 | + WHERE path = ' . $db->quote($path).' |
|
| 400 | 400 | '); |
| 401 | 401 | $stmt->execute(); |
| 402 | 402 | } elseif ($documentToDelete->type == 'folder') { |
| 403 | - $folderPathWithWildcard = $path . '%'; |
|
| 403 | + $folderPathWithWildcard = $path.'%'; |
|
| 404 | 404 | $stmt = $this->getDbStatement(' |
| 405 | 405 | DELETE FROM documents |
| 406 | - WHERE (path LIKE ' . $db->quote($folderPathWithWildcard) . ' |
|
| 407 | - AND substr(`path`, ' . (strlen($path) + 1) . ', 1) = "/") |
|
| 408 | - OR path = ' . $db->quote($path) . ' |
|
| 406 | + WHERE (path LIKE ' . $db->quote($folderPathWithWildcard).' |
|
| 407 | + AND substr(`path`, ' . (strlen($path) + 1).', 1) = "/") |
|
| 408 | + OR path = ' . $db->quote($path).' |
|
| 409 | 409 | '); |
| 410 | 410 | $stmt->execute(); |
| 411 | 411 | } |