@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | /** |
53 | 53 | * Repository constructor. |
54 | - * @param $storagePath |
|
54 | + * @param string $storagePath |
|
55 | 55 | * @throws \Exception |
56 | 56 | */ |
57 | 57 | public function __construct($storagePath) |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | /** |
68 | 68 | * Creates the folder in which to create all storage related files |
69 | 69 | * |
70 | - * @param $storagePath |
|
70 | + * @param string $storagePath |
|
71 | 71 | * @return bool |
72 | 72 | */ |
73 | 73 | public static function create($storagePath) |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | /** |
150 | 150 | * Persist subset to disk |
151 | - * @param $subset |
|
151 | + * @param string $subset |
|
152 | 152 | */ |
153 | 153 | protected function saveSubset($subset) |
154 | 154 | { |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
177 | - * @param $contentSqlPath |
|
177 | + * @param string $contentSqlPath |
|
178 | 178 | */ |
179 | 179 | protected function initContentDb($contentSqlPath) |
180 | 180 | { |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | } |
185 | 185 | |
186 | 186 | /** |
187 | - * @param $storageDefaultPath |
|
187 | + * @param string $storageDefaultPath |
|
188 | 188 | */ |
189 | 189 | protected function initConfigStorage($storageDefaultPath) |
190 | 190 | { |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | |
231 | 231 | /** |
232 | 232 | * Get all documents and folders in a certain path |
233 | - * @param $folderPath |
|
233 | + * @param string $folderPath |
|
234 | 234 | * @return array |
235 | 235 | * @throws \Exception |
236 | 236 | */ |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | |
311 | 311 | /** |
312 | 312 | * Return the result of the query as Document |
313 | - * @param $sql |
|
313 | + * @param string $sql |
|
314 | 314 | * @return mixed |
315 | 315 | * @throws \Exception |
316 | 316 | */ |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | /** |
386 | 386 | * Delete the document from the database |
387 | 387 | * If it's a folder, also delete it's contents |
388 | - * @param $path |
|
388 | + * @param string $path |
|
389 | 389 | * @throws \Exception |
390 | 390 | */ |
391 | 391 | public function deleteDocumentByPath($path) |
@@ -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 | } |